csi-gcs icon indicating copy to clipboard operation
csi-gcs copied to clipboard

Editing annotations on an existing PVC

Open fradeve opened this issue 4 years ago • 4 comments

Hi all -- thanks for bringing us this project, it's just great!

I am using v0.6.1 I have updated an existing PVC with the following annotation (+ shows the addition):

  apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    name: foobar
    annotations:
      gcs.csi.ofek.dev/project-id: {{ .Values.gcloud.project }}
      gcs.csi.ofek.dev/location: {{ .Values.gcloud.region }}
      gcs.csi.ofek.dev/bucket: {{ .Values.code }}-foobar
      gcs.csi.ofek.dev/uid: "0"
      gcs.csi.ofek.dev/gid: "0"
+     gcs.csi.ofek.dev/limit-ops-per-sec: "-1"

The PVC has been correctly updated, and I killed the Pod mounting this PVC so that it has been re-mounted. Looking at the logs in the csi-gcs Pod I see the following when the volume is mounted:

"Mounting cmd (mount) with arguments ([-t gcsfuse -o key_file=/tmp/keys/122073239,allow_other,dir_mode=0775,file_mode=0664,uid=0,gid=0 us-foobar /var/lib/kubelet/pods/63d32ac5-1aac-4338-8d0d-0f7ac3d09cc9/volumes/kubernetes.io~csi/pvc-edb69964-0e18-4716-a8b4-92edf8bdee19/mount])"

I can see how some of the annotations that were originally in the PVC are showing up in the gcsfuse command (e.g. uid or gid) but I can't see the limit-ops-per-sec option anywhere.

So I wonder: are these kind of updates to the PVC actually picked up when re-mounting the volume, or do they apply only when the PVC is created the first time?

Thanks

Update

I have created a fresh new PVC and mounted it on a deployment and this csi-gcs is logging the following:

Mounting cmd (mount) with arguments ([-t gcsfuse -o 
key_file=/tmp/keys/030309528,allow_other,dir_mode=0775,file_mode=0664,
uid=0,gid=0,limit_ops_per_sec=-1 foobar /var/lib/kubelet/pods/0130f46a-7ae9-4dd2-acab-d3a697f1f5ec/volumes/kubernetes.io~csi/pvc-d7a805a1-abd1-43a8-b473-cf1e06e005dc/mount])

it seems that creating a new PVC will use the right gcsfuse flags, but updating an existing PVC doesn't guarantee that gcsfuse flags are updated.

fradeve avatar Apr 06 '21 21:04 fradeve

@fradeve The CSI spec (at least at the time when I was implementing this) had no notion of changing PVC params.

The CSI Node Plugin mounts as specified by the PV and not the PVC. If you change the annotation on the PVC, this sadly has no effect on the PV and we don't get a call to the Controller Plugin to update/remount the PV.

So if the spec hasn't improved in that area, I do not think that you'll get around re-creating the PVC.

maennchen avatar Apr 08 '21 05:04 maennchen

Thanks for clarifying this :+1: Eventually I figured out that I had to re-create the PVC altogether, and that worked :+1:

fradeve avatar Apr 08 '21 09:04 fradeve

Can this be closed?

ofek avatar Apr 09 '21 14:04 ofek

@ofek I'd like to keep it open to see if there's a way to achieve that before I close.

maennchen avatar Apr 12 '21 08:04 maennchen