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