From eacd680d6cf214ed7216b09b9e487fbd8a0a39d9 Mon Sep 17 00:00:00 2001 From: Kjeld Schouten Date: Tue, 5 Mar 2024 21:02:33 +0100 Subject: [PATCH] fix(common): only set allow-shared-ips for metallb when externalTrafficPolicy == "Cluster" for now. --- .../common/templates/lib/service/_additionalAnnotations.tpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/common/templates/lib/service/_additionalAnnotations.tpl b/library/common/templates/lib/service/_additionalAnnotations.tpl index 3778e2f7..2c426944 100644 --- a/library/common/templates/lib/service/_additionalAnnotations.tpl +++ b/library/common/templates/lib/service/_additionalAnnotations.tpl @@ -20,7 +20,10 @@ annotations: The annotations variable reference, to append the MetalLB annotatio {{- if (hasKey $rootCtx.Values.global "metallb") -}} {{- if $rootCtx.Values.global.metallb.addServiceAnnotations -}} - {{- $_ := set $annotations "metallb.universe.tf/allow-shared-ip" $sharedKey -}} + + {{- if eq $objectData.externalTrafficPolicy "Cluster" -}} + {{- $_ := set $annotations "metallb.universe.tf/allow-shared-ip" $sharedKey -}} + {{- end -}} {{- if and $objectData.loadBalancerIP $objectData.loadBalancerIPs -}} {{- fail "Service - Expected on of [loadBalancerIP, loadBalancerIPs] to be defined but got both" -}}