@ -106,7 +106,7 @@ func TestLoadBalancerClass(t *testing.T) {
} } ,
} } ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
// Delete the misconfiguration so the proxy starts getting created on the
// Delete the misconfiguration so the proxy starts getting created on the
// next reconcile.
// next reconcile.
@ -128,9 +128,9 @@ func TestLoadBalancerClass(t *testing.T) {
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation , removeResourceReqs )
want . Annotations = nil
want . Annotations = nil
want . ObjectMeta . Finalizers = [ ] string { "tailscale.com/finalizer" }
want . ObjectMeta . Finalizers = [ ] string { "tailscale.com/finalizer" }
@ -143,7 +143,7 @@ func TestLoadBalancerClass(t *testing.T) {
Message : "no Tailscale hostname known yet, waiting for proxy pod to finish auth" ,
Message : "no Tailscale hostname known yet, waiting for proxy pod to finish auth" ,
} } ,
} } ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
// Normally the Tailscale proxy pod would come up here and write its info
// Normally the Tailscale proxy pod would come up here and write its info
// into the secret. Simulate that, then verify reconcile again and verify
// into the secret. Simulate that, then verify reconcile again and verify
@ -169,7 +169,7 @@ func TestLoadBalancerClass(t *testing.T) {
} ,
} ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
// Turn the service back into a ClusterIP service, which should make the
// Turn the service back into a ClusterIP service, which should make the
// operator clean up.
// operator clean up.
@ -206,7 +206,7 @@ func TestLoadBalancerClass(t *testing.T) {
Type : corev1 . ServiceTypeClusterIP ,
Type : corev1 . ServiceTypeClusterIP ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
}
}
func TestTailnetTargetFQDNAnnotation ( t * testing . T ) {
func TestTailnetTargetFQDNAnnotation ( t * testing . T ) {
@ -266,9 +266,9 @@ func TestTailnetTargetFQDNAnnotation(t *testing.T) {
app : kubetypes . AppEgressProxy ,
app : kubetypes . AppEgressProxy ,
}
}
expectEqual ( t , fc , expectedSecret ( t , fc , o ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , o ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
want := & corev1 . Service {
want := & corev1 . Service {
ObjectMeta : metav1 . ObjectMeta {
ObjectMeta : metav1 . ObjectMeta {
Name : "test" ,
Name : "test" ,
@ -288,10 +288,10 @@ func TestTailnetTargetFQDNAnnotation(t *testing.T) {
Conditions : proxyCreatedCondition ( clock ) ,
Conditions : proxyCreatedCondition ( clock ) ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
expectEqual ( t , fc , expectedSecret ( t , fc , o ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , o ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
// Change the tailscale-target-fqdn annotation which should update the
// Change the tailscale-target-fqdn annotation which should update the
// StatefulSet
// StatefulSet
@ -378,9 +378,9 @@ func TestTailnetTargetIPAnnotation(t *testing.T) {
app : kubetypes . AppEgressProxy ,
app : kubetypes . AppEgressProxy ,
}
}
expectEqual ( t , fc , expectedSecret ( t , fc , o ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , o ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
want := & corev1 . Service {
want := & corev1 . Service {
ObjectMeta : metav1 . ObjectMeta {
ObjectMeta : metav1 . ObjectMeta {
Name : "test" ,
Name : "test" ,
@ -400,10 +400,10 @@ func TestTailnetTargetIPAnnotation(t *testing.T) {
Conditions : proxyCreatedCondition ( clock ) ,
Conditions : proxyCreatedCondition ( clock ) ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
expectEqual ( t , fc , expectedSecret ( t , fc , o ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , o ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
// Change the tailscale-target-ip annotation which should update the
// Change the tailscale-target-ip annotation which should update the
// StatefulSet
// StatefulSet
@ -501,7 +501,7 @@ func TestTailnetTargetIPAnnotation_IPCouldNotBeParsed(t *testing.T) {
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
}
}
func TestTailnetTargetIPAnnotation_InvalidIP ( t * testing . T ) {
func TestTailnetTargetIPAnnotation_InvalidIP ( t * testing . T ) {
@ -572,7 +572,7 @@ func TestTailnetTargetIPAnnotation_InvalidIP(t *testing.T) {
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
}
}
func TestAnnotations ( t * testing . T ) {
func TestAnnotations ( t * testing . T ) {
@ -629,9 +629,9 @@ func TestAnnotations(t *testing.T) {
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSecret ( t , fc , o ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , o ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
want := & corev1 . Service {
want := & corev1 . Service {
ObjectMeta : metav1 . ObjectMeta {
ObjectMeta : metav1 . ObjectMeta {
Name : "test" ,
Name : "test" ,
@ -650,7 +650,7 @@ func TestAnnotations(t *testing.T) {
Conditions : proxyCreatedCondition ( clock ) ,
Conditions : proxyCreatedCondition ( clock ) ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
// Turn the service back into a ClusterIP service, which should make the
// Turn the service back into a ClusterIP service, which should make the
// operator clean up.
// operator clean up.
@ -678,7 +678,7 @@ func TestAnnotations(t *testing.T) {
Type : corev1 . ServiceTypeClusterIP ,
Type : corev1 . ServiceTypeClusterIP ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
}
}
func TestAnnotationIntoLB ( t * testing . T ) {
func TestAnnotationIntoLB ( t * testing . T ) {
@ -735,9 +735,9 @@ func TestAnnotationIntoLB(t *testing.T) {
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSecret ( t , fc , o ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , o ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
// Normally the Tailscale proxy pod would come up here and write its info
// Normally the Tailscale proxy pod would come up here and write its info
// into the secret. Simulate that, since it would have normally happened at
// into the secret. Simulate that, since it would have normally happened at
@ -769,7 +769,7 @@ func TestAnnotationIntoLB(t *testing.T) {
Conditions : proxyCreatedCondition ( clock ) ,
Conditions : proxyCreatedCondition ( clock ) ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
// Remove Tailscale's annotation, and at the same time convert the service
// Remove Tailscale's annotation, and at the same time convert the service
// into a tailscale LoadBalancer.
// into a tailscale LoadBalancer.
@ -780,8 +780,8 @@ func TestAnnotationIntoLB(t *testing.T) {
} )
} )
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
// None of the proxy machinery should have changed...
// None of the proxy machinery should have changed...
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
// ... but the service should have a LoadBalancer status.
// ... but the service should have a LoadBalancer status.
want = & corev1 . Service {
want = & corev1 . Service {
@ -810,7 +810,7 @@ func TestAnnotationIntoLB(t *testing.T) {
Conditions : proxyCreatedCondition ( clock ) ,
Conditions : proxyCreatedCondition ( clock ) ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
}
}
func TestLBIntoAnnotation ( t * testing . T ) {
func TestLBIntoAnnotation ( t * testing . T ) {
@ -865,9 +865,9 @@ func TestLBIntoAnnotation(t *testing.T) {
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSecret ( t , fc , o ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , o ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
// Normally the Tailscale proxy pod would come up here and write its info
// Normally the Tailscale proxy pod would come up here and write its info
// into the secret. Simulate that, then verify reconcile again and verify
// into the secret. Simulate that, then verify reconcile again and verify
@ -907,7 +907,7 @@ func TestLBIntoAnnotation(t *testing.T) {
Conditions : proxyCreatedCondition ( clock ) ,
Conditions : proxyCreatedCondition ( clock ) ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
// Turn the service back into a ClusterIP service, but also add the
// Turn the service back into a ClusterIP service, but also add the
// tailscale annotation.
// tailscale annotation.
@ -926,8 +926,8 @@ func TestLBIntoAnnotation(t *testing.T) {
} )
} )
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
want = & corev1 . Service {
want = & corev1 . Service {
ObjectMeta : metav1 . ObjectMeta {
ObjectMeta : metav1 . ObjectMeta {
@ -947,7 +947,7 @@ func TestLBIntoAnnotation(t *testing.T) {
Conditions : proxyCreatedCondition ( clock ) ,
Conditions : proxyCreatedCondition ( clock ) ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
}
}
func TestCustomHostname ( t * testing . T ) {
func TestCustomHostname ( t * testing . T ) {
@ -1005,9 +1005,9 @@ func TestCustomHostname(t *testing.T) {
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSecret ( t , fc , o ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , o ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
want := & corev1 . Service {
want := & corev1 . Service {
ObjectMeta : metav1 . ObjectMeta {
ObjectMeta : metav1 . ObjectMeta {
Name : "test" ,
Name : "test" ,
@ -1027,7 +1027,7 @@ func TestCustomHostname(t *testing.T) {
Conditions : proxyCreatedCondition ( clock ) ,
Conditions : proxyCreatedCondition ( clock ) ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
// Turn the service back into a ClusterIP service, which should make the
// Turn the service back into a ClusterIP service, which should make the
// operator clean up.
// operator clean up.
@ -1058,7 +1058,7 @@ func TestCustomHostname(t *testing.T) {
Type : corev1 . ServiceTypeClusterIP ,
Type : corev1 . ServiceTypeClusterIP ,
} ,
} ,
}
}
expectEqual ( t , fc , want , nil )
expectEqual ( t , fc , want )
}
}
func TestCustomPriorityClassName ( t * testing . T ) {
func TestCustomPriorityClassName ( t * testing . T ) {
@ -1118,7 +1118,7 @@ func TestCustomPriorityClassName(t *testing.T) {
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
}
}
func TestProxyClassForService ( t * testing . T ) {
func TestProxyClassForService ( t * testing . T ) {
@ -1186,9 +1186,9 @@ func TestProxyClassForService(t *testing.T) {
clusterTargetIP : "10.20.30.40" ,
clusterTargetIP : "10.20.30.40" ,
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation , removeResourceReqs )
// 2. The Service gets updated with tailscale.com/proxy-class label
// 2. The Service gets updated with tailscale.com/proxy-class label
// pointing at the 'custom-metadata' ProxyClass. The ProxyClass is not
// pointing at the 'custom-metadata' ProxyClass. The ProxyClass is not
@ -1197,8 +1197,8 @@ func TestProxyClassForService(t *testing.T) {
mak . Set ( & svc . Labels , LabelProxyClass , "custom-metadata" )
mak . Set ( & svc . Labels , LabelProxyClass , "custom-metadata" )
} )
} )
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation , removeResourceReqs )
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) )
// 3. ProxyClass is set to Ready, the Service gets reconciled by the
// 3. ProxyClass is set to Ready, the Service gets reconciled by the
// services-reconciler and the customization from the ProxyClass is
// services-reconciler and the customization from the ProxyClass is
@ -1213,7 +1213,7 @@ func TestProxyClassForService(t *testing.T) {
} )
} )
opts . proxyClass = pc . Name
opts . proxyClass = pc . Name
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation , removeResourceReqs )
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) , removeAuthKeyIfExistsModifier ( t ) )
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) , removeAuthKeyIfExistsModifier ( t ) )
// 4. tailscale.com/proxy-class label is removed from the Service, the
// 4. tailscale.com/proxy-class label is removed from the Service, the
@ -1224,7 +1224,7 @@ func TestProxyClassForService(t *testing.T) {
} )
} )
opts . proxyClass = ""
opts . proxyClass = ""
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation , removeResourceReqs )
}
}
func TestDefaultLoadBalancer ( t * testing . T ) {
func TestDefaultLoadBalancer ( t * testing . T ) {
@ -1270,7 +1270,7 @@ func TestDefaultLoadBalancer(t *testing.T) {
fullName , shortName := findGenName ( t , fc , "default" , "test" , "svc" )
fullName , shortName := findGenName ( t , fc , "default" , "test" , "svc" )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
o := configOpts {
o := configOpts {
stsName : shortName ,
stsName : shortName ,
secretName : fullName ,
secretName : fullName ,
@ -1280,8 +1280,7 @@ func TestDefaultLoadBalancer(t *testing.T) {
clusterTargetIP : "10.20.30.40" ,
clusterTargetIP : "10.20.30.40" ,
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
}
}
func TestProxyFirewallMode ( t * testing . T ) {
func TestProxyFirewallMode ( t * testing . T ) {
@ -1337,7 +1336,7 @@ func TestProxyFirewallMode(t *testing.T) {
clusterTargetIP : "10.20.30.40" ,
clusterTargetIP : "10.20.30.40" ,
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
}
}
func TestTailscaledConfigfileHash ( t * testing . T ) {
func TestTailscaledConfigfileHash ( t * testing . T ) {
@ -1393,7 +1392,7 @@ func TestTailscaledConfigfileHash(t *testing.T) {
confFileHash : "848bff4b5ba83ac999e6984c8464e597156daba961ae045e7dbaef606d54ab5e" ,
confFileHash : "848bff4b5ba83ac999e6984c8464e597156daba961ae045e7dbaef606d54ab5e" ,
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , nil )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeResourceReqs )
// 2. Hostname gets changed, configfile is updated and a new hash value
// 2. Hostname gets changed, configfile is updated and a new hash value
// is produced.
// is produced.
@ -1403,7 +1402,7 @@ func TestTailscaledConfigfileHash(t *testing.T) {
o . hostname = "another-test"
o . hostname = "another-test"
o . confFileHash = "d4cc13f09f55f4f6775689004f9a466723325b84d2b590692796bfe22aeaa389"
o . confFileHash = "d4cc13f09f55f4f6775689004f9a466723325b84d2b590692796bfe22aeaa389"
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , nil )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeResourceReqs )
}
}
func Test_isMagicDNSName ( t * testing . T ) {
func Test_isMagicDNSName ( t * testing . T ) {
tests := [ ] struct {
tests := [ ] struct {
@ -1681,9 +1680,9 @@ func Test_authKeyRemoval(t *testing.T) {
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation , removeResourceReqs )
// 2. Apply update to the Secret that imitates the proxy setting device_id.
// 2. Apply update to the Secret that imitates the proxy setting device_id.
s := expectedSecret ( t , fc , opts )
s := expectedSecret ( t , fc , opts )
@ -1695,7 +1694,7 @@ func Test_authKeyRemoval(t *testing.T) {
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
opts . shouldRemoveAuthKey = true
opts . shouldRemoveAuthKey = true
opts . secretExtraData = map [ string ] [ ] byte { "device_id" : [ ] byte ( "dkkdi4CNTRL" ) }
opts . secretExtraData = map [ string ] [ ] byte { "device_id" : [ ] byte ( "dkkdi4CNTRL" ) }
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) )
}
}
func Test_externalNameService ( t * testing . T ) {
func Test_externalNameService ( t * testing . T ) {
@ -1755,9 +1754,9 @@ func Test_externalNameService(t *testing.T) {
app : kubetypes . AppIngressProxy ,
app : kubetypes . AppIngressProxy ,
}
}
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) , nil )
expectEqual ( t , fc , expectedSecret ( t , fc , opts ) )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) , nil )
expectEqual ( t , fc , expectedHeadlessService ( shortName , "svc" ) )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation , removeResourceReqs )
// 2. Change the ExternalName and verify that changes get propagated.
// 2. Change the ExternalName and verify that changes get propagated.
mustUpdate ( t , sr , "default" , "test" , func ( s * corev1 . Service ) {
mustUpdate ( t , sr , "default" , "test" , func ( s * corev1 . Service ) {
@ -1765,7 +1764,7 @@ func Test_externalNameService(t *testing.T) {
} )
} )
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
opts . clusterTargetDNS = "bar.com"
opts . clusterTargetDNS = "bar.com"
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation )
expectEqual ( t , fc , expectedSTS ( t , fc , opts ) , removeHashAnnotation , removeResourceReqs )
}
}
func Test_metricsResourceCreation ( t * testing . T ) {
func Test_metricsResourceCreation ( t * testing . T ) {
@ -1835,7 +1834,7 @@ func Test_metricsResourceCreation(t *testing.T) {
} )
} )
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
opts . enableMetrics = true
opts . enableMetrics = true
expectEqual ( t , fc , expectedMetricsService ( opts ) , nil )
expectEqual ( t , fc , expectedMetricsService ( opts ) )
// 2. Enable ServiceMonitor - should not error when there is no ServiceMonitor CRD in cluster
// 2. Enable ServiceMonitor - should not error when there is no ServiceMonitor CRD in cluster
mustUpdate ( t , fc , "" , "metrics" , func ( pc * tsapi . ProxyClass ) {
mustUpdate ( t , fc , "" , "metrics" , func ( pc * tsapi . ProxyClass ) {
@ -1855,7 +1854,7 @@ func Test_metricsResourceCreation(t *testing.T) {
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
opts . serviceMonitorLabels = tsapi . Labels { "foo" : "bar" }
opts . serviceMonitorLabels = tsapi . Labels { "foo" : "bar" }
opts . resourceVersion = "2"
opts . resourceVersion = "2"
expectEqual ( t , fc , expectedMetricsService ( opts ) , nil )
expectEqual ( t , fc , expectedMetricsService ( opts ) )
expectEqualUnstructured ( t , fc , expectedServiceMonitor ( t , opts ) )
expectEqualUnstructured ( t , fc , expectedServiceMonitor ( t , opts ) )
// 5. Disable metrics- expect metrics Service to be deleted
// 5. Disable metrics- expect metrics Service to be deleted