From 4fcc7268637e575f850b85329ac17d373efc2a6c Mon Sep 17 00:00:00 2001 From: ThameezBo Date: Wed, 15 May 2024 14:25:03 +0200 Subject: [PATCH] fix: do not expose vars --- source/gateway.go | 12 ++++++------ source/gateway_test.go | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/gateway.go b/source/gateway.go index 26592690c..0b336dc6b 100644 --- a/source/gateway.go +++ b/source/gateway.go @@ -44,10 +44,10 @@ import ( const ( gatewayGroup = "gateway.networking.k8s.io" gatewayKind = "Gateway" - // GatewayAPIDualstackAnnotationKey is the annotation used for determining if a Gateway Route is dualstack - GatewayAPIDualstackAnnotationKey = "external-dns.alpha.kubernetes.io/dualstack" - // GatewayAPIDualstackAnnotationValue is the value of the Gateway Route dualstack annotation that indicates it is dualstack - GatewayAPIDualstackAnnotationValue = "true" + // gatewayAPIDualstackAnnotationKey is the annotation used for determining if a Gateway Route is dualstack + gatewayAPIDualstackAnnotationKey = "external-dns.alpha.kubernetes.io/dualstack" + // gatewayAPIDualstackAnnotationValue is the value of the Gateway Route dualstack annotation that indicates it is dualstack + gatewayAPIDualstackAnnotationValue = "true" ) type gatewayRoute interface { @@ -616,8 +616,8 @@ func selectorsEqual(a, b labels.Selector) bool { } func setDualstackLabel(rt gatewayRoute, endpoints []*endpoint.Endpoint) { - val, ok := rt.Metadata().Annotations[GatewayAPIDualstackAnnotationKey] - if ok && val == GatewayAPIDualstackAnnotationValue { + val, ok := rt.Metadata().Annotations[gatewayAPIDualstackAnnotationKey] + if ok && val == gatewayAPIDualstackAnnotationValue { log.Debugf("Adding dualstack label to GatewayRoute %s/%s.", rt.Metadata().Namespace, rt.Metadata().Name) for _, ep := range endpoints { ep.Labels[endpoint.DualstackLabelKey] = "true" diff --git a/source/gateway_test.go b/source/gateway_test.go index ed6aa228b..19d603a24 100644 --- a/source/gateway_test.go +++ b/source/gateway_test.go @@ -259,17 +259,17 @@ func TestDualStackLabel(t *testing.T) { }, { desc: "correct-annotation-key-and-value", - in: map[string]string{GatewayAPIDualstackAnnotationKey: GatewayAPIDualstackAnnotationValue}, + in: map[string]string{gatewayAPIDualstackAnnotationKey: gatewayAPIDualstackAnnotationValue}, setsLabel: true, }, { desc: "correct-annotation-key-incorrect-value", - in: map[string]string{GatewayAPIDualstackAnnotationKey: "foo"}, + in: map[string]string{gatewayAPIDualstackAnnotationKey: "foo"}, setsLabel: false, }, { desc: "incorrect-annotation-key-correct-value", - in: map[string]string{"FOO": GatewayAPIDualstackAnnotationValue}, + in: map[string]string{"FOO": gatewayAPIDualstackAnnotationValue}, setsLabel: false, }, }