fix: avoid panic on resource backends

This commit is contained in:
Ludovic Fernandez 2023-07-19 17:36:06 +02:00 committed by GitHub
parent e29da5ad65
commit bed6069e82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -519,6 +519,15 @@ func getTLSConfig(tlsConfigs map[string]*tls.CertAndStores) []*tls.CertAndStores
}
func (p *Provider) loadService(client Client, namespace string, backend netv1.IngressBackend) (*dynamic.Service, error) {
if backend.Resource != nil {
// https://kubernetes.io/docs/concepts/services-networking/ingress/#resource-backend
return nil, errors.New("resource backends are not supported")
}
if backend.Service == nil {
return nil, errors.New("missing service definition")
}
service, exists, err := client.GetService(namespace, backend.Service.Name)
if err != nil {
return nil, err