Skip to content

Commit c18599e

Browse files
committed
MHC: use .spec.clusterName instead of .metadata.clusterName for external
remediation request Signed-off-by: Stefan Büringer [email protected]
1 parent 8941f16 commit c18599e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/controllers/machinehealthcheck/machinehealthcheck_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ func (r *Reconciler) patchHealthyTargets(ctx context.Context, logger logr.Logger
340340
obj, err := r.getExternalRemediationRequest(ctx, m, t.Machine.Name)
341341
if err != nil {
342342
if !apierrors.IsNotFound(errors.Cause(err)) {
343-
wrappedErr := errors.Wrapf(err, "failed to fetch remediation request for machine %q in namespace %q within cluster %q", t.Machine.Name, t.Machine.Namespace, t.Machine.ClusterName)
343+
wrappedErr := errors.Wrapf(err, "failed to fetch remediation request for machine %q in namespace %q within cluster %q", t.Machine.Name, t.Machine.Namespace, t.Machine.Spec.ClusterName)
344344
errList = append(errList, wrappedErr)
345345
}
346346
continue
@@ -398,7 +398,7 @@ func (r *Reconciler) patchUnhealthyTargets(ctx context.Context, logger logr.Logg
398398
Template: from,
399399
TemplateRef: m.Spec.RemediationTemplate,
400400
Namespace: t.Machine.Namespace,
401-
ClusterName: t.Machine.ClusterName,
401+
ClusterName: t.Machine.Spec.ClusterName,
402402
OwnerRef: cloneOwnerRef,
403403
}
404404
to, err := external.GenerateTemplate(generateTemplateInput)
@@ -419,7 +419,7 @@ func (r *Reconciler) patchUnhealthyTargets(ctx context.Context, logger logr.Logg
419419
// Create the external clone.
420420
if err := r.Client.Create(ctx, to); err != nil {
421421
conditions.MarkFalse(m, clusterv1.ExternalRemediationRequestAvailable, clusterv1.ExternalRemediationRequestCreationFailed, clusterv1.ConditionSeverityError, err.Error())
422-
errList = append(errList, errors.Wrapf(err, "error creating remediation request for machine %q in namespace %q within cluster %q", t.Machine.Name, t.Machine.Namespace, t.Machine.ClusterName))
422+
errList = append(errList, errors.Wrapf(err, "error creating remediation request for machine %q in namespace %q within cluster %q", t.Machine.Name, t.Machine.Namespace, t.Machine.Spec.ClusterName))
423423
return errList
424424
}
425425
} else {

0 commit comments

Comments
 (0)