Don't set label if ingressClassName is not set

Signed-off-by: Mike Eves <michael.eves@autotrader.co.uk>
This commit is contained in:
Mike Eves 2021-06-11 15:14:23 +01:00
parent 7e1111ff14
commit 7941b350ba

View File

@ -155,9 +155,7 @@ func ingressLabels(ingress *v1beta1.Ingress) model.LabelSet {
ls := make(model.LabelSet, 2*(len(ingress.Labels)+len(ingress.Annotations))+2)
ls[ingressNameLabel] = lv(ingress.Name)
ls[namespaceLabel] = lv(ingress.Namespace)
if ingress.Spec.IngressClassName == nil {
ls[ingressClassNameLabel] = lv("")
} else {
if ingress.Spec.IngressClassName != nil {
ls[ingressClassNameLabel] = lv(*ingress.Spec.IngressClassName)
}