Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to release finalizer for PVs created via legacy storage class #217

Closed
rfranzke opened this issue Mar 25, 2020 · 1 comment · Fixed by #218
Closed

Unable to release finalizer for PVs created via legacy storage class #217

rfranzke opened this issue Mar 25, 2020 · 1 comment · Fixed by #218
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@rfranzke
Copy link
Contributor

The out-of-tree CSI drivers are still (and forever?) compatible with the legacy (in-tree) provisioners, e.g. kubernetes.io/aws-ebs.
Provisioning + attaching a PV referencing such a storage class works perfectly fine with solely CSI. However, deleting such a volume is buggy as the external-attacher does not release its finalizer on the related PersistentVolume object.

It only watches for all VolumeAttachment and adds its finalizer to the referenced PersistentVolume on creation/update. However, when the PV gets deleted it checks whether .spec.csi is set which is not the case for a PV using a legacy provisioner. It correctly detaches the volume and releases the VolumeAttachment, though, the PersistentVolume will stuck forever in the system.

The culprit function seems to be

func (ctrl *CSIAttachController) processFinalizers(pv *v1.PersistentVolume) bool {
if pv.Spec.CSI != nil && pv.Spec.CSI.Driver == ctrl.attacherName {
return true
}
return false
}

/kind bug

@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 25, 2020
@rfranzke
Copy link
Contributor Author

Steps for reproduction:

  1. Create a Kubernetes cluster and install the necessary CSI controllers into it.
  2. Create a StorageClass with a legacy provisioner:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: gp2
parameters:
  type: gp2
provisioner: kubernetes.io/aws-ebs
reclaimPolicy: Delete
volumeBindingMode: Immediate
  1. Create a PersistentVolumeClaim referencing it and a Pod:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ebs-claim3
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: gp2
  resources:
    requests:
      storage: 4Gi

---
apiVersion: v1
kind: Pod
metadata:
  name: app3
spec:
  containers:
  - name: app
    image: centos
    command: ["/bin/sh"]
    args: ["-c", "while true; do echo $(date -u) >> /data/out.txt; sleep 5; done"]
    volumeMounts:
    - name: persistent-storage
      mountPath: /data
  volumes:
  - name: persistent-storage
    persistentVolumeClaim:
      claimName: ebs-claim3
  1. See the volume being correctly provisioned and attached. The external-attacher adds its finalizer correctly to both VolumeAttachment and PersistentVolume objects.
  2. Delete the PVC and the pod again.
  3. See the volume being correctly detached and deprovisioned/deleted from the infrastructure. However, observe that the the PersistentVolume is stuck in Terminating state as the finalizer of the external-attacher is still present.

sunnylovestiramisu added a commit to sunnylovestiramisu/external-attacher that referenced this issue Apr 12, 2023
6613c398 Merge pull request kubernetes-csi#223 from sunnylovestiramisu/update
0e7ae993 Update k8s image repo url
77e47cce Merge pull request kubernetes-csi#222 from xinydev/fix-dep-version
155854b0 Fix dep version mismatch
8f839056 Merge pull request kubernetes-csi#221 from sunnylovestiramisu/go-update
1d3f94dd Update go version to 1.20 to match k/k v1.27
e322ce5e Merge pull request kubernetes-csi#220 from andyzhangx/fix-golint-error
b74a5120 test: fix golint error
aa61bfd0 Merge pull request kubernetes-csi#218 from xing-yang/update_csi_driver
7563d196 Update CSI_PROW_DRIVER_VERSION to v1.11.0
a2171bef Merge pull request kubernetes-csi#216 from msau42/process
cb987826 Merge pull request kubernetes-csi#217 from msau42/owners
a11216e4 add new reviewers and remove inactive reviewers
dd986754 Add step for checking builds
b66c0824 Merge pull request kubernetes-csi#214 from pohly/junit-fixes
b9b6763b filter-junit.go: fix loss of testcases when parsing Ginkgo v2 JUnit
d4277839 filter-junit.go: preserve system error log
38e11468 prow.sh: publish individual JUnit files as separate artifacts

git-subtree-dir: release-tools
git-subtree-split: 6613c3980d1e418bebb7bc49d64c977cfff85671
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants