mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-17 15:50:10 +00:00
Add test case for service with same named port for regular and sidecar containers
This commit is contained in:
parent
e637659d89
commit
4e21f53547
@ -631,6 +631,43 @@ func TestGetEndpointPorts(t *testing.T) {
|
|||||||
Protocol: &protoTCP,
|
Protocol: &protoTCP,
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
|
"service with same named port for regular and restartable init container": {
|
||||||
|
service: &v1.Service{
|
||||||
|
Spec: v1.ServiceSpec{
|
||||||
|
Ports: []v1.ServicePort{
|
||||||
|
{
|
||||||
|
Name: "http",
|
||||||
|
Port: 80,
|
||||||
|
TargetPort: intstr.FromString("http"),
|
||||||
|
Protocol: protoTCP,
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pod: &v1.Pod{
|
||||||
|
Spec: v1.PodSpec{
|
||||||
|
InitContainers: []v1.Container{{
|
||||||
|
Ports: []v1.ContainerPort{{
|
||||||
|
Name: "http",
|
||||||
|
ContainerPort: int32(8080),
|
||||||
|
Protocol: protoTCP,
|
||||||
|
}},
|
||||||
|
RestartPolicy: &restartPolicyAlways,
|
||||||
|
}},
|
||||||
|
Containers: []v1.Container{{
|
||||||
|
Ports: []v1.ContainerPort{{
|
||||||
|
Name: "http",
|
||||||
|
ContainerPort: int32(8090),
|
||||||
|
Protocol: protoTCP,
|
||||||
|
}},
|
||||||
|
}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
expectedPorts: []*discovery.EndpointPort{{
|
||||||
|
Name: pointer.String("http"),
|
||||||
|
Port: pointer.Int32(8090),
|
||||||
|
Protocol: &protoTCP,
|
||||||
|
}},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, tc := range testCases {
|
for name, tc := range testCases {
|
||||||
|
Loading…
Reference in New Issue
Block a user