@@ -3545,6 +3545,7 @@ func TestExternalServices(t *testing.T) {
3545
3545
labels map [string ]string
3546
3546
annotations map [string ]string
3547
3547
externalName string
3548
+ externalIPs []string
3548
3549
expected []* endpoint.Endpoint
3549
3550
expectError bool
3550
3551
}{
@@ -3562,6 +3563,7 @@ func TestExternalServices(t *testing.T) {
3562
3563
hostnameAnnotationKey : "service.example.org" ,
3563
3564
},
3564
3565
"111.111.111.111" ,
3566
+ []string {},
3565
3567
[]* endpoint.Endpoint {
3566
3568
{DNSName : "service.example.org" , Targets : endpoint.Targets {"111.111.111.111" }, RecordType : endpoint .RecordTypeA },
3567
3569
},
@@ -3581,6 +3583,7 @@ func TestExternalServices(t *testing.T) {
3581
3583
hostnameAnnotationKey : "service.example.org" ,
3582
3584
},
3583
3585
"2001:db8::111" ,
3586
+ []string {},
3584
3587
[]* endpoint.Endpoint {
3585
3588
{DNSName : "service.example.org" , Targets : endpoint.Targets {"2001:db8::111" }, RecordType : endpoint .RecordTypeAAAA },
3586
3589
},
@@ -3600,11 +3603,32 @@ func TestExternalServices(t *testing.T) {
3600
3603
hostnameAnnotationKey : "service.example.org" ,
3601
3604
},
3602
3605
"remote.example.com" ,
3606
+ []string {},
3603
3607
[]* endpoint.Endpoint {
3604
3608
{DNSName : "service.example.org" , Targets : endpoint.Targets {"remote.example.com" }, RecordType : endpoint .RecordTypeCNAME },
3605
3609
},
3606
3610
false ,
3607
3611
},
3612
+ {
3613
+ "annotated ExternalName service with externalIPs returns a single endpoint with multiple targets" ,
3614
+ "" ,
3615
+ "testing" ,
3616
+ "foo" ,
3617
+ v1 .ServiceTypeExternalName ,
3618
+ "" ,
3619
+ "" ,
3620
+ false ,
3621
+ map [string ]string {"component" : "foo" },
3622
+ map [string ]string {
3623
+ hostnameAnnotationKey : "service.example.org" ,
3624
+ },
3625
+ "service.example.org" ,
3626
+ []string {"10.2.3.4" , "11.2.3.4" },
3627
+ []* endpoint.Endpoint {
3628
+ {DNSName : "service.example.org" , RecordType : endpoint .RecordTypeA , Targets : endpoint.Targets {"10.2.3.4" , "11.2.3.4" }},
3629
+ },
3630
+ false ,
3631
+ },
3608
3632
} {
3609
3633
tc := tc
3610
3634
t .Run (tc .title , func (t * testing.T ) {
@@ -3617,6 +3641,7 @@ func TestExternalServices(t *testing.T) {
3617
3641
Spec : v1.ServiceSpec {
3618
3642
Type : tc .svcType ,
3619
3643
ExternalName : tc .externalName ,
3644
+ ExternalIPs : tc .externalIPs ,
3620
3645
},
3621
3646
ObjectMeta : metav1.ObjectMeta {
3622
3647
Namespace : tc .svcNamespace ,
0 commit comments