From eb1315466efb1aad375d49b17845495043c614f7 Mon Sep 17 00:00:00 2001 From: Amine Date: Sat, 17 Feb 2024 11:43:05 -0600 Subject: [PATCH] Add health probe endpoint flag/configuration (#137) Part of https://github.com/aws-controllers-k8s/community/issues/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 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --- pkg/config/config.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/config/config.go b/pkg/config/config.go index b47bef1..6030b59 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -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" @@ -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 @@ -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,