[FEATURES] The Fluid webhook allows for modifying the mountRoot in the values.yaml of the Fluid chart for sidecar mode.
What feature you'd like to add:
The Fluid webhook allows to specify the mountRoot for sidecar.
sidecar:
mountRoot: /opt/runtime-mnt
Why is this feature needed:
I also suggest validating if there are any negative impacts, such as upgrading the Fluid scenario where the old mountRoot becomes the new mountRoot. What will be the impact on existing datasets?
Test Background & Objective
Now, Fluid can start the Fuse in two mode: csi plugin and sidecar. The root mount path is defined in the values.yaml of Fluid Chart like below:
...
runtime:
...
mountRoot: /runtime-mnt
...
But in some cloud vendors, the root path /runtime-mnt is not writable. So users need to change the mountRoot. There are two ways to change this configuration:
- Set the
mountRootwhen installing Fluid:
helm install fluid --set runtime.mountRoot=<user's root mount path> fluid/fluid
- Upgrade installed Fluid with new
mountRoot:
helm upgrade fluid --set runtime.mountRoot=<user's root mount path> fluid/fluid
In this test, we want to validate that changing this configuration is effective for sidecar mode.
Test Environment & configuration
- Fluid: 0.9.1
- K8s: 1.22.4
- Dataset & Runtime (Alluxio Runtime and Minio UFS)
apiVersion: data.fluid.io/v1alpha1
kind: Dataset
metadata:
name: test-dataset
spec:
mounts:
- mountPoint: s3://zxz-test
name: test-dataset
options:
alluxio.underfs.s3.endpoint: http://<my-ip>:<my-port>
alluxio.underfs.s3.disable.dns.buckets: "true"
alluxio.underfs.s3.disable.inherit.acl: "false"
encryptOptions:
- name: aws.accessKeyId
valueFrom:
secretKeyRef:
name: minio-secret
key: aws.accessKeyId
- name: aws.secretKey
valueFrom:
secretKeyRef:
name: minio-secret
key: aws.secretKey
---
apiVersion: data.fluid.io/v1alpha1
kind: AlluxioRuntime
metadata:
name: test-dataset
spec:
replicas: 1
tieredstore:
levels:
- mediumtype: MEM
path: /dev/shm
quota: 10G
high: "0.99"
low: "0.8"
- Test Job
apiVersion: batch/v1
kind: Job
metadata:
name: demo-sidecar-job
spec:
template:
metadata:
labels:
serverless.fluid.io/inject: "true"
spec:
containers:
- name: demo
image: busybox
args:
- -c
- sleep 300; echo $(date -u) >> /out.txt
command:
- /bin/sh
volumeMounts:
- mountPath: /data
name: demo
restartPolicy: Never
volumes:
- name: demo
persistentVolumeClaim:
claimName: test-dataset
backoffLimit: 4
Test Case 1: Install Fluid with new mountRoot
-
Install Fluid with new configuration
/opt/runtime-mnt: -
Create test Dataset and Runtime:
-
Create test job:
-
Check the root mount path:
We can see the root mount path is the new configuration: mountRoot: /opt/runtime-mnt.
Test Case 2: Upgrade Fluid with new configuration when there still exist some Datasets
-
Install Fluid with default
mountRoot: -
Create Dataset and Runtime:
-
Check default root mount path:
We can see the root mount path is the default configuration: mountRoot: /runtime-mnt
-
Upgrade Fluid with new
mountRoot: -
Check the root mount path of the previous created Dataset:
We can see the root mount path is still the default configuration: mountRoot: /runtime-mnt.
Test Case 3: Upgrade Fluid with new configuration then create new Dataset
-
Install Fluid with default
mountRoot: -
Upgrade Fluid with new
mountRoot: -
Create Dataset and Runtime:
-
Check the root mount path:
We can see the root mount path is the new configuration: mountRoot: /opt/runtime-mnt
Test Case 4: Upgrade Fluid with new configuration when there are some Jobs are using Datasets.
-
Install Fluid with default
mountRoot: -
Create Dataset and Runtime:
-
Create test job:
-
Upgrade Fluid with new
mountRootwhile test job is running: -
Check the root mount path:
We can see the root mount path is still the default configuration: mountRoot: /runtime-mnt
This is how the mountRoot configuration is passed to the webhook.
For the environment variable in runtime controller, every runtime controller template file has set the MOUNT_ROOT environment variable, for example: alluxioruntime_controller.yaml#L75-L78.
So when we change the mountRoot configuration and install or upgrade Fluid, the environment variable in corresponding runtime controller will change. The new created PV after change this configuration will carry this new configuration, then the new injected container will also change the root mount path.