Skip to content

Commit

Permalink
Do not try to get node for non-local PVs
Browse files Browse the repository at this point in the history
Remote source PVs (like AWS EBS) do not have a node associated with them.
This commit skips the node lookup for such PVs.

Otherwise, the controller logs the following error for each remote PV:

```bash
error getting node attached to pv: &PersistentVolume{...}
```
  • Loading branch information
prasadkatti committed Oct 16, 2023
1 parent 2ec4c83 commit 7e1afae
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 7e1afae

Please sign in to comment.