Created
December 6, 2021 16:08
-
-
Save gallettilance/ec310d7b143f20a109d29cb5d69326a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func (h *mykindHandler) manageSuccess(ctx context.Context, crInstance *grpv1alpha1.Mykind, reason string) (ctrl.Result, error) { | |
crInstance.Status.LastUpdate = metav1.Now() | |
crInstance.Status.Reason = reason | |
crInstance.Status.Status = metav1.StatusSuccess | |
updateErr := h.Status().Update(ctx, crInstance) | |
if updateErr != nil { | |
log.Info("Error when updating status. Requeued") | |
return ctrl.Result{RequeueAfter: time.Second * 3}, updateErr | |
} | |
return ctrl.Result{}, nil | |
} | |
func (h *mykindHandler) manageFailure(ctx context.Context, crInstance *grpv1alpha1.Mykind, err error) (ctrl.Result, error) { | |
crInstance.Status.LastUpdate = metav1.Now() | |
crInstance.Status.Reason = err.Error() | |
crInstance.Status.Status = metav1.StatusFailure | |
updateErr := h.Status().Update(ctx, crInstance) | |
if updateErr != nil { | |
log.Info("Error when updating status. Requeued") | |
return ctrl.Result{RequeueAfter: time.Second * 3}, updateErr | |
} | |
return ctrl.Result{}, err | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment