Skip to content

Commit

Permalink
Add health probe endpoint flag/configuration (#137)
Browse files Browse the repository at this point in the history
Part of aws-controllers-k8s/community#2012

This patch adds a new flag to all the controllers, allowing users and
operators to setup a healthz endpoint. Very rarely those flags (Healthz
and Metrics) and modified by users, so we're assigning them distinct ports
(8080 and 8081).

Signed-off-by: Amine Hilaly <[email protected]>

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
a-hilaly authored Feb 17, 2024
1 parent 7b2f70d commit eb13154
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ const (
flagEnableLeaderElection = "enable-leader-election"
flagLeaderElectionNamespace = "leader-election-namespace"
flagMetricAddr = "metrics-addr"
flagHealthzAddr = "healthz-addr"
flagEnableDevLogging = "enable-development-logging"
flagAWSRegion = "aws-region"
flagAWSEndpointURL = "aws-endpoint-url"
Expand Down Expand Up @@ -74,6 +75,7 @@ var (
// Config contains configuration options for ACK service controllers
type Config struct {
MetricsAddr string
HealthzAddr string
EnableLeaderElection bool
LeaderElectionNamespace string
EnableDevelopmentLogging bool
Expand All @@ -99,6 +101,11 @@ func (cfg *Config) BindFlags() {
"0.0.0.0:8080",
"The address the metric endpoint binds to.",
)
flag.StringVar(
&cfg.HealthzAddr, flagHealthzAddr,
"0.0.0.0:8081",
"The address the health probe endpoint binds to.",
)
flag.BoolVar(
&cfg.EnableWebhookServer, flagEnableWebhookServer,
false,
Expand Down

0 comments on commit eb13154

Please sign in to comment.