fluid icon indicating copy to clipboard operation
fluid copied to clipboard

[FEATURES] The Fluid webhook allows for modifying the mountRoot in the values.yaml of the Fluid chart for sidecar mode.

Open cheyang opened this issue 2 years ago • 3 comments

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:

cheyang avatar Aug 17 '23 03:08 cheyang

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?

cheyang avatar Aug 17 '23 03:08 cheyang

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:

  1. Set the mountRoot when installing Fluid:
helm install fluid --set runtime.mountRoot=<user's root mount path> fluid/fluid
  1. 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

  1. Fluid: 0.9.1
  2. K8s: 1.22.4
  3. 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"
  1. 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

  1. Install Fluid with new configuration /opt/runtime-mnt: 1-1

  2. Create test Dataset and Runtime: 1-2

  3. Create test job: 1-3

  4. Check the root mount path: 1-4

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

  1. Install Fluid with default mountRoot: 2-1

  2. Create Dataset and Runtime: 2-2

  3. Check default root mount path: 2-3

We can see the root mount path is the default configuration: mountRoot: /runtime-mnt

  1. Upgrade Fluid with new mountRoot: 2-4

  2. Check the root mount path of the previous created Dataset: 2-5

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

  1. Install Fluid with default mountRoot: 3-1

  2. Upgrade Fluid with new mountRoot: 3-2

  3. Create Dataset and Runtime: 3-3

  4. Check the root mount path: 3-4

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.

  1. Install Fluid with default mountRoot: 4-1

  2. Create Dataset and Runtime: 4-2

  3. Create test job: 4-3

  4. Upgrade Fluid with new mountRoot while test job is running: 4-4

  5. Check the root mount path: 4-5

We can see the root mount path is still the default configuration: mountRoot: /runtime-mnt

zhang-x-z avatar Aug 20 '23 09:08 zhang-x-z

This is how the mountRoot configuration is passed to the webhook. sidcar-mount-root

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.

zhang-x-z avatar Aug 21 '23 07:08 zhang-x-z