Skip to content

Commit 74c18d4

Browse files
committed
Leader election lease tunables
Expose the leader election tunables for lease duration, renew deadline and retry period via environment variables. This is inspired by rabbitmq operator exposes the same. Jira: OSPRH-16335 Depends-On: openstack-k8s-operators/lib-common#627
1 parent 6e687de commit 74c18d4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

main.go

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"context"
2121
"crypto/tls"
2222
"flag"
23+
"fmt"
2324
"os"
2425
"strings"
2526

@@ -47,6 +48,8 @@ import (
4748
"github.com/openstack-k8s-operators/ironic-operator/controllers"
4849
keystonev1beta1 "github.com/openstack-k8s-operators/keystone-operator/api/v1beta1"
4950
mariadbv1beta1 "github.com/openstack-k8s-operators/mariadb-operator/api/v1beta1"
51+
52+
"github.com/openstack-k8s-operators/lib-common/modules/common/operator"
5053
//+kubebuilder:scaffold:imports
5154
)
5255

@@ -97,7 +100,7 @@ func main() {
97100
c.NextProtos = []string{"http/1.1"}
98101
}
99102

100-
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
103+
options := ctrl.Options{
101104
Scheme: scheme,
102105
Metrics: metricsserver.Options{
103106
BindAddress: metricsAddr,
@@ -110,7 +113,15 @@ func main() {
110113
Port: 9443,
111114
TLSOpts: []func(config *tls.Config){disableHTTP2},
112115
}),
113-
})
116+
}
117+
118+
err := operator.SetManagerOptions(&options, setupLog)
119+
if err != nil {
120+
setupLog.Error(err, fmt.Sprintf("unable to set controller options"))
121+
os.Exit(1)
122+
}
123+
124+
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options)
114125
if err != nil {
115126
setupLog.Error(err, "unable to start manager")
116127
os.Exit(1)

0 commit comments

Comments
 (0)