Skip to content

Commit 13faa64

Browse files
authored
cmd/k8s-operator: always set stateful filtering to false (tailscale#14216)
Updates tailscale#12108 Signed-off-by: Irbe Krumina <[email protected]>
1 parent 44c8892 commit 13faa64

File tree

3 files changed

+11
-22
lines changed

3 files changed

+11
-22
lines changed

cmd/k8s-operator/operator_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ func TestTailscaledConfigfileHash(t *testing.T) {
13881388
parentType: "svc",
13891389
hostname: "default-test",
13901390
clusterTargetIP: "10.20.30.40",
1391-
confFileHash: "a67b5ad3ff605531c822327e8f1a23dd0846e1075b722c13402f7d5d0ba32ba2",
1391+
confFileHash: "acf3467364b0a3ba9b8ee0dd772cb7c2f0bf585e288fa99b7fe4566009ed6041",
13921392
app: kubetypes.AppIngressProxy,
13931393
}
13941394
expectEqual(t, fc, expectedSTS(t, fc, o), nil)
@@ -1399,7 +1399,7 @@ func TestTailscaledConfigfileHash(t *testing.T) {
13991399
mak.Set(&svc.Annotations, AnnotationHostname, "another-test")
14001400
})
14011401
o.hostname = "another-test"
1402-
o.confFileHash = "888a993ebee20ad6be99623b45015339de117946850cf1252bede0b570e04293"
1402+
o.confFileHash = "d4cc13f09f55f4f6775689004f9a466723325b84d2b590692796bfe22aeaa389"
14031403
expectReconciled(t, sr, "default", "test")
14041404
expectEqual(t, fc, expectedSTS(t, fc, o), nil)
14051405
}

cmd/k8s-operator/sts.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -854,17 +854,10 @@ func tailscaledConfig(stsC *tailscaleSTSConfig, newAuthkey string, oldSecret *co
854854
AcceptRoutes: "false", // AcceptRoutes defaults to true
855855
Locked: "false",
856856
Hostname: &stsC.Hostname,
857-
NoStatefulFiltering: "false",
857+
NoStatefulFiltering: "true", // Explicitly enforce default value, see #14216
858858
AppConnector: &ipn.AppConnectorPrefs{Advertise: false},
859859
}
860860

861-
// For egress proxies only, we need to ensure that stateful filtering is
862-
// not in place so that traffic from cluster can be forwarded via
863-
// Tailscale IPs.
864-
// TODO (irbekrm): set it to true always as this is now the default in core.
865-
if stsC.TailnetTargetFQDN != "" || stsC.TailnetTargetIP != "" {
866-
conf.NoStatefulFiltering = "true"
867-
}
868861
if stsC.Connector != nil {
869862
routes, err := netutil.CalcAdvertiseRoutes(stsC.Connector.routes, stsC.Connector.isExitNode)
870863
if err != nil {

cmd/k8s-operator/testutils_test.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,14 @@ func expectedSecret(t *testing.T, cl client.Client, opts configOpts) *corev1.Sec
353353
mak.Set(&s.StringData, "serve-config", string(serveConfigBs))
354354
}
355355
conf := &ipn.ConfigVAlpha{
356-
Version: "alpha0",
357-
AcceptDNS: "false",
358-
Hostname: &opts.hostname,
359-
Locked: "false",
360-
AuthKey: ptr.To("secret-authkey"),
361-
AcceptRoutes: "false",
362-
AppConnector: &ipn.AppConnectorPrefs{Advertise: false},
356+
Version: "alpha0",
357+
AcceptDNS: "false",
358+
Hostname: &opts.hostname,
359+
Locked: "false",
360+
AuthKey: ptr.To("secret-authkey"),
361+
AcceptRoutes: "false",
362+
AppConnector: &ipn.AppConnectorPrefs{Advertise: false},
363+
NoStatefulFiltering: "true",
363364
}
364365
if opts.proxyClass != "" {
365366
t.Logf("applying configuration from ProxyClass %s", opts.proxyClass)
@@ -391,11 +392,6 @@ func expectedSecret(t *testing.T, cl client.Client, opts configOpts) *corev1.Sec
391392
routes = append(routes, prefix)
392393
}
393394
}
394-
if opts.tailnetTargetFQDN != "" || opts.tailnetTargetIP != "" {
395-
conf.NoStatefulFiltering = "true"
396-
} else {
397-
conf.NoStatefulFiltering = "false"
398-
}
399395
conf.AdvertiseRoutes = routes
400396
bnn, err := json.Marshal(conf)
401397
if err != nil {

0 commit comments

Comments
 (0)