@@ -317,6 +317,9 @@ func TestSyncEndpointsExistingNilSubsets(t *testing.T) {
317
317
Name : "foo" ,
318
318
Namespace : ns ,
319
319
ResourceVersion : "1" ,
320
+ Labels : map [string ]string {
321
+ labelManagedBy : controllerName ,
322
+ },
320
323
},
321
324
Subsets : nil ,
322
325
})
@@ -346,6 +349,9 @@ func TestSyncEndpointsExistingEmptySubsets(t *testing.T) {
346
349
Name : "foo" ,
347
350
Namespace : ns ,
348
351
ResourceVersion : "1" ,
352
+ Labels : map [string ]string {
353
+ labelManagedBy : controllerName ,
354
+ },
349
355
},
350
356
Subsets : []v1.EndpointSubset {},
351
357
})
@@ -376,6 +382,9 @@ func TestSyncEndpointsWithPodResourceVersionUpdateOnly(t *testing.T) {
376
382
Name : "foo" ,
377
383
Namespace : ns ,
378
384
ResourceVersion : "1" ,
385
+ Labels : map [string ]string {
386
+ labelManagedBy : controllerName ,
387
+ },
379
388
},
380
389
Subsets : []v1.EndpointSubset {{
381
390
Addresses : []v1.EndpointAddress {
@@ -501,6 +510,7 @@ func TestSyncEndpointsProtocolTCP(t *testing.T) {
501
510
Namespace : ns ,
502
511
ResourceVersion : "1" ,
503
512
Labels : map [string ]string {
513
+ labelManagedBy : controllerName ,
504
514
v1 .IsHeadlessService : "" ,
505
515
},
506
516
},
@@ -524,6 +534,7 @@ func TestSyncEndpointsHeadlessServiceLabel(t *testing.T) {
524
534
Namespace : ns ,
525
535
ResourceVersion : "1" ,
526
536
Labels : map [string ]string {
537
+ labelManagedBy : controllerName ,
527
538
v1 .IsHeadlessService : "" ,
528
539
},
529
540
},
@@ -652,6 +663,7 @@ func TestSyncEndpointsProtocolUDP(t *testing.T) {
652
663
Namespace : ns ,
653
664
ResourceVersion : "1" ,
654
665
Labels : map [string ]string {
666
+ labelManagedBy : controllerName ,
655
667
v1 .IsHeadlessService : "" ,
656
668
},
657
669
},
@@ -701,6 +713,7 @@ func TestSyncEndpointsProtocolSCTP(t *testing.T) {
701
713
Namespace : ns ,
702
714
ResourceVersion : "1" ,
703
715
Labels : map [string ]string {
716
+ labelManagedBy : controllerName ,
704
717
v1 .IsHeadlessService : "" ,
705
718
},
706
719
},
@@ -746,6 +759,7 @@ func TestSyncEndpointsItemsEmptySelectorSelectsAll(t *testing.T) {
746
759
Namespace : ns ,
747
760
ResourceVersion : "1" ,
748
761
Labels : map [string ]string {
762
+ labelManagedBy : controllerName ,
749
763
v1 .IsHeadlessService : "" ,
750
764
},
751
765
},
@@ -792,6 +806,7 @@ func TestSyncEndpointsItemsEmptySelectorSelectsAllNotReady(t *testing.T) {
792
806
Namespace : ns ,
793
807
ResourceVersion : "1" ,
794
808
Labels : map [string ]string {
809
+ labelManagedBy : controllerName ,
795
810
v1 .IsHeadlessService : "" ,
796
811
},
797
812
},
@@ -838,6 +853,7 @@ func TestSyncEndpointsItemsEmptySelectorSelectsAllMixed(t *testing.T) {
838
853
Namespace : ns ,
839
854
ResourceVersion : "1" ,
840
855
Labels : map [string ]string {
856
+ labelManagedBy : controllerName ,
841
857
v1 .IsHeadlessService : "" ,
842
858
},
843
859
},
@@ -861,6 +877,9 @@ func TestSyncEndpointsItemsPreexisting(t *testing.T) {
861
877
Name : "foo" ,
862
878
Namespace : ns ,
863
879
ResourceVersion : "1" ,
880
+ Labels : map [string ]string {
881
+ labelManagedBy : controllerName ,
882
+ },
864
883
},
865
884
Subsets : []v1.EndpointSubset {{
866
885
Addresses : []v1.EndpointAddress {{IP : "6.7.8.9" , NodeName : & emptyNodeName }},
@@ -887,6 +906,7 @@ func TestSyncEndpointsItemsPreexisting(t *testing.T) {
887
906
Namespace : ns ,
888
907
ResourceVersion : "1" ,
889
908
Labels : map [string ]string {
909
+ labelManagedBy : controllerName ,
890
910
v1 .IsHeadlessService : "" ,
891
911
},
892
912
},
@@ -909,6 +929,9 @@ func TestSyncEndpointsItemsPreexistingIdentical(t *testing.T) {
909
929
ResourceVersion : "1" ,
910
930
Name : "foo" ,
911
931
Namespace : ns ,
932
+ Labels : map [string ]string {
933
+ labelManagedBy : controllerName ,
934
+ },
912
935
},
913
936
Subsets : []v1.EndpointSubset {{
914
937
Addresses : []v1.EndpointAddress {{IP : "1.2.3.4" , NodeName : & emptyNodeName , TargetRef : & v1.ObjectReference {Kind : "Pod" , Name : "pod0" , Namespace : ns }}},
@@ -972,6 +995,7 @@ func TestSyncEndpointsItems(t *testing.T) {
972
995
ResourceVersion : "" ,
973
996
Name : "foo" ,
974
997
Labels : map [string ]string {
998
+ labelManagedBy : controllerName ,
975
999
v1 .IsHeadlessService : "" ,
976
1000
},
977
1001
},
@@ -1022,6 +1046,7 @@ func TestSyncEndpointsItemsWithLabels(t *testing.T) {
1022
1046
}}
1023
1047
1024
1048
serviceLabels [v1 .IsHeadlessService ] = ""
1049
+ serviceLabels [labelManagedBy ] = controllerName
1025
1050
data := runtime .EncodeOrDie (clientscheme .Codecs .LegacyCodec (v1 .SchemeGroupVersion ), & v1.Endpoints {
1026
1051
ObjectMeta : metav1.ObjectMeta {
1027
1052
ResourceVersion : "" ,
@@ -1074,6 +1099,7 @@ func TestSyncEndpointsItemsPreexistingLabelsChange(t *testing.T) {
1074
1099
}
1075
1100
1076
1101
serviceLabels [v1 .IsHeadlessService ] = ""
1102
+ serviceLabels [labelManagedBy ] = controllerName
1077
1103
data := runtime .EncodeOrDie (clientscheme .Codecs .LegacyCodec (v1 .SchemeGroupVersion ), & v1.Endpoints {
1078
1104
ObjectMeta : metav1.ObjectMeta {
1079
1105
Name : "foo" ,
@@ -1183,6 +1209,7 @@ func TestSyncEndpointsHeadlessService(t *testing.T) {
1183
1209
Namespace : ns ,
1184
1210
ResourceVersion : "1" ,
1185
1211
Labels : map [string ]string {
1212
+ labelManagedBy : controllerName ,
1186
1213
"a" : "b" ,
1187
1214
v1 .IsHeadlessService : "" ,
1188
1215
},
@@ -1212,7 +1239,8 @@ func TestSyncEndpointsItemsExcludeNotReadyPodsWithRestartPolicyNeverAndPhaseFail
1212
1239
Namespace : ns ,
1213
1240
ResourceVersion : "1" ,
1214
1241
Labels : map [string ]string {
1215
- "foo" : "bar" ,
1242
+ labelManagedBy : controllerName ,
1243
+ "foo" : "bar" ,
1216
1244
},
1217
1245
},
1218
1246
Subsets : []v1.EndpointSubset {},
@@ -1236,6 +1264,7 @@ func TestSyncEndpointsItemsExcludeNotReadyPodsWithRestartPolicyNeverAndPhaseFail
1236
1264
Namespace : ns ,
1237
1265
ResourceVersion : "1" ,
1238
1266
Labels : map [string ]string {
1267
+ labelManagedBy : controllerName ,
1239
1268
v1 .IsHeadlessService : "" ,
1240
1269
},
1241
1270
},
@@ -1281,6 +1310,7 @@ func TestSyncEndpointsItemsExcludeNotReadyPodsWithRestartPolicyNeverAndPhaseSucc
1281
1310
Namespace : ns ,
1282
1311
ResourceVersion : "1" ,
1283
1312
Labels : map [string ]string {
1313
+ labelManagedBy : controllerName ,
1284
1314
v1 .IsHeadlessService : "" ,
1285
1315
},
1286
1316
},
@@ -1327,6 +1357,7 @@ func TestSyncEndpointsItemsExcludeNotReadyPodsWithRestartPolicyOnFailureAndPhase
1327
1357
Namespace : ns ,
1328
1358
ResourceVersion : "1" ,
1329
1359
Labels : map [string ]string {
1360
+ labelManagedBy : controllerName ,
1330
1361
v1 .IsHeadlessService : "" ,
1331
1362
},
1332
1363
},
@@ -1361,6 +1392,7 @@ func TestSyncEndpointsHeadlessWithoutPort(t *testing.T) {
1361
1392
ObjectMeta : metav1.ObjectMeta {
1362
1393
Name : "foo" ,
1363
1394
Labels : map [string ]string {
1395
+ labelManagedBy : controllerName ,
1364
1396
v1 .IsHeadlessService : "" ,
1365
1397
},
1366
1398
},
@@ -1580,6 +1612,7 @@ func TestLastTriggerChangeTimeAnnotation(t *testing.T) {
1580
1612
v1 .EndpointsLastChangeTriggerTime : triggerTimeString ,
1581
1613
},
1582
1614
Labels : map [string ]string {
1615
+ labelManagedBy : controllerName ,
1583
1616
v1 .IsHeadlessService : "" ,
1584
1617
},
1585
1618
},
@@ -1636,6 +1669,7 @@ func TestLastTriggerChangeTimeAnnotation_AnnotationOverridden(t *testing.T) {
1636
1669
v1 .EndpointsLastChangeTriggerTime : triggerTimeString ,
1637
1670
},
1638
1671
Labels : map [string ]string {
1672
+ labelManagedBy : controllerName ,
1639
1673
v1 .IsHeadlessService : "" ,
1640
1674
},
1641
1675
},
@@ -1690,6 +1724,7 @@ func TestLastTriggerChangeTimeAnnotation_AnnotationCleared(t *testing.T) {
1690
1724
Namespace : ns ,
1691
1725
ResourceVersion : "1" ,
1692
1726
Labels : map [string ]string {
1727
+ labelManagedBy : controllerName ,
1693
1728
v1 .IsHeadlessService : "" ,
1694
1729
}, // Annotation not set anymore.
1695
1730
},
0 commit comments