Specify empty IngresClassName as <none> to more clearly specify it is empty

This commit is contained in:
Marcus Puckett 2022-02-09 16:28:16 -08:00
parent 8b541910c0
commit e7e2bfde16
2 changed files with 26 additions and 2 deletions

View File

@ -2630,7 +2630,7 @@ func (i *IngressDescriber) describeIngressV1(ing *networkingv1.Ingress, events *
printLabelsMultiline(w, "Labels", ing.Labels)
w.Write(LEVEL_0, "Namespace:\t%v\n", ing.Namespace)
w.Write(LEVEL_0, "Address:\t%v\n", loadBalancerStatusStringer(ing.Status.LoadBalancer, true))
ingressClassName := ""
ingressClassName := "<none>"
if ing.Spec.IngressClassName != nil {
ingressClassName = *ing.Spec.IngressClassName
}
@ -2691,7 +2691,7 @@ func (i *IngressDescriber) describeIngressV1beta1(ing *networkingv1beta1.Ingress
printLabelsMultiline(w, "Labels", ing.Labels)
w.Write(LEVEL_0, "Namespace:\t%v\n", ing.Namespace)
w.Write(LEVEL_0, "Address:\t%v\n", loadBalancerStatusStringer(ing.Status.LoadBalancer, true))
ingressClassName := ""
ingressClassName := "<none>"
if ing.Spec.IngressClassName != nil {
ingressClassName = *ing.Spec.IngressClassName
}

View File

@ -2604,6 +2604,30 @@ Rules:
* * default-backend:80 (<error: endpoints "default-backend" not found>)
Annotations: <none>
Events: <none>
`,
},
"EmptyIngressClassName": {
input: fake.NewSimpleClientset(&networkingv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: "bar",
Namespace: "foo",
},
Spec: networkingv1.IngressSpec{
DefaultBackend: &backendV1,
},
}),
output: `Name: bar
Labels: <none>
Namespace: foo
Address:
Ingress Class: <none>
Default backend: default-backend:80 (<error: endpoints "default-backend" not found>)
Rules:
Host Path Backends
---- ---- --------
* * default-backend:80 (<error: endpoints "default-backend" not found>)
Annotations: <none>
Events: <none>
`,
},
}