diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 866720d7..a4af7a7f 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -45,8 +45,7 @@ patchesStrategicMerge: - manager_auth_proxy_patch.yaml # Mount the controller config file for loading manager configurations - # through a ComponentConfig type - #- manager_config_patch.yaml + - manager_config_patch.yaml # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in # crd/kustomization.yaml diff --git a/config/default/manager_auth_proxy_patch.yaml b/config/default/manager_auth_proxy_patch.yaml index af735df1..20eb3ad3 100644 --- a/config/default/manager_auth_proxy_patch.yaml +++ b/config/default/manager_auth_proxy_patch.yaml @@ -33,9 +33,3 @@ spec: ports: - containerPort: 8443 name: https - - name: manager - args: - - "--metrics-addr=127.0.0.1:8080" - - "--watch-namespace=" - # - "--enable-leader-election" - # - "--health-probe-bind-address=:8081" diff --git a/config/default/manager_config_patch.yaml b/config/default/manager_config_patch.yaml index 6c400155..1d975b47 100644 --- a/config/default/manager_config_patch.yaml +++ b/config/default/manager_config_patch.yaml @@ -7,14 +7,7 @@ spec: template: spec: containers: - - name: manager - args: - - "--config=controller_manager_config.yaml" - volumeMounts: - - name: manager-config - mountPath: /controller_manager_config.yaml - subPath: controller_manager_config.yaml - volumes: - - name: manager-config - configMap: - name: manager-config + - name: manager + args: + - "--metrics-addr=127.0.0.1:8080" + - "--enable-leader-election" diff --git a/config/manager/controller_manager_config.yaml b/config/manager/controller_manager_config.yaml deleted file mode 100644 index 36852801..00000000 --- a/config/manager/controller_manager_config.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 -kind: ControllerManagerConfig -health: - healthProbeBindAddress: :8081 -metrics: - bindAddress: 127.0.0.1:8080 -webhook: - port: 9443 -leaderElection: - leaderElect: true - resourceName: cbe16497.flinkoperator.k8s.io diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index a6b39f73..0abf8451 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -18,11 +18,6 @@ resources: generatorOptions: disableNameSuffixHash: true -configMapGenerator: - - files: - - controller_manager_config.yaml - name: manager-config - apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: diff --git a/main.go b/main.go index 3ed2bce6..c7b0d5ec 100644 --- a/main.go +++ b/main.go @@ -50,11 +50,14 @@ func init() { func main() { var metricsAddr string - var enableLeaderElection bool var watchNamespace string + var enableLeaderElection bool + var leaderElectionID string flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.") flag.BoolVar(&enableLeaderElection, "enable-leader-election", false, "Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.") + flag.StringVar(&leaderElectionID, "leader-election-id", "flink-operator-lock", + "The name that leader election will use for holding the leader lock") flag.StringVar( &watchNamespace, "watch-namespace", @@ -74,6 +77,7 @@ func main() { MetricsBindAddress: metricsAddr, LeaderElection: enableLeaderElection, Namespace: watchNamespace, + LeaderElectionID: leaderElectionID, }) if err != nil { setupLog.Error(err, "Unable to start manager")