Improve the error message when trying to proxy unsupported service type

Kubernetes-commit: 342ef6234d4c7acf3ffca0f01831de316fb7ac11
This commit is contained in:
erwinvaneyk 2021-11-17 12:24:49 +01:00 committed by Kubernetes Publisher
parent 75ed1d2775
commit 23f238960a
1 changed files with 5 additions and 5 deletions

View File

@ -45,11 +45,6 @@ func ResolveEndpoint(services listersv1.ServiceLister, endpoints listersv1.Endpo
return nil, err
}
svcPort, err := findServicePort(svc, port)
if err != nil {
return nil, err
}
switch {
case svc.Spec.Type == v1.ServiceTypeClusterIP, svc.Spec.Type == v1.ServiceTypeLoadBalancer, svc.Spec.Type == v1.ServiceTypeNodePort:
// these are fine
@ -57,6 +52,11 @@ func ResolveEndpoint(services listersv1.ServiceLister, endpoints listersv1.Endpo
return nil, fmt.Errorf("unsupported service type %q", svc.Spec.Type)
}
svcPort, err := findServicePort(svc, port)
if err != nil {
return nil, err
}
eps, err := endpoints.Endpoints(namespace).Get(svc.Name)
if err != nil {
return nil, err