Skip to content

Commit

Permalink
fix: Disable internal lb annotation for Azure cluster install (#399)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzottola authored Dec 12, 2024
1 parent d833c1d commit f0bce9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func injectAzureAKSValues(clusterHelmValuesContent string) (*string, error) {
ingressNginxController["service"] = map[string]interface{}{
"externalTrafficPolicy": "Local",
"annotations": map[string]interface{}{
"service.beta.kubernetes.io/azure-load-balancer-internal": "true",
"service.beta.kubernetes.io/azure-load-balancer-internal": "false",
},
}
} else {
Expand All @@ -274,11 +274,11 @@ func injectAzureAKSValues(clusterHelmValuesContent string) (*string, error) {

if ingressNginxControllerService["annotations"] == nil {
ingressNginxControllerService["annotations"] = map[string]interface{}{
"service.beta.kubernetes.io/azure-load-balancer-internal": "true",
"service.beta.kubernetes.io/azure-load-balancer-internal": "false",
}
} else {
ingressNginxControllerServiceAnnotations := ingressNginxControllerService["annotations"].(map[string]interface{})
ingressNginxControllerServiceAnnotations["service.beta.kubernetes.io/azure-load-balancer-internal"] = "true"
ingressNginxControllerServiceAnnotations["service.beta.kubernetes.io/azure-load-balancer-internal"] = "false"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ ingress-nginx:
controller:
service:
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
service.beta.kubernetes.io/azure-load-balancer-internal: "false"
externalTrafficPolicy: Local
useComponentLabel: true
fullnameOverride: ingress-nginx
Expand Down Expand Up @@ -219,15 +219,11 @@ ingress-nginx:
controller:
service:
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
service.beta.kubernetes.io/azure-load-balancer-internal: "false"
externalTrafficPolicy: Local
useComponentLabel: true
fullnameOverride: ingress-nginx
`
/*
"\ningress-nginx:\n controller:\n service:\n externalTrafficPolicy: Local\n annotations:\n service.beta.kubernetes.io/azure-load-balancer-internal: \"true\"\n useComponentLabel: true\n fullnameOverride: ingress-nginx\n"
"\ningress-nginx:\n controller:\n service:\n annotations:\n service.beta.kubernetes.io/azure-load-balancer-internal: \"true\"\n externalTrafficPolicy: Local\n"
*/
assert.Contains(t, expectedYamlNginxIngress, fileWriterService.FileContentWritten)
})
t.Run("Should succeed to create a new AKS self managed cluster when ingress-nginx.controller.service is defined with annotations", func(t *testing.T) {
Expand Down Expand Up @@ -290,15 +286,11 @@ ingress-nginx:
controller:
service:
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
service.beta.kubernetes.io/azure-load-balancer-internal: "false"
externalTrafficPolicy: Local
useComponentLabel: true
fullnameOverride: ingress-nginx
`
/*
"\ningress-nginx:\n controller:\n service:\n annotations:\n custom-annotation: \"value\"\n service.beta.kubernetes.io/azure-load-balancer-internal: \"true\"\n externalTrafficPolicy: Local\n useComponentLabel: true\n fullnameOverride: ingress-nginx\n"
"\ningress-nginx:\n controller:\n service:\n annotations:\n custom-annotation: value\n service.beta.kubernetes.io/azure-load-balancer-internal: \"true\"\n enabled: true\n externalTrafficPolicy: Local\n"
*/
assert.Contains(t, expectedYamlNginxIngress, fileWriterService.FileContentWritten)
})
}
Expand Down

0 comments on commit f0bce9a

Please sign in to comment.