From 2dcd48ef6f525e7ae53131ee38c95068eade1ad6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?=
 <charled.breteche@gmail.com>
Date: Tue, 1 Nov 2022 15:33:41 +0000
Subject: [PATCH] fix: do not cancel context when loosing the lead (#5180)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
---
 cmd/kyverno/main.go | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/cmd/kyverno/main.go b/cmd/kyverno/main.go
index 1078747ab6..5e0c562262 100644
--- a/cmd/kyverno/main.go
+++ b/cmd/kyverno/main.go
@@ -661,9 +661,6 @@ func main() {
 		config.KyvernoPodName(),
 		func(ctx context.Context) {
 			logger := logger.WithName("leader")
-			// when losing the lead we just terminate the pod
-			// TODO: remove when we run the leader election loop continuously
-			defer signalCancel()
 			// validate config
 			// if err := webhookCfg.ValidateWebhookConfigurations(config.KyvernoNamespace(), config.KyvernoConfigMapName()); err != nil {
 			// 	logger.Error(err, "invalid format of the Kyverno init ConfigMap, please correct the format of 'data.webhooks'")