Skip to content

Commit

Permalink
pass AccessModes to thinruntime fuse container (#3696)
Browse files Browse the repository at this point in the history
* pass AccessModes to thinruntime fuse container

Signed-off-by: xliuqq <[email protected]>

* default read only many

Signed-off-by: xliuqq <[email protected]>

---------

Signed-off-by: xliuqq <[email protected]>
  • Loading branch information
xliuqq authored Jan 18, 2024
1 parent 0d24fcc commit 2723eed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions pkg/ddc/thin/transform_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ func (t *ThinEngine) transformFuseConfig(runtime *datav1alpha1.ThinRuntime, data
config.TargetPath = t.getTargetPath()
config.PersistentVolumeAttrs = pvAttributes
config.PersistentVolumeMountOptions = pvMountOptions
config.AccessModes = dataset.Spec.AccessModes

if len(config.AccessModes) == 0 {
config.AccessModes = []corev1.PersistentVolumeAccessMode{corev1.ReadOnlyMany}
}

var configStr []byte
configStr, err = json.Marshal(config)
Expand Down
5 changes: 3 additions & 2 deletions pkg/ddc/thin/transform_fuse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ func TestThinEngine_transformFuse(t1 *testing.T) {
SharedOptions: map[string]string{
"c": "d",
},
AccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteMany},
Mounts: []datav1alpha1.Mount{{
MountPoint: "abc",
Options: map[string]string{"a": "b"},
Expand Down Expand Up @@ -486,7 +487,7 @@ func TestThinEngine_transformFuse(t1 *testing.T) {
}},
// ConfigValue: "{\"/thin/fluid/test/thin-fuse\":\"a=b\"}",
// MountPath: "/thin/fluid/test/thin-fuse",
ConfigValue: "{\"mounts\":[{\"mountPoint\":\"abc\",\"options\":{\"a\":\"b\",\"c\":\"d\"}}],\"targetPath\":\"/thin/fluid/test/thin-fuse\",\"runtimeOptions\":{\"fuse-opt\":\"foo\"}}",
ConfigValue: "{\"mounts\":[{\"mountPoint\":\"abc\",\"options\":{\"a\":\"b\",\"c\":\"d\"}}],\"targetPath\":\"/thin/fluid/test/thin-fuse\",\"runtimeOptions\":{\"fuse-opt\":\"foo\"},\"accessModes\":[\"ReadWriteMany\"]}",
ConfigStorage: "configmap",
},
}
Expand Down Expand Up @@ -705,7 +706,7 @@ func TestThinEngine_transformFuseWithDuplicateOptionKey(t1 *testing.T) {
}},
// ConfigValue: "{\"/thin/fluid/test/thin-fuse\":\"a=b\"}",
// MountPath: "/thin/fluid/test/thin-fuse",
ConfigValue: "{\"mounts\":[{\"mountPoint\":\"abc\",\"options\":{\"a\":\"b\"}}],\"targetPath\":\"/thin/fluid/test/thin-fuse\"}",
ConfigValue: "{\"mounts\":[{\"mountPoint\":\"abc\",\"options\":{\"a\":\"b\"}}],\"targetPath\":\"/thin/fluid/test/thin-fuse\",\"accessModes\":[\"ReadOnlyMany\"]}",
ConfigStorage: "configmap",
},
}
Expand Down
1 change: 1 addition & 0 deletions pkg/ddc/thin/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type Config struct {
RuntimeOptions map[string]string `json:"runtimeOptions,omitempty"`
PersistentVolumeAttrs map[string]*corev1.CSIPersistentVolumeSource `json:"persistentVolumeAttrs,omitempty"`
PersistentVolumeMountOptions map[string][]string `json:"persistentVolumeMountOptions,omitempty"`
AccessModes []corev1.PersistentVolumeAccessMode `json:"accessModes,omitempty"`
}

// RuntimeSetConfig is with the info of the workers and fuses
Expand Down

0 comments on commit 2723eed

Please sign in to comment.