in internal/controller/generic_controller.go [318:354]
func (r *genericReconciler[O]) setSuccessStatus(log logr.Logger, acrBinding O, pullSecret *corev1.Secret) *action[O] {
log = log.WithValues("secret", crclient.ObjectKeyFromObject(pullSecret).String())
// malformed expiry and refresh annotations indicate some other actor corrupted our pull credential secret;
// we will re-generate it with correct values in the future, at which point we can update the pull binding
formattedExpiry, annotated := pullSecret.Annotations[tokenExpiryAnnotation]
if !annotated {
log.Info("token expiry annotation not present in secret")
return nil
}
expiry, err := time.Parse(time.RFC3339, formattedExpiry)
if err != nil {
log.Error(err, "failed to parse expiry annotation")
return nil
}
formattedRefresh, annotated := pullSecret.Annotations[tokenRefreshAnnotation]
if !annotated {
log.Info("token refresh annotation not present in secret")
return nil
}
refresh, err := time.Parse(time.RFC3339, formattedRefresh)
if err != nil {
log.Error(err, "failed to parse refresh annotation")
return nil
}
if r.NeedsStatusUpdate(refresh, expiry, acrBinding) {
log.Info("updating pull binding to reflect expiry and refresh time from secret")
return &action[O]{updatePullBindingStatus: r.UpdateStatus(refresh, expiry, acrBinding)}
}
// there's nothing for us to do, but we must make sure that we re-queue for a refresh
return &action[O]{noop: acrBinding}
}