|
|
@ -22,6 +22,7 @@ import (
|
|
|
|
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
|
|
|
"sigs.k8s.io/controller-runtime/pkg/client/fake"
|
|
|
|
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
|
|
|
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
|
|
|
tsapi "tailscale.com/k8s-operator/apis/v1alpha1"
|
|
|
|
tsapi "tailscale.com/k8s-operator/apis/v1alpha1"
|
|
|
|
|
|
|
|
"tailscale.com/kube"
|
|
|
|
"tailscale.com/net/dns/resolvconffile"
|
|
|
|
"tailscale.com/net/dns/resolvconffile"
|
|
|
|
"tailscale.com/tstest"
|
|
|
|
"tailscale.com/tstest"
|
|
|
|
"tailscale.com/tstime"
|
|
|
|
"tailscale.com/tstime"
|
|
|
@ -123,6 +124,7 @@ func TestLoadBalancerClass(t *testing.T) {
|
|
|
|
parentType: "svc",
|
|
|
|
parentType: "svc",
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, opts), nil)
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, opts), nil)
|
|
|
@ -260,6 +262,7 @@ func TestTailnetTargetFQDNAnnotation(t *testing.T) {
|
|
|
|
parentType: "svc",
|
|
|
|
parentType: "svc",
|
|
|
|
tailnetTargetFQDN: tailnetTargetFQDN,
|
|
|
|
tailnetTargetFQDN: tailnetTargetFQDN,
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
|
|
|
|
app: kube.AppEgressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
@ -371,6 +374,7 @@ func TestTailnetTargetIPAnnotation(t *testing.T) {
|
|
|
|
parentType: "svc",
|
|
|
|
parentType: "svc",
|
|
|
|
tailnetTargetIP: tailnetTargetIP,
|
|
|
|
tailnetTargetIP: tailnetTargetIP,
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
|
|
|
|
app: kube.AppEgressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
@ -479,6 +483,7 @@ func TestAnnotations(t *testing.T) {
|
|
|
|
parentType: "svc",
|
|
|
|
parentType: "svc",
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
@ -584,6 +589,7 @@ func TestAnnotationIntoLB(t *testing.T) {
|
|
|
|
parentType: "svc",
|
|
|
|
parentType: "svc",
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
@ -713,6 +719,7 @@ func TestLBIntoAnnotation(t *testing.T) {
|
|
|
|
parentType: "svc",
|
|
|
|
parentType: "svc",
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
@ -852,6 +859,7 @@ func TestCustomHostname(t *testing.T) {
|
|
|
|
parentType: "svc",
|
|
|
|
parentType: "svc",
|
|
|
|
hostname: "reindeer-flotilla",
|
|
|
|
hostname: "reindeer-flotilla",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, o), nil)
|
|
|
@ -964,6 +972,7 @@ func TestCustomPriorityClassName(t *testing.T) {
|
|
|
|
hostname: "tailscale-critical",
|
|
|
|
hostname: "tailscale-critical",
|
|
|
|
priorityClassName: "custom-priority-class-name",
|
|
|
|
priorityClassName: "custom-priority-class-name",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expectEqual(t, fc, expectedSTS(t, fc, o), removeHashAnnotation)
|
|
|
|
expectEqual(t, fc, expectedSTS(t, fc, o), removeHashAnnotation)
|
|
|
@ -1032,6 +1041,7 @@ func TestProxyClassForService(t *testing.T) {
|
|
|
|
parentType: "svc",
|
|
|
|
parentType: "svc",
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, opts), nil)
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, opts), nil)
|
|
|
|
expectEqual(t, fc, expectedHeadlessService(shortName, "svc"), nil)
|
|
|
|
expectEqual(t, fc, expectedHeadlessService(shortName, "svc"), nil)
|
|
|
@ -1125,6 +1135,7 @@ func TestDefaultLoadBalancer(t *testing.T) {
|
|
|
|
parentType: "svc",
|
|
|
|
parentType: "svc",
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expectEqual(t, fc, expectedSTS(t, fc, o), removeHashAnnotation)
|
|
|
|
expectEqual(t, fc, expectedSTS(t, fc, o), removeHashAnnotation)
|
|
|
|
|
|
|
|
|
|
|
@ -1181,6 +1192,7 @@ func TestProxyFirewallMode(t *testing.T) {
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
firewallMode: "nftables",
|
|
|
|
firewallMode: "nftables",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expectEqual(t, fc, expectedSTS(t, fc, o), removeHashAnnotation)
|
|
|
|
expectEqual(t, fc, expectedSTS(t, fc, o), removeHashAnnotation)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1235,6 +1247,7 @@ func TestTailscaledConfigfileHash(t *testing.T) {
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
clusterTargetIP: "10.20.30.40",
|
|
|
|
confFileHash: "e09bededa0379920141cbd0b0dbdf9b8b66545877f9e8397423f5ce3e1ba439e",
|
|
|
|
confFileHash: "e09bededa0379920141cbd0b0dbdf9b8b66545877f9e8397423f5ce3e1ba439e",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
expectEqual(t, fc, expectedSTS(t, fc, o), nil)
|
|
|
|
expectEqual(t, fc, expectedSTS(t, fc, o), nil)
|
|
|
|
|
|
|
|
|
|
|
@ -1529,6 +1542,7 @@ func Test_externalNameService(t *testing.T) {
|
|
|
|
parentType: "svc",
|
|
|
|
parentType: "svc",
|
|
|
|
hostname: "default-test",
|
|
|
|
hostname: "default-test",
|
|
|
|
clusterTargetDNS: "foo.com",
|
|
|
|
clusterTargetDNS: "foo.com",
|
|
|
|
|
|
|
|
app: kube.AppIngressProxy,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, opts), nil)
|
|
|
|
expectEqual(t, fc, expectedSecret(t, fc, opts), nil)
|
|
|
|