Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into alluxio-container…
Browse files Browse the repository at this point in the history
…-network
  • Loading branch information
allenhaozi committed May 21, 2022
2 parents 0c88813 + 43ed628 commit 340484f
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 15 deletions.
1 change: 1 addition & 0 deletions charts/alluxio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
0.8.0

- Change worker from Daemonset to Statefulset
- Support container network

0.9.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ spec:
- name: FLUID_SYNC_RETRY_DURATION
value: {{ .Values.runtime.syncRetryDuration | quote }}
{{- end }}
{{- if .Values.runtime.jindo.enginetype }}
{{- if .Values.runtime.jindo.engine }}
- name: JINDO_ENGINE_TYPE
value: {{ .Values.runtime.jindo.enginetype | quote }}
value: {{ .Values.runtime.jindo.engine | quote }}
{{- end }}
ports:
- containerPort: 8080
Expand Down
23 changes: 12 additions & 11 deletions charts/fluid/fluid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ workdir: /tmp

dataset:
controller:
image: fluidcloudnative/dataset-controller:v0.8.0-4f14ed7
image: fluidcloudnative/dataset-controller:v0.8.0-5e965dc

csi:
featureGates: "FuseRecovery=false"
Expand All @@ -15,7 +15,7 @@ csi:
registrar:
image: registry.aliyuncs.com/acs/csi-node-driver-registrar:v1.2.0
plugins:
image: fluidcloudnative/fluid-csi:v0.8.0-4f14ed7
image: fluidcloudnative/fluid-csi:v0.8.0-5e965dc
kubelet:
rootDir: /var/lib/kubelet

Expand All @@ -28,9 +28,9 @@ runtime:
portRange: 20000-26000
enabled: true
init:
image: fluidcloudnative/init-users:v0.8.0-4f14ed7
image: fluidcloudnative/init-users:v0.8.0-5e965dc
controller:
image: fluidcloudnative/alluxioruntime-controller:v0.8.0-4f14ed7
image: fluidcloudnative/alluxioruntime-controller:v0.8.0-5e965dc
runtime:
# image: fluidcloudnative/alluxio:release-2.7.3-SNAPSHOT-a7154f1
image: fluidcloudnative/alluxio:release-2.8.1-SNAPSHOT-0433ade
Expand All @@ -41,41 +41,42 @@ runtime:
runtimeWorkers: 3
portRange: 18000-19999
enabled: false
engine: jindofsx
smartdata:
image: registry.cn-shanghai.aliyuncs.com/jindofs/smartdata:3.8.0
fuse:
image: registry.cn-shanghai.aliyuncs.com/jindofs/jindo-fuse:3.8.0
controller:
image: fluidcloudnative/jindoruntime-controller:v0.8.0-4f14ed7
image: fluidcloudnative/jindoruntime-controller:v0.8.0-5e965dc
init:
portCheck:
enabled: false
image: fluidcloudnative/init-users:v0.8.0-4f14ed7
image: fluidcloudnative/init-users:v0.8.0-5e965dc
goosefs:
runtimeWorkers: 3
portRange: 26000-32000
enabled: false
init:
image: fluidcloudnative/init-users:v0.8.0-4f14ed7
image: fluidcloudnative/init-users:v0.8.0-5e965dc
controller:
image: fluidcloudnative/goosefsruntime-controller:v0.8.0-4f14ed7
image: fluidcloudnative/goosefsruntime-controller:v0.8.0-5e965dc
runtime:
image: ccr.ccs.tencentyun.com/qcloud/goosefs:v1.2.0
fuse:
image: ccr.ccs.tencentyun.com/qcloud/goosefs-fuse:v1.2.0
juicefs:
enabled: false
controller:
image: fluidcloudnative/juicefsruntime-controller:v0.8.0-4f14ed7
image: fluidcloudnative/juicefsruntime-controller:v0.8.0-5e965dc
fuse:
image: registry.cn-hangzhou.aliyuncs.com/juicefs/juicefs-fuse:v1.0.0-beta2

webhook:
enabled: true
image: fluidcloudnative/fluid-webhook:v0.8.0-4f14ed7
image: fluidcloudnative/fluid-webhook:v0.8.0-5e965dc
replicas: 1

fluidapp:
enabled: true
controller:
image: fluidcloudnative/application-controller:v0.8.0-4f14ed7
image: fluidcloudnative/application-controller:v0.8.0-5e965dc
78 changes: 77 additions & 1 deletion pkg/ddc/alluxio/transform_fuse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ import (
"reflect"
"testing"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
"github.com/fluid-cloudnative/fluid/pkg/utils/fake"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestTransformFuseWithNoArgs(t *testing.T) {
Expand Down Expand Up @@ -154,3 +155,78 @@ func TestTransformFuseWithArgs(t *testing.T) {
}
}
}

func TestTransformFuseWithNetwork(t *testing.T) {
testCases := map[string]struct {
runtime *datav1alpha1.AlluxioRuntime
wantValue *Alluxio
}{
"test network mode case 1": {
runtime: &datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{
Fuse: datav1alpha1.AlluxioFuseSpec{
ImageTag: "2.8.0",
Image: "fluid/alluixo-fuse",
ImagePullPolicy: "always",
NetworkMode: datav1alpha1.ContainerNetworkMode,
},
},
},
wantValue: &Alluxio{
Fuse: Fuse{
HostNetwork: false,
},
},
},
"test network mode case 2": {
runtime: &datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{
Fuse: datav1alpha1.AlluxioFuseSpec{
ImageTag: "2.8.0",
Image: "fluid/alluixo-fuse",
ImagePullPolicy: "always",
NetworkMode: datav1alpha1.HostNetworkMode,
},
},
},
wantValue: &Alluxio{
Fuse: Fuse{
HostNetwork: true,
},
},
},
"test network mode case 3": {
runtime: &datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{
Fuse: datav1alpha1.AlluxioFuseSpec{
ImageTag: "2.8.0",
Image: "fluid/alluixo-fuse",
ImagePullPolicy: "always",
NetworkMode: "",
},
},
},
wantValue: &Alluxio{
Fuse: Fuse{
HostNetwork: true,
},
},
},
}

engine := &AlluxioEngine{Log: fake.NullLogger()}
ds := &datav1alpha1.Dataset{}
for k, v := range testCases {
gotValue := &Alluxio{}
if err := engine.transformFuse(v.runtime, ds, gotValue); err == nil {
if gotValue.Fuse.HostNetwork != v.wantValue.Fuse.HostNetwork {
t.Errorf("check %s failure, got:%t,want:%t",
k,
gotValue.Fuse.HostNetwork,
v.wantValue.Fuse.HostNetwork,
)
}
}

}
}
133 changes: 132 additions & 1 deletion pkg/ddc/alluxio/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ package alluxio
import (
"testing"

datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

datav1alpha1 "github.com/fluid-cloudnative/fluid/api/v1alpha1"
"github.com/fluid-cloudnative/fluid/pkg/utils/fake"
)

func TestTransformFuse(t *testing.T) {
Expand Down Expand Up @@ -65,3 +67,132 @@ func TestTransformFuse(t *testing.T) {
}
}
}

func TestTransformMaster(t *testing.T) {
testCases := map[string]struct {
runtime *datav1alpha1.AlluxioRuntime
wantValue *Alluxio
}{
"test network mode case 1": {
runtime: &datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{
Master: datav1alpha1.AlluxioCompTemplateSpec{
NetworkMode: datav1alpha1.ContainerNetworkMode,
},
},
},
wantValue: &Alluxio{
Master: Master{
HostNetwork: false,
},
},
},
"test network mode case 2": {
runtime: &datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{
Master: datav1alpha1.AlluxioCompTemplateSpec{
NetworkMode: datav1alpha1.HostNetworkMode,
},
},
},
wantValue: &Alluxio{
Master: Master{
HostNetwork: true,
},
},
},
"test network mode case 3": {
runtime: &datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{
Master: datav1alpha1.AlluxioCompTemplateSpec{
NetworkMode: datav1alpha1.HostNetworkMode,
},
},
},
wantValue: &Alluxio{
Master: Master{
HostNetwork: true,
},
},
},
}

engine := &AlluxioEngine{Log: fake.NullLogger()}
ds := &datav1alpha1.Dataset{}
for k, v := range testCases {
gotValue := &Alluxio{}
if err := engine.transformMasters(v.runtime, ds, gotValue); err == nil {
if gotValue.Master.HostNetwork != v.wantValue.Master.HostNetwork {
t.Errorf("check %s failure, got:%t,want:%t",
k,
gotValue.Master.HostNetwork,
v.wantValue.Master.HostNetwork,
)
}
}
}
}

func TestTransformWorkers(t *testing.T) {
testCases := map[string]struct {
runtime *datav1alpha1.AlluxioRuntime
wantValue *Alluxio
}{
"test network mode case 1": {
runtime: &datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{
Worker: datav1alpha1.AlluxioCompTemplateSpec{
NetworkMode: datav1alpha1.ContainerNetworkMode,
},
},
},
wantValue: &Alluxio{
Worker: Worker{
HostNetwork: false,
},
},
},
"test network mode case 2": {
runtime: &datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{
Worker: datav1alpha1.AlluxioCompTemplateSpec{
NetworkMode: datav1alpha1.HostNetworkMode,
},
},
},
wantValue: &Alluxio{
Worker: Worker{
HostNetwork: true,
},
},
},
"test network mode case 3": {
runtime: &datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{
Worker: datav1alpha1.AlluxioCompTemplateSpec{
NetworkMode: datav1alpha1.HostNetworkMode,
},
},
},
wantValue: &Alluxio{
Worker: Worker{
HostNetwork: true,
},
},
},
}

engine := &AlluxioEngine{Log: fake.NullLogger()}
for k, v := range testCases {
gotValue := &Alluxio{}
if err := engine.transformWorkers(v.runtime, gotValue); err == nil {
if gotValue.Worker.HostNetwork != v.wantValue.Worker.HostNetwork {
t.Errorf("check %s failure, got:%t,want:%t",
k,
gotValue.Worker.HostNetwork,
v.wantValue.Worker.HostNetwork,
)
}
}
}
}

0 comments on commit 340484f

Please sign in to comment.