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

Add LeaderElectionID config flag #118

Merged
merged 2 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
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
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