From 0abee660554ed380579a2dd8f9127484e883f4f7 Mon Sep 17 00:00:00 2001 From: Knative Prow Robot Date: Tue, 30 Jul 2024 14:27:22 +0100 Subject: [PATCH] clean up old certificate leases (#15424) Co-authored-by: Stavros Kontopoulos --- pkg/cleanup/cmd/cleanup/cleanup.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkg/cleanup/cmd/cleanup/cleanup.go b/pkg/cleanup/cmd/cleanup/cleanup.go index da94ff744c2c..b2d1a02052c5 100644 --- a/pkg/cleanup/cmd/cleanup/cleanup.go +++ b/pkg/cleanup/cmd/cleanup/cleanup.go @@ -32,6 +32,11 @@ import ( "knative.dev/pkg/system" ) +const ( + networkingCertificatesReconcilerLease = "controller.knative.dev.networking.pkg.certificates.reconciler.reconciler" + controlProtocolCertificatesReconcilerLease = "controller.knative.dev.control-protocol.pkg.certificates.reconciler.reconciler" +) + func main() { logger := setupLogger() defer logger.Sync() @@ -60,8 +65,11 @@ func main() { if err != nil { logger.Fatal("failed to fetch leases: ", err) } + for _, lease := range leases.Items { - if strings.HasPrefix(lease.Name, "domainmapping") || strings.HasPrefix(lease.Name, "net-certmanager") { + if strings.HasPrefix(lease.Name, "domainmapping") || + strings.HasPrefix(lease.Name, "net-certmanager") || + strings.HasPrefix(lease.Name, networkingCertificatesReconcilerLease) || strings.HasPrefix(lease.Name, controlProtocolCertificatesReconcilerLease) { if err = client.CoordinationV1().Leases(system.Namespace()).Delete(context.Background(), lease.Name, metav1.DeleteOptions{}); err != nil && !apierrs.IsNotFound(err) { logger.Fatalf("failed to delete lease %s: %v", lease.Name, err) }