external-provisioner
external-provisioner copied to clipboard
fix: add defence logic for PV without claime ref
What type of PR is this?
/kind bug
What this PR does / why we need it: App crashes when deleting PVs without ClaimRef.
I1014 03:34:47.331898 1 controller.go:1471] delete "pvc-a6f2adab-036b-4833-b5c7-eaf84626c351": started
E1014 03:34:47.332068 1 runtime.go:79] Observed a panic: "invalid memory address or nil pointer dereference" (runtime error: invalid memory address or nil pointer dereference)
goroutine 257 [running]:
k8s.io/apimachinery/pkg/util/runtime.logPanic({0x1805020?, 0x29703c0})
/workspace/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:75 +0x99
k8s.io/apimachinery/pkg/util/runtime.HandleCrash({0x0, 0x0, 0xc0005af920?})
/workspace/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go:49 +0x75
panic({0x1805020, 0x29703c0})
/go/pkg/csiprow.XXXXDeFLHD/go-1.18/src/runtime/panic.go:838 +0x207
github.com/kubernetes-csi/external-provisioner/pkg/controller.(*csiProvisioner).getSecretsFromSC(0xc0003b8640, {0x1cdf738, 0xc0005b4300}, 0xc00071e500, 0x0, 0xc0006f08c0)
/workspace/pkg/controller/controller.go:1272 +0x2a2
...
When we use Custom Resource RunnerSets of action-runner-controller,
That controller sets specific PV's ClaimRef to nil to release from PVC resource https://github.com/actions-runner-controller/actions-runner-controller/blob/master/controllers/sync_volumes.go#L161-L176
In that case, this can lead to many PVs without a ClaimRef.
Which issue(s) this PR fixes:
Fixes #None
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
None
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: zezaeoh / name: Zezae Oh (06ccf62af9ce47baf8157773ab8e28f0af8abe84)
Welcome @zezaeoh!
It looks like this is your first PR to kubernetes-csi/external-provisioner 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.
You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.
You can also check if kubernetes-csi/external-provisioner has its own contribution guidelines.
You may want to refer to our testing guide if you run into trouble with your tests not passing.
If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!
Thank you, and welcome to Kubernetes. :smiley:
Hi @zezaeoh. Thanks for your PR.
I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
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/test-infra repository.
/ok-to-test
Can you add some logs to the PR description to show that this error is triggered?
@RaunakShah
Could you review again? :)
/approve /lgtm
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: RaunakShah, zezaeoh
Once this PR has been reviewed and has the lgtm label, please assign xing-yang for approval by writing /assign @xing-yang in a comment. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
New changes are detected. LGTM label has been removed.
@Madhu-1 @RaunakShah
Could you review again?
@zezaeoh changes look good, can you add also add some testing results to the description? For example, the logs showing that csi-provisioner doesn't crash but also that the CSI driver eventually does not delete the volume?
@zezaeoh do you know how it's possible that a volume for PV without ClaimRef is deleted? That should be nearly impossible.
/lgtm /approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: jsafrane, RaunakShah, zezaeoh
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [jsafrane]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment