e2e ingress don't set class if empty

This commit is contained in:
Antonio Ojea 2021-05-19 10:23:49 +02:00
parent 0839ed41ac
commit fa56d296e0

View File

@ -420,9 +420,9 @@ type TestJig struct {
RootCAs map[string][]byte
Address string
Ingress *networkingv1.Ingress
// class is the value of the annotation keyed under
// `kubernetes.io/ingress.class`. It's added to all ingresses created by
// this jig.
// class was the value of the annotation keyed under `kubernetes.io/ingress.class`.
// A new ingressClassName field has been added that is used to reference the IngressClass.
// It's added to all ingresses created by this jig.
Class string
// The interval used to poll urls
@ -485,7 +485,9 @@ func (j *TestJig) CreateIngress(manifestPath, ns string, ingAnnotations map[stri
j.Ingress, err = ingressFromManifest(filepath.Join(manifestPath, "ing.yaml"))
framework.ExpectNoError(err)
j.Ingress.Namespace = ns
j.Ingress.Spec.IngressClassName = &j.Class
if j.Class != "" {
j.Ingress.Spec.IngressClassName = &j.Class
}
j.Logger.Infof("creating %v ingress", j.Ingress.Name)
j.Ingress, err = j.runCreate(j.Ingress)
framework.ExpectNoError(err)