diff --git a/library/common-test/tests/service/load_balancer_test.yaml b/library/common-test/tests/service/load_balancer_test.yaml index 6db7ae23..6e79ab7b 100644 --- a/library/common-test/tests/service/load_balancer_test.yaml +++ b/library/common-test/tests/service/load_balancer_test.yaml @@ -142,3 +142,8 @@ tests: app.kubernetes.io/instance: test-release-name app.kubernetes.io/name: common-test pod.name: my-workload + - documentIndex: *serviceDoc + isSubset: + path: metadata.annotations + content: + metallb.universe.tf/loadBalancerIPs: "10.100.200.45" diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index e3288146..46cb4669 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 16.2.14 +version: 16.2.15 diff --git a/library/common/templates/lib/service/_additionalAnnotations.tpl b/library/common/templates/lib/service/_additionalAnnotations.tpl index e314083c..8144e0fd 100644 --- a/library/common/templates/lib/service/_additionalAnnotations.tpl +++ b/library/common/templates/lib/service/_additionalAnnotations.tpl @@ -21,6 +21,9 @@ 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 $objectData.loadBalancerIP -}} + {{- $_ := set $annotations "metallb.universe.tf/loadBalancerIPs" (tpl $objectData.loadBalancerIP $rootCtx) -}} + {{- end -}} {{- end -}} {{- end -}} {{- end -}}