Merge pull request #94985 from howardjohn/describe-ingress

Fix `kubectl describe ingress` format
This commit is contained in:
Kubernetes Prow Robot 2020-10-14 14:05:49 -07:00 committed by GitHub
commit 2318a13228
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 2 deletions

View File

@ -2465,7 +2465,7 @@ func (i *IngressDescriber) describeBackendV1(ns string, backend *networkingv1.In
}
}
ep := formatEndpoints(endpoints, sets.NewString(spName))
return fmt.Sprintf("%s\t %s)", sb, ep)
return fmt.Sprintf("%s (%s)", sb, ep)
}
if backend.Resource != nil {
ic := backend.Resource
@ -2518,7 +2518,7 @@ func (i *IngressDescriber) describeIngressV1(ing *networkingv1.Ingress, events *
}
}
if count == 0 {
w.Write(LEVEL_1, "\t%s %s\n", "*", "*", i.describeBackendV1(ns, def))
w.Write(LEVEL_1, "%s\t%s\t%s\n", "*", "*", i.describeBackendV1(ns, def))
}
printAnnotationsMultiline(w, "Annotations", ing.Annotations)

View File

@ -1924,6 +1924,28 @@ Rules:
Annotations: <none>
Events: <none>` + "\n",
},
"DefaultBackend": {
input: fake.NewSimpleClientset(&networkingv1.Ingress{
ObjectMeta: metav1.ObjectMeta{
Name: "bar",
Namespace: "foo",
},
Spec: networkingv1.IngressSpec{
DefaultBackend: &backendV1,
},
}),
output: `Name: bar
Namespace: foo
Address:
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>
`,
},
}
for name, test := range tests {