@@ -49,45 +49,47 @@ const (
4949 DefaultMutatingWebhookName = "coherence-operator-mutating-webhook-configuration"
5050 DefaultValidatingWebhookName = "coherence-operator-validating-webhook-configuration"
5151
52- FlagCACertRotateBefore = "ca-cert-rotate-before"
53- FlagCACertValidity = "ca-cert-validity"
54- FlagCertType = "cert-type"
55- FlagCertIssuer = "cert-issuer"
56- FlagCoherenceImage = "coherence-image"
57- FlagCRD = "install-crd"
58- FlagJobCRD = "install-job-crd"
59- FlagEnableCoherenceJobs = "enable-jobs"
60- FlagDevMode = "coherence-dev-mode"
61- FlagCipherDenyList = "cipher-deny-list"
62- FlagCipherAllowList = "cipher-allow-list"
63- FlagConfig = "config"
64- FlagConfigType = "config-type"
65- FlagDryRun = "dry-run"
66- FlagEnableWebhook = "enable-webhook"
67- FlagEnableHttp2 = "enable-http2"
68- FlagGlobalAnnotation = "global-annotation"
69- FlagGlobalLabel = "global-label"
70- FlagHealthAddress = "health-addr"
71- FlagLeaderElection = "enable-leader-election"
72- FlagMetricsAddress = "metrics-addr"
73- FlagMutatingWebhookName = "mutating-webhook-name"
74- FlagOperatorNamespace = "operator-namespace"
75- FlagNodeLookupEnabled = "node-lookup-enabled"
76- FlagRackLabel = "rack-label"
77- FlagRestHost = "rest-host"
78- FlagRestPort = "rest-port"
79- FlagSecureMetrics = "metrics-secure"
80- FlagServiceName = "service-name"
81- FlagServicePort = "service-port"
82- FlagSiteLabel = "site-label"
83- FlagSkipServiceSuspend = "skip-service-suspend"
84- FlagOperatorImage = "operator-image"
85- FlagValidatingWebhookName = "validating-webhook-name"
86- FlagWebhookCertDir = "webhook-cert-dir"
87- FlagWebhookSecret = "webhook-secret"
88- FlagWebhookService = "webhook-service"
89- FlagEnvVar = "env"
90- FlagJvmArg = "jvm"
52+ FlagCACertRotateBefore = "ca-cert-rotate-before"
53+ FlagCACertValidity = "ca-cert-validity"
54+ FlagCertType = "cert-type"
55+ FlagCertIssuer = "cert-issuer"
56+ FlagCoherenceImage = "coherence-image"
57+ FlagCRD = "install-crd"
58+ FlagJobCRD = "install-job-crd"
59+ FlagEnableCoherenceJobs = "enable-jobs"
60+ FlagDevMode = "coherence-dev-mode"
61+ FlagCipherDenyList = "cipher-deny-list"
62+ FlagCipherAllowList = "cipher-allow-list"
63+ FlagConfig = "config"
64+ FlagConfigType = "config-type"
65+ FlagDryRun = "dry-run"
66+ FlagEnableWebhook = "enable-webhook"
67+ FlagEnableHttp2 = "enable-http2"
68+ FlagGlobalAnnotation = "global-annotation"
69+ FlagGlobalLabel = "global-label"
70+ FlagHealthAddress = "health-addr"
71+ FlagLeaderElection = "enable-leader-election"
72+ FlagLeaderElectionDuration = "leader-election-duration"
73+ FlagLeaderElectionRenew = "leader-election-renew-timeout"
74+ FlagMetricsAddress = "metrics-addr"
75+ FlagMutatingWebhookName = "mutating-webhook-name"
76+ FlagOperatorNamespace = "operator-namespace"
77+ FlagNodeLookupEnabled = "node-lookup-enabled"
78+ FlagRackLabel = "rack-label"
79+ FlagRestHost = "rest-host"
80+ FlagRestPort = "rest-port"
81+ FlagSecureMetrics = "metrics-secure"
82+ FlagServiceName = "service-name"
83+ FlagServicePort = "service-port"
84+ FlagSiteLabel = "site-label"
85+ FlagSkipServiceSuspend = "skip-service-suspend"
86+ FlagOperatorImage = "operator-image"
87+ FlagValidatingWebhookName = "validating-webhook-name"
88+ FlagWebhookCertDir = "webhook-cert-dir"
89+ FlagWebhookSecret = "webhook-secret"
90+ FlagWebhookService = "webhook-service"
91+ FlagEnvVar = "env"
92+ FlagJvmArg = "jvm"
9193
9294 // EnvVarWatchNamespace is the environment variable to use to set the watch namespace(s)
9395 EnvVarWatchNamespace = "WATCH_NAMESPACE"
@@ -304,6 +306,17 @@ func SetupFlags(cmd *cobra.Command, v *viper.Viper) {
304306 FlagCipherAllowList ,
305307 nil ,
306308 "A list of TLS cipher names to be enabled (if a cipher appears in this list and the deny list it will be disabled)" )
309+ cmd .Flags ().Duration (
310+ FlagLeaderElectionDuration ,
311+ time .Second * 30 ,
312+ "The value the Operator uses for the leadership lease duration. " +
313+ "Setting this value too low can cause Pod restarts as the leader may lose leadership. " +
314+ "If the value entered is less than 10s, then 10s will be used" )
315+ cmd .Flags ().Duration (
316+ FlagLeaderElectionRenew ,
317+ time .Second * 20 ,
318+ "The duration the Operator uses for the leadership lease renewal timeout. " +
319+ "If the value entered is less than 10s, then 10s will be used" )
307320
308321 // enable using dashed notation in flags and underscores in env
309322 v .SetEnvKeyReplacer (strings .NewReplacer ("-" , "_" ))
0 commit comments