Skip to content

Commit 3fd74bb

Browse files
committed
Enable controller-runtime probes
Signed-off-by: Hidde Beydals <[email protected]>
1 parent 47a5658 commit 3fd74bb

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

main.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838
"github.com/fluxcd/pkg/runtime/events"
3939
"github.com/fluxcd/pkg/runtime/logger"
4040
"github.com/fluxcd/pkg/runtime/metrics"
41+
"github.com/fluxcd/pkg/runtime/probes"
4142

4243
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
4344
"github.com/fluxcd/source-controller/controllers"
@@ -66,6 +67,7 @@ func main() {
6667
var (
6768
metricsAddr string
6869
eventsAddr string
70+
healthAddr string
6971
enableLeaderElection bool
7072
storagePath string
7173
storageAddr string
@@ -80,6 +82,7 @@ func main() {
8082
"The address the metric endpoint binds to.")
8183
flag.StringVar(&eventsAddr, "events-addr", envOrDefault("EVENTS_ADDR", ""),
8284
"The address of the events receiver.")
85+
flag.StringVar(&healthAddr, "health-addr", ":9440", "The address the health endpoint binds to.")
8386
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
8487
"Enable leader election for controller manager. "+
8588
"Enabling this will ensure there is only one active controller manager.")
@@ -120,19 +123,22 @@ func main() {
120123

121124
restConfig := client.GetConfigOrDie(clientOptions)
122125
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
123-
Scheme: scheme,
124-
MetricsBindAddress: metricsAddr,
125-
Port: 9443,
126-
LeaderElection: enableLeaderElection,
127-
LeaderElectionID: "305740c0.fluxcd.io",
128-
Namespace: watchNamespace,
129-
Logger: ctrl.Log,
126+
Scheme: scheme,
127+
MetricsBindAddress: metricsAddr,
128+
HealthProbeBindAddress: healthAddr,
129+
Port: 9443,
130+
LeaderElection: enableLeaderElection,
131+
LeaderElectionID: "305740c0.fluxcd.io",
132+
Namespace: watchNamespace,
133+
Logger: ctrl.Log,
130134
})
131135
if err != nil {
132136
setupLog.Error(err, "unable to start manager")
133137
os.Exit(1)
134138
}
135139

140+
probes.SetupChecks(mgr, setupLog)
141+
136142
if storageAdvAddr == "" {
137143
storageAdvAddr = determineAdvStorageAddr(storageAddr, setupLog)
138144
}

0 commit comments

Comments
 (0)