controller-runtime icon indicating copy to clipboard operation
controller-runtime copied to clipboard

ENVTest - cannot delete PVCs in BDD test

Open rahulsb opened this issue 1 year ago • 1 comments

In my BDD test of operator, I would like to delete the PVCs created before running nee test as the cleanup. While deleting the PVC they remains in the pending state. Are there any workaround or solutions using ENVTest.

Using : sigs.k8s.io/controller-runtime v0.16.5

rahulsb avatar Jun 17 '24 11:06 rahulsb

I assume usually the kube-controller-manager does something there? (it doesn't exist in envtest)

sbueringer avatar Jun 17 '24 14:06 sbueringer

This is because the finalizer kubernetes.io/pvc-protection is automatically added when creating the PVC, but there is no controller to handle the finalizer when deleting in the ENVTest environment, so the PVC remains in pending. You can perform an update or patch to remove the finalizer of the PVC before deleting.

Yesphet avatar Jul 12 '24 08:07 Yesphet

This is because the finalizer kubernetes.io/pvc-protection is automatically added when creating the PVC, but there is no controller to handle the finalizer when deleting in the ENVTest environment, so the PVC remains in pending. You can perform an update or patch to remove the finalizer of the PVC before deleting.

thanks @Yesphet , this solution works.

rahulsb avatar Jul 15 '24 05:07 rahulsb

Great!

/close

sbueringer avatar Jul 15 '24 06:07 sbueringer

@sbueringer: Closing this issue.

In response to this:

Great!

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Jul 15 '24 06:07 k8s-ci-robot