mirror of
https://github.com/kubernetes-sigs/external-dns.git
synced 2025-08-06 01:26:59 +02:00
fix: do not expose vars
This commit is contained in:
parent
fdb2475892
commit
4fcc726863
@ -44,10 +44,10 @@ import (
|
|||||||
const (
|
const (
|
||||||
gatewayGroup = "gateway.networking.k8s.io"
|
gatewayGroup = "gateway.networking.k8s.io"
|
||||||
gatewayKind = "Gateway"
|
gatewayKind = "Gateway"
|
||||||
// GatewayAPIDualstackAnnotationKey is the annotation used for determining if a Gateway Route is dualstack
|
// gatewayAPIDualstackAnnotationKey is the annotation used for determining if a Gateway Route is dualstack
|
||||||
GatewayAPIDualstackAnnotationKey = "external-dns.alpha.kubernetes.io/dualstack"
|
gatewayAPIDualstackAnnotationKey = "external-dns.alpha.kubernetes.io/dualstack"
|
||||||
// GatewayAPIDualstackAnnotationValue is the value of the Gateway Route dualstack annotation that indicates it is dualstack
|
// gatewayAPIDualstackAnnotationValue is the value of the Gateway Route dualstack annotation that indicates it is dualstack
|
||||||
GatewayAPIDualstackAnnotationValue = "true"
|
gatewayAPIDualstackAnnotationValue = "true"
|
||||||
)
|
)
|
||||||
|
|
||||||
type gatewayRoute interface {
|
type gatewayRoute interface {
|
||||||
@ -616,8 +616,8 @@ func selectorsEqual(a, b labels.Selector) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setDualstackLabel(rt gatewayRoute, endpoints []*endpoint.Endpoint) {
|
func setDualstackLabel(rt gatewayRoute, endpoints []*endpoint.Endpoint) {
|
||||||
val, ok := rt.Metadata().Annotations[GatewayAPIDualstackAnnotationKey]
|
val, ok := rt.Metadata().Annotations[gatewayAPIDualstackAnnotationKey]
|
||||||
if ok && val == GatewayAPIDualstackAnnotationValue {
|
if ok && val == gatewayAPIDualstackAnnotationValue {
|
||||||
log.Debugf("Adding dualstack label to GatewayRoute %s/%s.", rt.Metadata().Namespace, rt.Metadata().Name)
|
log.Debugf("Adding dualstack label to GatewayRoute %s/%s.", rt.Metadata().Namespace, rt.Metadata().Name)
|
||||||
for _, ep := range endpoints {
|
for _, ep := range endpoints {
|
||||||
ep.Labels[endpoint.DualstackLabelKey] = "true"
|
ep.Labels[endpoint.DualstackLabelKey] = "true"
|
||||||
|
@ -259,17 +259,17 @@ func TestDualStackLabel(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "correct-annotation-key-and-value",
|
desc: "correct-annotation-key-and-value",
|
||||||
in: map[string]string{GatewayAPIDualstackAnnotationKey: GatewayAPIDualstackAnnotationValue},
|
in: map[string]string{gatewayAPIDualstackAnnotationKey: gatewayAPIDualstackAnnotationValue},
|
||||||
setsLabel: true,
|
setsLabel: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "correct-annotation-key-incorrect-value",
|
desc: "correct-annotation-key-incorrect-value",
|
||||||
in: map[string]string{GatewayAPIDualstackAnnotationKey: "foo"},
|
in: map[string]string{gatewayAPIDualstackAnnotationKey: "foo"},
|
||||||
setsLabel: false,
|
setsLabel: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "incorrect-annotation-key-correct-value",
|
desc: "incorrect-annotation-key-correct-value",
|
||||||
in: map[string]string{"FOO": GatewayAPIDualstackAnnotationValue},
|
in: map[string]string{"FOO": gatewayAPIDualstackAnnotationValue},
|
||||||
setsLabel: false,
|
setsLabel: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user