juicedata / juicefs-csi-driver

JuiceFS CSI Driver
https://github.com/juicedata/juicefs
Apache License 2.0
223 stars 85 forks source link

[BUG] csi v0.25.0 can not manage exist mount pod which has no hashval annotation #1147

Closed SonglinLife closed 1 month ago

SonglinLife commented 1 month ago

What happened: In version v0.25.0, a new mount pod annotation hashval was added for passing fusefd to mount pod. I check the pod driver code, found it will throw error, if mount pod has no hashval annotation(create by old version csi). https://github.com/juicedata/juicefs-csi-driver/blob/c545bcd8d343d10eca9cd49959edb1dac52b596a/pkg/controller/pod_driver.go#L152-L158

And worse, csi uses err group to handle mount pod. since exist mount pod checkAnnotations throw a error, this driver will cancel other mount pods' reconcile.

https://github.com/juicedata/juicefs-csi-driver/blob/c545bcd8d343d10eca9cd49959edb1dac52b596a/pkg/controller/reconciler.go#L147-L153

What you expected to happen:

remove hashval annotaintion check, not throw an error for exist mount pod.

How to reproduce it (as minimally and precisely as possible):

zwwhdls commented 1 month ago

The mount pod must have hashVal label no matter what version CSI is. We think pod without hashVal label is not mount pod.

Besides, mount pods which can smooth upgraded must meet the following conditions:

  1. CSI version >=v0.25.0
  2. created by CSI with v0.25.0 version and above.
  3. image must be ce-v1.2.1 or ee-5.1.0 and above.

See more details in https://juicefs.com/docs/zh/csi/upgrade-juicefs-client#smooth-upgrade

SonglinLife commented 1 month ago

@zwwhdls sorry for my mistake, hashval not add in verion v0.25.0, but it clear that mount pod hashval was added after v0.13.2

in version v0.13.2, we can see mount pod has no hashval annotation, and pod name has no hash suffix.

https://github.com/juicedata/juicefs-csi-driver/blob/91b1fe08d35d68047b1a7385d6fad424dc980c3c/pkg/juicefs/mount/pod_mount.go#L420-L422 we can see the exist mount create by only v0.13.2, it has no hash suffix, and no hashval annotation.

juicefs-svr40176in5112-vacation-ai-pv                      1/1     Running             0          350d    app.kubernetes.io/name=juicefs-mount,app.paas.ctrip.com/appid=100010351,cdos.ctrip.com/region=SHA,paas.ctrip.com/bu=SYS,paas.ctrip.com/env=PROD,paas.ctrip.com/orgid=58,paas.ctrip.com/type=app,topology.kubernetes.io/region=SHA,topology.kubernetes.io/zone=SHARB