Skip to content

Commit

Permalink
Add Tencent GooseFS Cache Engine to fluid backend
Browse files Browse the repository at this point in the history
Signed-off-by: xieydd <xieydd@gmail.com>
  • Loading branch information
xieydd committed Jul 9, 2021
1 parent deea51a commit ed12216
Show file tree
Hide file tree
Showing 121 changed files with 17,184 additions and 74 deletions.
14 changes: 12 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CRD_OPTIONS ?= "crd:trivialVersions=true"
DATASET_CONTROLLER_IMG ?= registry.aliyuncs.com/fluid/dataset-controller
ALLUXIORUNTIME_CONTROLLER_IMG ?= registry.aliyuncs.com/fluid/alluxioruntime-controller
JINDORUNTIME_CONTROLLER_IMG ?= registry.aliyuncs.com/fluid/jindoruntime-controller
GOOSEFSRUNTIME_CONTROLLER_IMG ?= ccr.ccs.tencentyun.com/fluid/goosefsruntime-controller
CSI_IMG ?= registry.aliyuncs.com/fluid/fluid-csi
LOADER_IMG ?= registry.aliyuncs.com/fluid/fluid-dataloader
INIT_USERS_IMG ?= registry.aliyuncs.com/fluid/init-users
Expand Down Expand Up @@ -65,6 +66,9 @@ alluxioruntime-controller-build: generate fmt vet
jindoruntime-controller-build: generate fmt vet
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=off go build -gcflags="-N -l" -a -o bin/jindoruntime-controller -ldflags '${LDFLAGS}' cmd/jindo/main.go

goosefsruntime-controller-build: generate fmt vet
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=off go build -gcflags="-N -l" -a -o bin/goosefsruntime-controller -ldflags '${LDFLAGS}' cmd/goosefs/main.go

webhook-build: generate fmt vet
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=off go build -gcflags="-N -l" -a -o bin/fluid-webhook -ldflags '${LDFLAGS}' cmd/webhook/main.go

Expand Down Expand Up @@ -122,6 +126,9 @@ docker-build-alluxioruntime-controller: generate fmt vet
docker-build-jindoruntime-controller: generate fmt vet
docker build --no-cache . -f docker/Dockerfile.jindoruntime -t ${JINDORUNTIME_CONTROLLER_IMG}:${GIT_VERSION}

docker-build-goosefsruntime-controller: generate fmt vet
docker build --no-cache . -f docker/Dockerfile.goosefsruntime -t ${GOOSEFSRUNTIME_CONTROLLER_IMG}:${GIT_VERSION}

docker-build-csi: generate fmt vet
docker build --no-cache . -f docker/Dockerfile.csi -t ${CSI_IMG}:${GIT_VERSION}

Expand All @@ -144,6 +151,9 @@ docker-push-alluxioruntime-controller: docker-build-alluxioruntime-controller
docker-push-jindoruntime-controller: docker-build-jindoruntime-controller
docker push ${JINDORUNTIME_CONTROLLER_IMG}:${GIT_VERSION}

docker-push-goosefsruntime-controller: docker-build-goosefsruntime-controller
docker push ${GOOSEFSRUNTIME_CONTROLLER_IMG}:${GIT_VERSION}

docker-push-csi: docker-build-csi
docker push ${CSI_IMG}:${GIT_VERSION}

Expand All @@ -156,8 +166,8 @@ docker-push-init-users: docker-build-init-users
docker-push-webhook: docker-build-webhook
docker push ${WEBHOOK_IMG}:${GIT_VERSION}

docker-build-all: docker-build-dataset-controller docker-build-alluxioruntime-controller docker-build-jindoruntime-controller docker-build-csi docker-build-init-users fluid-build-webhook
docker-push-all: docker-push-dataset-controller docker-push-alluxioruntime-controller docker-push-jindoruntime-controller docker-push-csi docker-push-init-users docker-push-webhook
docker-build-all: docker-build-dataset-controller docker-build-alluxioruntime-controller docker-build-jindoruntime-controller docker-build-goosefsruntime-controller docker-build-csi docker-build-init-users fluid-build-webhook
docker-push-all: docker-push-dataset-controller docker-push-alluxioruntime-controller docker-push-jindoruntime-controller docker-push-jindoruntime-controller docker-push-csi docker-push-init-users docker-push-webhook

# find or download controller-gen
# download controller-gen if necessary
Expand Down
207 changes: 207 additions & 0 deletions api/v1alpha1/goosefsruntime_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// GooseFSCompTemplateSpec is a description of the GooseFS commponents
type GooseFSCompTemplateSpec struct {
// Replicas is the desired number of replicas of the given template.
// If unspecified, defaults to 1.
// +kubebuilder:validation:Minimum=1
// replicas is the min replicas of dataset in the cluster
// +optional
Replicas int32 `json:"replicas,omitempty"`

// Options for JVM
JvmOptions []string `json:"jvmOptions,omitempty"`

// Configurable properties for the GOOSEFS component. <br>
// Refer to <a href="https://cloud.tencent.com/document/product/436/56415">GOOSEFS Configuration Properties</a> for more info
// +optional
Properties map[string]string `json:"properties,omitempty"`

// Ports used by GooseFS(e.g. rpc: 19998 for master)
// +optional
Ports map[string]int `json:"ports,omitempty"`

// Resources that will be requested by the GooseFS component. <br>
// <br>
// Resources are not allowed for ephemeral containers. Ephemeral containers use spare resources
// already allocated to the pod.
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`

// Environment variables that will be used by GooseFS component. <br>
Env map[string]string `json:"env,omitempty"`

// Enabled or Disabled for the components. For now, only API Gateway is enabled or disabled.
// +optional
Enabled bool `json:"enabled,omitempty"`

// NodeSelector is a selector which must be true for the master to fit on a node
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}

// GooseFSFuseSpec is a description of the GooseFS Fuse
type GooseFSFuseSpec struct {

// Image for GooseFS Fuse(e.g. goosefs/goosefs-fuse)
Image string `json:"image,omitempty"`

// Image Tag for GooseFS Fuse(e.g. v1.0.1)
ImageTag string `json:"imageTag,omitempty"`

// One of the three policies: `Always`, `IfNotPresent`, `Never`
ImagePullPolicy string `json:"imagePullPolicy,omitempty"`

// Options for JVM
JvmOptions []string `json:"jvmOptions,omitempty"`

// Configurable properties for the GOOSEFS component. <br>
// Refer to <a href="https://cloud.tencent.com/document/product/436/56415">GOOSEFS Configuration Properties</a> for more info
Properties map[string]string `json:"properties,omitempty"`

// Environment variables that will be used by GooseFS Fuse
Env map[string]string `json:"env,omitempty"`

// Resources that will be requested by GooseFS Fuse. <br>
// <br>
// Resources are not allowed for ephemeral containers. Ephemeral containers use spare resources
// already allocated to the pod.
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`

// Arguments that will be passed to GooseFS Fuse
Args []string `json:"args,omitempty"`

// If the fuse client should be deployed in global mode,
// otherwise the affinity should be considered
// +optional
Global bool `json:"global,omitempty"`

// NodeSelector is a selector which must be true for the fuse client to fit on a node,
// this option only effect when global is enabled
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
}

