manager: Remove leader election
Now CNAO is using Recreate as the upgrade strategy so there is always
only one CNAO pod active, leader election is not needed anymore.
package main
import (
- "context"
"flag"
"log"
"os"
@@ -9,7 +8,6 @@ import (
osv1 "github.com/openshift/api/operator/v1"
"github.com/operator-framework/operator-sdk/pkg/k8sutil"
- "github.com/operator-framework/operator-sdk/pkg/leader"
sdkVersion "github.com/operator-framework/operator-sdk/version"
"github.com/spf13/pflag"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
@@ -50,15 +48,6 @@ func main() {
os.Exit(1)
}
- ctx := context.TODO()
-
- // Become the leader before proceeding
- err = leader.Become(ctx, "cluster-network-addons-operator-lock")
- if err != nil {
- log.Printf("failed to become operator leader: %v", err)
- os.Exit(1)
- }
-
// Create a new Cmd to provide shared dependencies and start components
mgr, err := manager.New(cfg, manager.Options{
Namespace: namespace,
