cmd/k8s-operator: fix egress service name (#9494)

Updates https://github.com/tailscale/tailscale/issues/502

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
pull/9487/head
Irbe Krumina 1 year ago committed by GitHub
parent 5f4d76c18c
commit c5b2a365de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -218,7 +218,7 @@ func TestTailnetTargetIPAnnotation(t *testing.T) {
},
},
Spec: corev1.ServiceSpec{
ExternalName: fmt.Sprintf("%s.operator-ns.svc", shortName),
ExternalName: fmt.Sprintf("%s.operator-ns.svc.cluster.local", shortName),
Type: corev1.ServiceTypeExternalName,
Selector: nil,
},

@ -184,7 +184,10 @@ func (a *ServiceReconciler) maybeProvision(ctx context.Context, logger *zap.Suga
}
if sts.TailnetTargetIP != "" {
headlessSvcName := hsvc.Name + "." + hsvc.Namespace + ".svc"
// TODO (irbekrm): cluster.local is the default DNS name, but
// can be changed by users. Make this configurable or figure out
// how to discover the DNS name from within operator
headlessSvcName := hsvc.Name + "." + hsvc.Namespace + ".svc.cluster.local"
if svc.Spec.ExternalName != headlessSvcName || svc.Spec.Type != corev1.ServiceTypeExternalName {
svc.Spec.ExternalName = headlessSvcName
svc.Spec.Selector = nil

Loading…
Cancel
Save