mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 13:05:46 +00:00
cmd/k8s-operator: fix egress service name (#9494)
Updates https://github.com/tailscale/tailscale/issues/502 Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
parent
5f4d76c18c
commit
c5b2a365de
@ -218,7 +218,7 @@ func TestTailnetTargetIPAnnotation(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
Spec: corev1.ServiceSpec{
|
Spec: corev1.ServiceSpec{
|
||||||
ExternalName: fmt.Sprintf("%s.operator-ns.svc", shortName),
|
ExternalName: fmt.Sprintf("%s.operator-ns.svc.cluster.local", shortName),
|
||||||
Type: corev1.ServiceTypeExternalName,
|
Type: corev1.ServiceTypeExternalName,
|
||||||
Selector: nil,
|
Selector: nil,
|
||||||
},
|
},
|
||||||
|
@ -184,7 +184,10 @@ func (a *ServiceReconciler) maybeProvision(ctx context.Context, logger *zap.Suga
|
|||||||
}
|
}
|
||||||
|
|
||||||
if sts.TailnetTargetIP != "" {
|
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 {
|
if svc.Spec.ExternalName != headlessSvcName || svc.Spec.Type != corev1.ServiceTypeExternalName {
|
||||||
svc.Spec.ExternalName = headlessSvcName
|
svc.Spec.ExternalName = headlessSvcName
|
||||||
svc.Spec.Selector = nil
|
svc.Spec.Selector = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user