in internal/controller/legacy_token_cleanup_controller.go [96:121]
func (c *LegacyTokenCleanupController) reconcile(acrBinding *msiacrpullv1beta1.AcrPullBinding, legacySecret *corev1.Secret) *cleanupAction {
if legacySecret != nil {
if _, labelled := legacySecret.Labels[ACRPullBindingLabel]; labelled {
// legacy secret already labelled, so there's nothing left to do for this pull binding. In this case, it is
// possible that every object that required cleanup is already gone; in which case we should exit the
// process, so the Pod that succeeds us can filter the informers used to drive the controller and stop
// having to track extraneous objects
c.Log.Info("checking to see if legacy token cleanup is complete")
return &cleanupAction{checkCompletion: true}
}
updated := legacySecret.DeepCopy()
if updated.Labels == nil {
updated.Labels = map[string]string{}
}
updated.Labels[ACRPullBindingLabel] = acrBinding.GetName()
c.Log.WithValues("secretNamespace", updated.Namespace, "secretName", updated.Name).Info("adding label to pull secret")
return &cleanupAction{updateSecret: updated}
}
// legacy secret gone, so there's nothing left to do for this pull binding. In this case, it is
// possible that every object that required cleanup is already gone; in which case we should exit the
// process, so the Pod that succeeds us can filter the informers used to drive the controller and stop
// having to track extraneous objects
c.Log.Info("checking to see if legacy token cleanup is complete")
return &cleanupAction{checkCompletion: true}
}