mirror of
https://github.com/tailscale/tailscale.git
synced 2025-06-12 18:58:36 +00:00
cmd/k8s-operator: explicitly set tcp on VIPService port configuration for Ingress with ProxyGroup (#16199)
Updates tailscale/corp#24795 Signed-off-by: chaosinthecrd <tom@tmlabs.co.uk>
This commit is contained in:
parent
5716d0977d
commit
4456f77af7
@ -318,9 +318,9 @@ func (r *HAIngressReconciler) maybeProvision(ctx context.Context, hostname strin
|
|||||||
tags = strings.Split(tstr, ",")
|
tags = strings.Split(tstr, ",")
|
||||||
}
|
}
|
||||||
|
|
||||||
tsSvcPorts := []string{"443"} // always 443 for Ingress
|
tsSvcPorts := []string{"tcp:443"} // always 443 for Ingress
|
||||||
if isHTTPEndpointEnabled(ing) {
|
if isHTTPEndpointEnabled(ing) {
|
||||||
tsSvcPorts = append(tsSvcPorts, "80")
|
tsSvcPorts = append(tsSvcPorts, "tcp:80")
|
||||||
}
|
}
|
||||||
|
|
||||||
tsSvc := &tailscale.VIPService{
|
tsSvc := &tailscale.VIPService{
|
||||||
|
@ -68,7 +68,7 @@ func TestIngressPGReconciler(t *testing.T) {
|
|||||||
populateTLSSecret(context.Background(), fc, "test-pg", "my-svc.ts.net")
|
populateTLSSecret(context.Background(), fc, "test-pg", "my-svc.ts.net")
|
||||||
expectReconciled(t, ingPGR, "default", "test-ingress")
|
expectReconciled(t, ingPGR, "default", "test-ingress")
|
||||||
verifyServeConfig(t, fc, "svc:my-svc", false)
|
verifyServeConfig(t, fc, "svc:my-svc", false)
|
||||||
verifyTailscaleService(t, ft, "svc:my-svc", []string{"443"})
|
verifyTailscaleService(t, ft, "svc:my-svc", []string{"tcp:443"})
|
||||||
verifyTailscaledConfig(t, fc, []string{"svc:my-svc"})
|
verifyTailscaledConfig(t, fc, []string{"svc:my-svc"})
|
||||||
|
|
||||||
// Verify that Role and RoleBinding have been created for the first Ingress.
|
// Verify that Role and RoleBinding have been created for the first Ingress.
|
||||||
@ -130,7 +130,7 @@ func TestIngressPGReconciler(t *testing.T) {
|
|||||||
populateTLSSecret(context.Background(), fc, "test-pg", "my-other-svc.ts.net")
|
populateTLSSecret(context.Background(), fc, "test-pg", "my-other-svc.ts.net")
|
||||||
expectReconciled(t, ingPGR, "default", "my-other-ingress")
|
expectReconciled(t, ingPGR, "default", "my-other-ingress")
|
||||||
verifyServeConfig(t, fc, "svc:my-other-svc", false)
|
verifyServeConfig(t, fc, "svc:my-other-svc", false)
|
||||||
verifyTailscaleService(t, ft, "svc:my-other-svc", []string{"443"})
|
verifyTailscaleService(t, ft, "svc:my-other-svc", []string{"tcp:443"})
|
||||||
|
|
||||||
// Verify that Role and RoleBinding have been created for the first Ingress.
|
// Verify that Role and RoleBinding have been created for the first Ingress.
|
||||||
// Do not verify the cert Secret as that was already verified implicitly above.
|
// Do not verify the cert Secret as that was already verified implicitly above.
|
||||||
@ -139,7 +139,7 @@ func TestIngressPGReconciler(t *testing.T) {
|
|||||||
|
|
||||||
// Verify first Ingress is still working
|
// Verify first Ingress is still working
|
||||||
verifyServeConfig(t, fc, "svc:my-svc", false)
|
verifyServeConfig(t, fc, "svc:my-svc", false)
|
||||||
verifyTailscaleService(t, ft, "svc:my-svc", []string{"443"})
|
verifyTailscaleService(t, ft, "svc:my-svc", []string{"tcp:443"})
|
||||||
|
|
||||||
verifyTailscaledConfig(t, fc, []string{"svc:my-svc", "svc:my-other-svc"})
|
verifyTailscaledConfig(t, fc, []string{"svc:my-svc", "svc:my-other-svc"})
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ func TestIngressPGReconciler_UpdateIngressHostname(t *testing.T) {
|
|||||||
populateTLSSecret(context.Background(), fc, "test-pg", "my-svc.ts.net")
|
populateTLSSecret(context.Background(), fc, "test-pg", "my-svc.ts.net")
|
||||||
expectReconciled(t, ingPGR, "default", "test-ingress")
|
expectReconciled(t, ingPGR, "default", "test-ingress")
|
||||||
verifyServeConfig(t, fc, "svc:my-svc", false)
|
verifyServeConfig(t, fc, "svc:my-svc", false)
|
||||||
verifyTailscaleService(t, ft, "svc:my-svc", []string{"443"})
|
verifyTailscaleService(t, ft, "svc:my-svc", []string{"tcp:443"})
|
||||||
verifyTailscaledConfig(t, fc, []string{"svc:my-svc"})
|
verifyTailscaledConfig(t, fc, []string{"svc:my-svc"})
|
||||||
|
|
||||||
// Update the Ingress hostname and make sure the original Tailscale Service is deleted.
|
// Update the Ingress hostname and make sure the original Tailscale Service is deleted.
|
||||||
@ -255,7 +255,7 @@ func TestIngressPGReconciler_UpdateIngressHostname(t *testing.T) {
|
|||||||
populateTLSSecret(context.Background(), fc, "test-pg", "updated-svc.ts.net")
|
populateTLSSecret(context.Background(), fc, "test-pg", "updated-svc.ts.net")
|
||||||
expectReconciled(t, ingPGR, "default", "test-ingress")
|
expectReconciled(t, ingPGR, "default", "test-ingress")
|
||||||
verifyServeConfig(t, fc, "svc:updated-svc", false)
|
verifyServeConfig(t, fc, "svc:updated-svc", false)
|
||||||
verifyTailscaleService(t, ft, "svc:updated-svc", []string{"443"})
|
verifyTailscaleService(t, ft, "svc:updated-svc", []string{"tcp:443"})
|
||||||
verifyTailscaledConfig(t, fc, []string{"svc:updated-svc"})
|
verifyTailscaledConfig(t, fc, []string{"svc:updated-svc"})
|
||||||
|
|
||||||
_, err := ft.GetVIPService(context.Background(), tailcfg.ServiceName("svc:my-svc"))
|
_, err := ft.GetVIPService(context.Background(), tailcfg.ServiceName("svc:my-svc"))
|
||||||
@ -476,7 +476,7 @@ func TestIngressPGReconciler_HTTPEndpoint(t *testing.T) {
|
|||||||
expectReconciled(t, ingPGR, "default", "test-ingress")
|
expectReconciled(t, ingPGR, "default", "test-ingress")
|
||||||
populateTLSSecret(context.Background(), fc, "test-pg", "my-svc.ts.net")
|
populateTLSSecret(context.Background(), fc, "test-pg", "my-svc.ts.net")
|
||||||
expectReconciled(t, ingPGR, "default", "test-ingress")
|
expectReconciled(t, ingPGR, "default", "test-ingress")
|
||||||
verifyTailscaleService(t, ft, "svc:my-svc", []string{"80", "443"})
|
verifyTailscaleService(t, ft, "svc:my-svc", []string{"tcp:80", "tcp:443"})
|
||||||
verifyServeConfig(t, fc, "svc:my-svc", true)
|
verifyServeConfig(t, fc, "svc:my-svc", true)
|
||||||
|
|
||||||
// Verify Ingress status
|
// Verify Ingress status
|
||||||
@ -529,7 +529,7 @@ func TestIngressPGReconciler_HTTPEndpoint(t *testing.T) {
|
|||||||
|
|
||||||
// Verify reconciliation after removing HTTP
|
// Verify reconciliation after removing HTTP
|
||||||
expectReconciled(t, ingPGR, "default", "test-ingress")
|
expectReconciled(t, ingPGR, "default", "test-ingress")
|
||||||
verifyTailscaleService(t, ft, "svc:my-svc", []string{"443"})
|
verifyTailscaleService(t, ft, "svc:my-svc", []string{"tcp:443"})
|
||||||
verifyServeConfig(t, fc, "svc:my-svc", false)
|
verifyServeConfig(t, fc, "svc:my-svc", false)
|
||||||
|
|
||||||
// Verify Ingress status
|
// Verify Ingress status
|
||||||
|
Loading…
x
Reference in New Issue
Block a user