-
Notifications
You must be signed in to change notification settings - Fork 39.4k
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
Don't try to create VolumeSpec immediately after underlying PVC is being deleted #86670
Conversation
f008055
to
132d9e2
Compare
6def92f
to
d6a6dfa
Compare
/test pull-kubernetes-e2e-gce |
/cc @msau42 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tackling this bug :)
I left some stylistic comments below.
I also have two requests :)
- I'd love to see some form of test coverage for this change.
- Can you share more about how we can be confident that we're updating
pvcBeingDeleted
everywhere that we need to? These types of changes always make me nervous that either we're missing a place where we should be updatingpvcBeingDeleted
, or more likely, in six months someone will make a change and forget to updatepvcBeingDeleted
.
pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go
Outdated
Show resolved
Hide resolved
pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go
Outdated
Show resolved
Hide resolved
d6a6dfa
to
bda1816
Compare
I renamed the map pvcsUnderDeletion (using plural) to distinguish from the constant. For test coverage, after running through desired_state_of_world_populator_test.go, I haven't found how the following would be hit:
I think the best proof is the (significantly) reduced QPS in load test (ref #86434). For #2, findAndRemoveDeletedPods is the only func which handles pod removal from volume. |
/priority important-soon |
@jingxu97 Once you confirm, I will replicate the changes to other tests. |
026c470
to
415ac40
Compare
/test pull-kubernetes-kubemark-e2e-gce-big |
I was looking at failed storage test in https://prow.k8s.io/view/gcs/kubernetes-jenkins/pr-logs/pull/86670/pull-kubernetes-e2e-gce/1217223508564643840/ From kubelet log in https://gcsweb.k8s.io/gcs/kubernetes-jenkins/pr-logs/pull/86670/pull-kubernetes-e2e-gce/1217223508564643840/artifacts/e2e-856a555d1e-674b9-minion-group-02tq/
|
From kubelet.log in https://gcsweb.k8s.io/gcs/kubernetes-jenkins/pr-logs/pull/86670/pull-kubernetes-e2e-gce/1217254343355404288/artifacts/e2e-c322eb374e-674b9-minion-group-24bm/
Should be related to: |
/test pull-kubernetes-e2e-gce |
1 similar comment
/test pull-kubernetes-e2e-gce |
@msau42 @jingxu97 [sig-storage] PersistentVolumes-local [Volume type: dir-bindmounted] One pod requesting one prebound PVC should be able to mount volume and write from pod1 expand_more 2m32s [sig-storage] PersistentVolumes-local [Volume type: dir-link] One pod requesting one prebound PVC should be able to mount volume and read from pod1 expand_more I have verified that calling desiredStateOfWorld.GetUniqueVolumeName() versus the getUniqueVolumeName() in dswp makes no difference. Let me see if I can find out why the above two tests don't pass. |
/test pull-kubernetes-e2e-gce |
1 similar comment
/test pull-kubernetes-e2e-gce |
@tedyu thanks, pls let me know if I can help anything. |
@tedyu - any progress on that? I think this would be really useful to have - we're hitting it a lot in scalability tests (I know, we can change the tests, but fixing that seems more appropriate in general) |
@wojtek-t |
/test pull-kubernetes-e2e-gce |
@tedyu: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
in favor of #88141 |
@@ -326,10 +327,16 @@ func (dswp *desiredStateOfWorldPopulator) processPodVolumes( | |||
allVolumesAdded = false | |||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this continue will skip the rest if it fails to createVolumeSpec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If volumeSpec is not useful, the subsequent GetUniqueVolumeName() call shouldn't be made. Hence the continue.
If you know a way to bypass using volumeSpec, please let me know.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
podVolume.Name is of the form: dswp-test-volume-name
uniqueVolumeName is of the form: fake-plugin/dswp-test-volume-name
I cannot use podVolume.Name in place of uniqueVolumeName
if err == nil { | ||
// Add volume to desired state of world | ||
_, err = dswp.desiredStateOfWorld.AddPodToVolume( | ||
uniquePodName, pod, uniqueVolumeName, volumeSpec, podVolume.Name, volumeGidValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need to change AddPodToVolume interface actually.
The previous GetUniqueVolumeName is only called if createVolumeSpec failed.
Here only after createVolumeSpec passes, it calls AddPodToVolume.
Sorry for the confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you mentioned, GetUniqueVolumeName is called when createVolumeSpec fails. It seems the refactoring in desiredStateOfWorld is useful.
I'd like to keep it if possible.
@@ -271,8 +280,8 @@ func (dsw *desiredStateOfWorld) AddPodToVolume( | |||
dsw.volumesToMount[volumeName] = volumeToMount{ | |||
volumeName: volumeName, | |||
podsToMount: make(map[types.UniquePodName]podToMount), | |||
pluginIsAttachable: attachable, | |||
pluginIsDeviceMountable: deviceMountable, | |||
pluginIsAttachable: dsw.isAttachableVolume(volumeSpec), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you don't change the interface, here you call GetUniqueVolumeName, and that function could return uniquename, and also pluginIsAttachable and pluginIsDeviceMountable information, I think
What type of PR is this?
/kind bug
What this PR does / why we need it:
As @mm4tt mentioned in #86434, when PVC is being deleted, desired_state_of_world_populator shouldn't try to create VolumeSpec.
This PR is a performance bug fix.
The fix is rebased on @jingxu97 's comment:
#86670 (comment)
Original proposal is to add map pvcsUnderDeletion to desiredStateOfWorldPopulator.
The map is from namespaced claim name to the earliest time when next GET request to api-server is made.
The proposal is able to handle generic api server error return and limits the change within desired_state_of_world_populator.go
Which issue(s) this PR fixes:
Fixes #86434
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: