Enable controller-runtime probes
Signed-off-by: Hidde Beydals <hello@hidde.co>
This commit is contained in:
parent
47a565866b
commit
3fd74bb938
6
main.go
6
main.go
|
@ -38,6 +38,7 @@ import (
|
||||||
"github.com/fluxcd/pkg/runtime/events"
|
"github.com/fluxcd/pkg/runtime/events"
|
||||||
"github.com/fluxcd/pkg/runtime/logger"
|
"github.com/fluxcd/pkg/runtime/logger"
|
||||||
"github.com/fluxcd/pkg/runtime/metrics"
|
"github.com/fluxcd/pkg/runtime/metrics"
|
||||||
|
"github.com/fluxcd/pkg/runtime/probes"
|
||||||
|
|
||||||
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
|
||||||
"github.com/fluxcd/source-controller/controllers"
|
"github.com/fluxcd/source-controller/controllers"
|
||||||
|
@ -66,6 +67,7 @@ func main() {
|
||||||
var (
|
var (
|
||||||
metricsAddr string
|
metricsAddr string
|
||||||
eventsAddr string
|
eventsAddr string
|
||||||
|
healthAddr string
|
||||||
enableLeaderElection bool
|
enableLeaderElection bool
|
||||||
storagePath string
|
storagePath string
|
||||||
storageAddr string
|
storageAddr string
|
||||||
|
@ -80,6 +82,7 @@ func main() {
|
||||||
"The address the metric endpoint binds to.")
|
"The address the metric endpoint binds to.")
|
||||||
flag.StringVar(&eventsAddr, "events-addr", envOrDefault("EVENTS_ADDR", ""),
|
flag.StringVar(&eventsAddr, "events-addr", envOrDefault("EVENTS_ADDR", ""),
|
||||||
"The address of the events receiver.")
|
"The address of the events receiver.")
|
||||||
|
flag.StringVar(&healthAddr, "health-addr", ":9440", "The address the health endpoint binds to.")
|
||||||
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
|
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
|
||||||
"Enable leader election for controller manager. "+
|
"Enable leader election for controller manager. "+
|
||||||
"Enabling this will ensure there is only one active controller manager.")
|
"Enabling this will ensure there is only one active controller manager.")
|
||||||
|
@ -122,6 +125,7 @@ func main() {
|
||||||
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
|
mgr, err := ctrl.NewManager(restConfig, ctrl.Options{
|
||||||
Scheme: scheme,
|
Scheme: scheme,
|
||||||
MetricsBindAddress: metricsAddr,
|
MetricsBindAddress: metricsAddr,
|
||||||
|
HealthProbeBindAddress: healthAddr,
|
||||||
Port: 9443,
|
Port: 9443,
|
||||||
LeaderElection: enableLeaderElection,
|
LeaderElection: enableLeaderElection,
|
||||||
LeaderElectionID: "305740c0.fluxcd.io",
|
LeaderElectionID: "305740c0.fluxcd.io",
|
||||||
|
@ -133,6 +137,8 @@ func main() {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
probes.SetupChecks(mgr, setupLog)
|
||||||
|
|
||||||
if storageAdvAddr == "" {
|
if storageAdvAddr == "" {
|
||||||
storageAdvAddr = determineAdvStorageAddr(storageAddr, setupLog)
|
storageAdvAddr = determineAdvStorageAddr(storageAddr, setupLog)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue