@ -1339,71 +1339,6 @@ func TestProxyFirewallMode(t *testing.T) {
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeHashAnnotation , removeResourceReqs )
}
}
func TestTailscaledConfigfileHash ( t * testing . T ) {
fc := fake . NewFakeClient ( )
ft := & fakeTSClient { }
zl , err := zap . NewDevelopment ( )
if err != nil {
t . Fatal ( err )
}
clock := tstest . NewClock ( tstest . ClockOpts { } )
sr := & ServiceReconciler {
Client : fc ,
ssr : & tailscaleSTSReconciler {
Client : fc ,
tsClient : ft ,
defaultTags : [ ] string { "tag:k8s" } ,
operatorNamespace : "operator-ns" ,
proxyImage : "tailscale/tailscale" ,
} ,
logger : zl . Sugar ( ) ,
clock : clock ,
isDefaultLoadBalancer : true ,
}
// Create a service that we should manage, and check that the initial round
// of objects looks right.
mustCreate ( t , fc , & corev1 . Service {
ObjectMeta : metav1 . ObjectMeta {
Name : "test" ,
Namespace : "default" ,
// The apiserver is supposed to set the UID, but the fake client
// doesn't. So, set it explicitly because other code later depends
// on it being set.
UID : types . UID ( "1234-UID" ) ,
} ,
Spec : corev1 . ServiceSpec {
ClusterIP : "10.20.30.40" ,
Type : corev1 . ServiceTypeLoadBalancer ,
} ,
} )
expectReconciled ( t , sr , "default" , "test" )
expectReconciled ( t , sr , "default" , "test" )
fullName , shortName := findGenName ( t , fc , "default" , "test" , "svc" )
o := configOpts {
stsName : shortName ,
secretName : fullName ,
namespace : "default" ,
parentType : "svc" ,
hostname : "default-test" ,
clusterTargetIP : "10.20.30.40" ,
confFileHash : "848bff4b5ba83ac999e6984c8464e597156daba961ae045e7dbaef606d54ab5e" ,
app : kubetypes . AppIngressProxy ,
}
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeResourceReqs )
// 2. Hostname gets changed, configfile is updated and a new hash value
// is produced.
mustUpdate ( t , fc , "default" , "test" , func ( svc * corev1 . Service ) {
mak . Set ( & svc . Annotations , AnnotationHostname , "another-test" )
} )
o . hostname = "another-test"
o . confFileHash = "d4cc13f09f55f4f6775689004f9a466723325b84d2b590692796bfe22aeaa389"
expectReconciled ( t , sr , "default" , "test" )
expectEqual ( t , fc , expectedSTS ( t , fc , o ) , removeResourceReqs )
}
func Test_isMagicDNSName ( t * testing . T ) {
func Test_isMagicDNSName ( t * testing . T ) {
tests := [ ] struct {
tests := [ ] struct {
in string
in string