// GooseFSRuntimeSpec defines the desired state of GooseFSRuntime
type GooseFSRuntimeSpec struct {
// The version information that instructs fluid to orchestrate a particular version of GooseFS.
GooseFSVersion VersionSpec `json:"goosefsVersion,omitempty"`

// Desired state for GooseFS master
Master GooseFSCompTemplateSpec `json:"master,omitempty"`

// Desired state for GooseFS job master
JobMaster GooseFSCompTemplateSpec `json:"jobMaster,omitempty"`

// Desired state for GooseFS worker
Worker GooseFSCompTemplateSpec `json:"worker,omitempty"`

// Desired state for GooseFS job Worker
JobWorker GooseFSCompTemplateSpec `json:"jobWorker,omitempty"`

// Desired state for GooseFS API Gateway
APIGateway GooseFSCompTemplateSpec `json:"apiGateway,omitempty"`

// The spec of init users
InitUsers InitUsersSpec `json:"initUsers,omitempty"`

// Desired state for GooseFS Fuse
Fuse GooseFSFuseSpec `json:"fuse,omitempty"`

// Configurable properties for the GOOSEFS component. <br>
// Refer to <a href="https://cloud.tencent.com/document/product/436/56415">GOOSEFS Configuration Properties</a> for more info
Properties map[string]string `json:"properties,omitempty"`

// Options for JVM
JvmOptions []string `json:"jvmOptions,omitempty"`

// Tiered storage used by GooseFS
Tieredstore Tieredstore `json:"tieredstore,omitempty"`

// Management strategies for the dataset to which the runtime is bound
Data Data `json:"data,omitempty"`

// The replicas of the worker, need to be specified
Replicas int32 `json:"replicas,omitempty"`

// Manage the user to run GooseFS Runtime
// GooseFS support POSIX-ACL and Apache Ranger to manager authorization
// TODO(chrisydxie@tencent.com) Support Apache Ranger.
RunAs *User `json:"runAs,omitempty"`

// Disable monitoring for GooseFS Runtime
// Promethous is enabled by default
// +optional
DisablePrometheus bool `json:"disablePrometheus,omitempty"`

// Name of the configMap used to support HDFS configurations when using HDFS as GooseFS's UFS. The configMap
// must be in the same namespace with the GooseFSRuntime. The configMap should contain user-specific HDFS conf files in it.
// For now, only "hdfs-site.xml" and "core-site.xml" are supported. It must take the filename of the conf file as the key and content
// of the file as the value.
// +optional
HadoopConfig string `json:"hadoopConfig,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.currentWorkerNumberScheduled,selectorpath=.status.selector
// +kubebuilder:printcolumn:name="Ready Masters",type="integer",JSONPath=`.status.masterNumberReady`,priority=10
// +kubebuilder:printcolumn:name="Desired Masters",type="integer",JSONPath=`.status.desiredMasterNumberScheduled`,priority=10
// +kubebuilder:printcolumn:name="Master Phase",type="string",JSONPath=`.status.masterPhase`,priority=0
// +kubebuilder:printcolumn:name="Ready Workers",type="integer",JSONPath=`.status.workerNumberReady`,priority=10
// +kubebuilder:printcolumn:name="Desired Workers",type="integer",JSONPath=`.status.desiredWorkerNumberScheduled`,priority=10
// +kubebuilder:printcolumn:name="Worker Phase",type="string",JSONPath=`.status.workerPhase`,priority=0
// +kubebuilder:printcolumn:name="Ready Fuses",type="integer",JSONPath=`.status.fuseNumberReady`,priority=10
// +kubebuilder:printcolumn:name="Desired Fuses",type="integer",JSONPath=`.status.desiredFuseNumberScheduled`,priority=10
// +kubebuilder:printcolumn:name="Fuse Phase",type="string",JSONPath=`.status.fusePhase`,priority=0
// +kubebuilder:printcolumn:name="API Gateway",type="string",JSONPath=`.status.apiGateway.endpoint`,priority=10
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=`.metadata.creationTimestamp`,priority=0
// +genclient

// GooseFSRuntime is the Schema for the goosefsruntimes API
type GooseFSRuntime struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec GooseFSRuntimeSpec `json:"spec,omitempty"`
Status RuntimeStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// GooseFSRuntimeList contains a list of GooseFSRuntime
type GooseFSRuntimeList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []GooseFSRuntime `json:"items"`
}

func init() {
SchemeBuilder.Register(&GooseFSRuntime{}, &GooseFSRuntimeList{})
}

// Replicas gets the replicas of runtime worker
func (runtime *GooseFSRuntime) Replicas() int32 {
return runtime.Spec.Replicas
}
Loading

0 comments on commit ed12216

Please sign in to comment.