Fix panic in ingress class validation

If an ingress had no class annotation, nor IngressClassName  at all, and an IngressClass resource was created for the ingress-nginx there was a panic when the controller tried to check the IngressClassName of the Ingress.
This commit is contained in:
Laszlo Janosi 2020-08-07 17:09:14 +00:00
parent 56a1e82125
commit 7d82903ce9
No known key found for this signature in database
GPG key ID: 42C43D7CF4B1B5D7
2 changed files with 46 additions and 17 deletions

View file

@ -63,5 +63,8 @@ func IsValid(ing *networking.Ingress) bool {
}
// 4. with IngressClass
return k8s.IngressClass.Name == *ing.Spec.IngressClassName
if ing.Spec.IngressClassName != nil {
return k8s.IngressClass.Name == *ing.Spec.IngressClassName
}
return false
}