Skip to content

Commit 508097f

Browse files
authored
Merge pull request #1889 from k8s-infra-cherrypick-robot/cherry-pick-1885-to-release-1.5
🐛 [release-1.5] Handles cluster owner ref error for node controller
2 parents e09a225 + bec6dbe commit 508097f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

controllers/node_controller.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@ func (r nodeLabelReconciler) Reconcile(ctx goctx.Context, req ctrl.Request) (_ c
111111
}
112112

113113
cluster, err := clusterutilv1.GetClusterFromMetadata(r.ControllerContext, r.Client, machine.ObjectMeta)
114-
if err == nil {
115-
if annotations.IsPaused(cluster, machine) {
116-
logger.V(4).Info("Machine linked to a cluster that is paused")
117-
return reconcile.Result{}, nil
118-
}
114+
if err != nil {
115+
logger.Error(err, "Could not fetch cluster data", "machine", key)
116+
return reconcile.Result{}, nil
117+
}
118+
if annotations.IsPaused(cluster, machine) {
119+
logger.V(4).Info("Machine linked to a cluster that is paused")
120+
return reconcile.Result{}, nil
119121
}
120122

121123
if !machine.DeletionTimestamp.IsZero() {

0 commit comments

Comments
 (0)