Skip to content

Commit a9cbb61

Browse files
authored
Improve failed registration logging and logic (rancher#47)
* Improve the RegistrationIsFailed error logs and prevent infinite re-queue of failed objects * Fix namespace in-case using custom setting * only use additional failure context when currentCondition is set
1 parent c56087f commit a9cbb61

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

pkg/controllers/controller.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,20 @@ func (h *handler) OnRegistrationChange(_ string, registrationObj *v1.Registratio
557557
}
558558

559559
if shared.RegistrationIsFailed(registrationObj) {
560-
return registrationObj, errors.New("registration has failed status; create a new one to retry")
560+
failedCondition := registrationObj.Status.CurrentCondition
561+
if failedCondition != nil {
562+
h.log.Errorf("registration `%s` has the Failure status condition from: %v", registrationObj.Name, failedCondition)
563+
} else {
564+
h.log.Errorf("registration `%s` has the Failure status condition active", registrationObj.Name)
565+
}
566+
h.log.Warnf("reviewing the registration `%s` for other errors is advised before retrying", registrationObj.Name)
567+
568+
errorFixHint := fmt.Sprintf("delete this registration `%s` and then create a new one to try again.", registrationObj.Name)
569+
if shared.RegistrationHasManagedFinalizer(registrationObj) {
570+
errorFixHint = fmt.Sprintf("delete the entrypoint secret `%s/%s`, give it time to clean up, and then create a new one to try again.", h.options.SystemNamespace, consts.ResourceSCCEntrypointSecretName)
571+
}
572+
h.log.Warn("after resolving the issue(s), " + errorFixHint)
573+
return registrationObj, nil
561574
}
562575

563576
// Skip keepalive for anything activated within the last 20 hours

0 commit comments

Comments
 (0)