File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
staging/src/k8s.io/endpointslice Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -631,6 +631,43 @@ func TestGetEndpointPorts(t *testing.T) {
631
631
Protocol : & protoTCP ,
632
632
}},
633
633
},
634
+ "service with same named port for regular and restartable init container" : {
635
+ service : & v1.Service {
636
+ Spec : v1.ServiceSpec {
637
+ Ports : []v1.ServicePort {
638
+ {
639
+ Name : "http" ,
640
+ Port : 80 ,
641
+ TargetPort : intstr .FromString ("http" ),
642
+ Protocol : protoTCP ,
643
+ }},
644
+ },
645
+ },
646
+ pod : & v1.Pod {
647
+ Spec : v1.PodSpec {
648
+ InitContainers : []v1.Container {{
649
+ Ports : []v1.ContainerPort {{
650
+ Name : "http" ,
651
+ ContainerPort : int32 (8080 ),
652
+ Protocol : protoTCP ,
653
+ }},
654
+ RestartPolicy : & restartPolicyAlways ,
655
+ }},
656
+ Containers : []v1.Container {{
657
+ Ports : []v1.ContainerPort {{
658
+ Name : "http" ,
659
+ ContainerPort : int32 (8090 ),
660
+ Protocol : protoTCP ,
661
+ }},
662
+ }},
663
+ },
664
+ },
665
+ expectedPorts : []* discovery.EndpointPort {{
666
+ Name : pointer .String ("http" ),
667
+ Port : pointer .Int32 (8090 ),
668
+ Protocol : & protoTCP ,
669
+ }},
670
+ },
634
671
}
635
672
636
673
for name , tc := range testCases {
You can’t perform that action at this time.
0 commit comments