Skip to content

Commit

Permalink
Allow external experimental remediation even if there's no controller…
Browse files Browse the repository at this point in the history
… owner.

Baremetal external experimental remediation plugs into MHC with an annotation as per https://github.com/openshift/enhancements/blob/master/enhancements/machine-api/machine-health-checking.md#out-of-tree-experimental-remediation-controller-eg-baremetal-reboot

We want it to apply even before checking the machines have an owner controller so it covers more scenarios and delegate all the responsibility on the remediaton system per https://github.com/openshift/cluster-api-provider-baremetal/blob/master/docs/remediation.md#assumptions

This will allow external remediation controller to remediate baremetal Masters which currently
don't have any controller owner.

Signed-off-by: Nir <niry@redhat.com>
  • Loading branch information
n1r1 committed Jun 11, 2020
1 parent 008d912 commit 8e2963e
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,6 @@ func (r *ReconcileMachineHealthCheck) mhcRequestsFromMachine(o handler.MapObject

func (t *target) remediate(r *ReconcileMachineHealthCheck) error {
glog.Infof(" %s: start remediation logic", t.string())
if !t.hasControllerOwner() {
glog.Infof("%s: no controller owner, skipping remediation", t.string())
return nil
}

remediationStrategy, ok := t.MHC.Annotations[remediationStrategyAnnotation]
if ok {
Expand All @@ -447,6 +443,11 @@ func (t *target) remediate(r *ReconcileMachineHealthCheck) error {
}
}

if !t.hasControllerOwner() {
glog.Infof("%s: no controller owner, skipping remediation", t.string())
return nil
}

glog.Infof("%s: deleting", t.string())
if err := r.client.Delete(context.TODO(), &t.Machine); err != nil {
r.recorder.Eventf(
Expand Down

0 comments on commit 8e2963e

Please sign in to comment.