Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove leader election #168

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"context"
"flag"
"fmt"
"os"
Expand All @@ -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"
Expand Down Expand Up @@ -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,
Expand Down