From 49b02e6664ffb1fc6ec8a87771166b0e8343acad Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Wed, 5 Oct 2022 11:17:00 +0200 Subject: [PATCH] remove leader election --- cmd/manager/main.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/cmd/manager/main.go b/cmd/manager/main.go index 904da7ea..a99ccfb6 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -1,7 +1,6 @@ package main import ( - "context" "flag" "fmt" "os" @@ -20,8 +19,6 @@ import ( "github.com/app-sre/deployment-validation-operator/pkg/validations" "github.com/app-sre/deployment-validation-operator/version" - "github.com/operator-framework/operator-lib/leader" - "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/config" @@ -98,22 +95,6 @@ func main() { os.Exit(1) } - if inCluster { - // leader.Become looks for the operator namespace using a hard-coded - // path that assumes it is running inside a cluster and no workaround - // is immediately obvious. If running outside the cluster then the - // file wouldn't normally exist and this call will fail. If running - // outside a cluster, then leader election probably isn't that - // important anyway so we don't even try to do it. - ctx := context.TODO() - // Become the leader before proceeding - err = leader.Become(ctx, "deployment-validation-operator-lock") - if err != nil { - log.Error(err, "Failed to get leader lock") - os.Exit(1) - } - } - // Set default manager options options := manager.Options{ Namespace: namespace,