Skip to content

Commit b71ef7c

Browse files
VijetaPriya47test
authored andcommitted
Refactor certificate expiry rollout check to use slices.ContainsFunc
1 parent c5cef6a commit b71ef7c

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

controlplane/kubeadm/internal/controllers/controller.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,9 @@ func (r *KubeadmControlPlaneReconciler) reconcile(ctx context.Context, controlPl
539539
}
540540

541541
// Check if the rollout is due to certificate expiry
542-
isCertExpiryRollout := false
543-
for _, msg := range upToDateResult.LogMessages {
544-
if strings.Contains(msg, internal.CertificateExpiryRolloutLogMessage) {
545-
isCertExpiryRollout = true
546-
break
547-
}
548-
}
542+
isCertExpiryRollout := slices.ContainsFunc(upToDateResult.LogMessages, func(msg string) bool {
543+
return strings.Contains(msg, internal.CertificateExpiryRolloutLogMessage)
544+
})
549545

550546
if isCertExpiryRollout {
551547
// Event on Machine (the victim) - tells the machine why it's being rolled out

0 commit comments

Comments
 (0)