Skip to content

Commit

Permalink
Add LeaderElectionID config flag (#118)
Browse files Browse the repository at this point in the history
* Add LeaderElectionID config flag

* Remove ControllerManagerConfig
  • Loading branch information
regadas authored Sep 27, 2021
1 parent 400ab4e commit 95f339b
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 36 deletions.
3 changes: 1 addition & 2 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
15 changes: 4 additions & 11 deletions config/default/manager_config_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
11 changes: 0 additions & 11 deletions config/manager/controller_manager_config.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -74,6 +77,7 @@ func main() {
MetricsBindAddress: metricsAddr,
LeaderElection: enableLeaderElection,
Namespace: watchNamespace,
LeaderElectionID: leaderElectionID,
})
if err != nil {
setupLog.Error(err, "Unable to start manager")
Expand Down

0 comments on commit 95f339b

Please sign in to comment.