Skip to content

Unable to specify permissions bits for files and folders #871

@gabihodoroaga

Description

@gabihodoroaga

I'm trying to mount a bucket in a pod specify the permission bits like this:

apiVersion: v1
kind: Pod
metadata:
  name: gcs-fuse-csi-example-ephemeral 
  namespace: default
  annotations:
    gke-gcsfuse/volumes: "true" 
spec:
  terminationGracePeriodSeconds: 60
  containers:
  - image: busybox
    name: busybox
    command: ["sleep"]
    args: ["infinity"] 
    volumeMounts:
    - name: gcs-fuse-csi-ephemeral
      mountPath: /data
  serviceAccountName: gke-gcs-sa
  volumes:
  - name: gcs-fuse-csi-ephemeral
    csi:
      driver: gcsfuse.csi.storage.gke.io
      volumeAttributes:
        bucketName: just-a-random-bucket-name
        mountOptions: "implicit-dirs,file-system:dir-mode:777,file-system:file-mode:666" 

The permission bits are specified in octal according to the documentation, 777 and 666.

The bucket is not mounted and I see following error in the logs.

Error while mounting gcsfuse: mountWithStorageHandle: fs.NewServer: create file system: illegal file perms: --w--wx-w-

Debugging this I found out that the issue is that the driver is creating the config file as follows

file-system:
  dir-mode: 777
  file-mode: 666 

According to the documentation the permission bits should be in octal as string and not as numbers and the config file should look like this:

file-system:
  dir-mode: "777"
  file-mode: "666" 

The only workaround that I could find was to use the decimal number instead of the octal number.
For example 511 instead of 777 and 438 instead of 666.

...
        mountOptions: "implicit-dirs,file-system:dir-mode:511,file-system:file-mode:438" 
...

and works but this is not user friendly at it and does not respect the documentation.

I can create a PR to properly write the config file if this is accepted as the solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions