Skip to content

Commit 0fa4afa

Browse files
authored
update certificates with manage-cert-rotation: true label (#1034)
1 parent ab0f9b4 commit 0fa4afa

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

controllers/operator/certificate.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func (r *AuthenticationReconciler) createV1CertificateIfNotPresent(authCR *opera
252252
}
253253
}
254254

255-
// addLabelIfMissing adds "manage-cert-rotation": "yes" label to the certificate if not exist
255+
// addLabelIfMissing adds "manage-cert-rotation": "true" label to the certificate if not exist
256256
func (r *AuthenticationReconciler) addLabelIfMissing(fieldsList []*reconcileCertificateFields) (fn subreconciler.Fn) {
257257
return func(ctx context.Context) (result *ctrl.Result, err error) {
258258
reqLogger := ctrl.LoggerFrom(ctx)
@@ -289,9 +289,10 @@ func (r *AuthenticationReconciler) updateCertWithLabel(fields *reconcileCertific
289289
err = r.Get(ctx, fields.NamespacedName, cert)
290290
if err == nil {
291291
certRotationKey := "manage-cert-rotation"
292-
if _, exists := cert.Labels[certRotationKey]; !exists {
293-
reqLogger.Info("Updating Certificate with label")
294-
cert.Labels[certRotationKey] = "yes"
292+
labelValue, exists := cert.Labels[certRotationKey]
293+
if !exists || labelValue == "yes" {
294+
reqLogger.Info("Updating Certificate with label manage-cert-rotation: true")
295+
cert.Labels[certRotationKey] = "true"
295296
err = r.Update(ctx, cert)
296297
if err != nil {
297298
reqLogger.Error(err, "Failed to update Certificate with label")

0 commit comments

Comments
 (0)