Update main.go
All checks were successful
Build Go Binary / build (push) Successful in 34s

This commit is contained in:
holzi1005 2025-08-06 12:34:25 +02:00
parent 08f953b7ef
commit 144fbdd18b

View file

@ -96,6 +96,7 @@ func main() {
k8sToken := getEnv("KUBERNETES_TOKEN", "") k8sToken := getEnv("KUBERNETES_TOKEN", "")
verifySSLStr := getEnv("KUBERNETES_VERIFYSSL", "false") verifySSLStr := getEnv("KUBERNETES_VERIFYSSL", "false")
templatePath := getEnv("HAPROXY_TEMPLATE", "haproxy.tmpl") templatePath := getEnv("HAPROXY_TEMPLATE", "haproxy.tmpl")
annotationCheckEnabled := os.Getenv("KUBERNETES_ANNOTATION_HAPROXY") != ""
if k8sHost == "" || k8sToken == "" { if k8sHost == "" || k8sToken == "" {
log.Fatal("KUBERNETES_HOST and KUBERNETES_TOKEN must be set") log.Fatal("KUBERNETES_HOST and KUBERNETES_TOKEN must be set")
@ -183,8 +184,11 @@ func main() {
continue continue
} }
if val, ok := svc.Metadata.Annotations["haproxy/enabled"]; !ok || val != "true" { if annotationCheckEnabled {
continue val, ok := svc.Metadata.Annotations["haproxy/enabled"]
if !ok || val != "true" {
continue
}
} }
key := svc.Metadata.Namespace + "/" + svc.Metadata.Name key := svc.Metadata.Namespace + "/" + svc.Metadata.Name