diff --git a/README.md b/README.md index 901afbfa5..bb8d9e13e 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,7 @@ Usage of amazon-eks-pod-identity-webhook: --log_file string If non-empty, use this log file --log_file_max_size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800) --logtostderr log to standard error instead of files (default true) - --metrics-port int Port to listen on for metrics and healthz (http) (default 9999) + --metrics-port int Port to listen on for metrics (http) (default 9999) --namespace string (in-cluster) The namespace name this webhook, the TLS secret, and configmap resides in (default "eks") --port int Port to listen on (default 443) --service-name string (in-cluster) The service name fronting this webhook (default "pod-identity-webhook") diff --git a/main.go b/main.go index ebf521619..bcd363308 100644 --- a/main.go +++ b/main.go @@ -49,7 +49,7 @@ var webhookVersion = "v0.1.0" func main() { port := flag.Int("port", 443, "Port to listen on") - metricsPort := flag.Int("metrics-port", 9999, "Port to listen on for metrics and healthz (http)") + metricsPort := flag.Int("metrics-port", 9999, "Port to listen on for metrics (http)") // TODO Group in help text in-cluster/out-of-cluster/business logic flags // out-of-cluster kubeconfig / TLS options @@ -220,9 +220,14 @@ func main() { handler.Logging(), ) mux.Handle("/mutate", baseHandler) + mux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "ok") + }) metricsMux := http.NewServeMux() metricsMux.Handle("/metrics", promhttp.Handler()) + // TODO: Remove this extra healthz endpoint once we've migrated + // the health check service to the application port: metricsMux.HandleFunc("/healthz", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "ok") }) @@ -311,7 +316,7 @@ func main() { } }() - klog.Infof("Listening on %s for metrics and healthz", metricsAddr) + klog.Infof("Listening on %s for metrics", metricsAddr) if err := metricsServer.ListenAndServe(); err != http.ErrServerClosed { klog.Fatalf("Error listening: %q", err) }