mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-13 13:14:05 +00:00
Rename Service.ContainerPort to TargetPort in v1b3
Fix all callers and examples. Part of multi-port service cleanup.
This commit is contained in:
@@ -68,7 +68,7 @@ func (e *EndpointController) SyncServiceEndpoints() error {
|
||||
|
||||
for _, pod := range pods.Items {
|
||||
// TODO: Once v1beta1 and v1beta2 are EOL'ed, this can
|
||||
// assume that service.Spec.ContainerPort is populated.
|
||||
// assume that service.Spec.TargetPort is populated.
|
||||
_ = v1beta1.Dependency
|
||||
_ = v1beta2.Dependency
|
||||
port, err := findPort(&pod, &service)
|
||||
@@ -196,7 +196,7 @@ func findDefaultPort(pod *api.Pod, servicePort int) (int, bool) {
|
||||
|
||||
// findPort locates the container port for the given manifest and portName.
|
||||
func findPort(pod *api.Pod, service *api.Service) (int, error) {
|
||||
portName := service.Spec.ContainerPort
|
||||
portName := service.Spec.TargetPort
|
||||
switch portName.Kind {
|
||||
case util.IntstrString:
|
||||
if len(portName.StrVal) == 0 {
|
||||
|
@@ -213,7 +213,7 @@ func TestFindPort(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
port, err := findPort(&test.pod, &api.Service{Spec: api.ServiceSpec{Port: servicePort, ContainerPort: test.portName}})
|
||||
port, err := findPort(&test.pod, &api.Service{Spec: api.ServiceSpec{Port: servicePort, TargetPort: test.portName}})
|
||||
if port != test.wport {
|
||||
t.Errorf("Expected port %d, Got %d", test.wport, port)
|
||||
}
|
||||
|
Reference in New Issue
Block a user