Skip to content

Commit

Permalink
Merge pull request #410 from prasadkatti/skip_remote_pvs
Browse files Browse the repository at this point in the history
fix: do not try to get node for non-local PVs
  • Loading branch information
k8s-ci-robot authored Dec 11, 2023
2 parents d1def35 + 7e1afae commit 9cd16b4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/node-cleanup/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ func (c *CleanupController) startCleanupTimersIfNeeded() {
}

for _, pv := range pvs {
if !common.IsLocalPVWithStorageClass(pv, c.storageClassNames) {
continue
}

nodeName, ok := common.NodeAttachedToLocalPV(pv)
if !ok {
klog.Errorf("error getting node attached to pv: %s", pv)
Expand All @@ -285,7 +289,7 @@ func (c *CleanupController) startCleanupTimersIfNeeded() {
// The PV must be a local PV, have a StorageClass present in the list of storageClassNames, have a NodeAffinity
// to a deleted Node, and have a PVC bound to it (otherwise there's nothing to clean up).
func (c *CleanupController) shouldEnqueueEntry(pv *v1.PersistentVolume, nodeName string) (bool, error) {
if !common.IsLocalPVWithStorageClass(pv, c.storageClassNames) || pv.Spec.ClaimRef == nil {
if pv.Spec.ClaimRef == nil {
return false, nil
}

Expand Down

0 comments on commit 9cd16b4

Please sign in to comment.