Change:
We should show a nicely formatted map, with tls and ports. This 50% works. Today we have: Which works well enough, but printing a single Ingress involves hand managing tabs and newlines till the entire Ingress is printed, i.e: So when we start mixing different Ingress types, we get jarring output: This is because the columns are formatted per the top ingress and don't match the bottom one. The tabbed writer used by kubectl to align columns gets confused on the whole.
you can assign this to me, will fix this next-candidate.
thanks!
Sounds like we should keep it to a single line () and move everything else to describe. Makes this bug easier.
yeah, we will move this to a single line, this is the principle.
was this finished for 1.3?
the code is already finished on my local branch. I will open a PR as I confirmed it.
what do you think if print ingress like this: Also the original resource is:
That would fall right off the screen. I think we have to stick to just printing the ips in , and everything else in . You can print hoststs alone, and optimize for small ingresses by doing something like we do for endpoints (show a small number of characters then do "..."). The problem with trying to print everything on one line is you can't represent the fanout cleanly, ie you might do: But with multiple hosts: Doesn't work, because /bar and secret2 only applies to
I agree with this, maybe we should just remove these rules from get ingress output or just leave host here.
SGTM are you going to send a pr?
yes, ready to.

Discussion:
var replicaSetColumns = []string{"NAME", "DESIRED", "CURRENT", "AGE"} var jobColumns = []string{"NAME", "DESIRED", "SUCCESSFUL", "AGE"} var serviceColumns = []string{"NAME", "CLUSTER-IP", "EXTERNAL-IP", "PORT(S)", "AGE"} <del> var ingressColumns = []string{"NAME", "RULE", "BACKEND", "ADDRESS", "AGE"} </del> <ins> var ingressColumns = []string{"NAME", "HOSTS", "ADDRESS", "PORTS", "AGE"} </ins> var petSetColumns = []string{"NAME", "DESIRED", "CURRENT", "AGE"} var endpointColumns = []string{"NAME", "ENDPOINTS", "AGE"} var nodeColumns = []string{"NAME", "STATUS", "AGE"}

return fmt.Sprintf("%v:%v", backend.ServiceName, backend.ServicePort.String()) } <ins> func formatHosts(rules []extensions.IngressRule) string { list := []string{} max := 3 more := false for _, rule := range rules { if len(list) == max { more = true } if !more && len(rule.Host) != 0 { list = append(list, rule.Host) } } if len(list) == 0 { return "*" } ret := strings.Join(list, ",") if more { return fmt.Sprintf("%s + %d more...", ret, len(rules)-max) } return ret } func formatPorts(tls []extensions.IngressTLS) string { if len(tls) != 0 { return "80, 443" } return "80" } </ins> func printIngress(ingress *extensions.Ingress, w io.Writer, options PrintOptions) error { name := ingress.Name namespace := ingress.Namespace <del> hostRules := ingress.Spec.Rules </del> if options.WithNamespace { if _, err := fmt.Fprintf(w, "%st", namespace); err != nil { return err

if _, err := fmt.Fprintf(w, "%st%vt%vt%vt%s", name, <del> "-", backendStringer(ingress.Spec.Backend), </del> <ins> formatHosts(ingress.Spec.Rules), </ins> loadBalancerStatusStringer(ingress.Status.LoadBalancer), <ins> formatPorts(ingress.Spec.TLS), </ins> translateTimestamp(ingress.CreationTimestamp), ); err != nil { return err

if _, err := fmt.Fprint(w, AppendAllLabels(options.ShowLabels, ingress.Labels)); err != nil { return err } <del> // Lay out all the rules on separate lines if use wide output. // TODO(AdoHe): improve ingress output extraLinePrefix := "" if options.WithNamespace { extraLinePrefix = "t" } for _, rules := range hostRules { if rules.HTTP == nil { continue } _, err := fmt.Fprintf(w, "%st%vt", extraLinePrefix, rules.Host) if err != nil { return err } if _, err := fmt.Fprint(w, AppendLabelTabs(options.ColumnLabels)); err != nil { return err } for _, rule := range rules.HTTP.Paths { _, err := fmt.Fprintf(w, "%st%vt%v", extraLinePrefix, rule.Path, backendStringer(&rule.Backend)) if err != nil { return err } if _, err := fmt.Fprint(w, AppendLabelTabs(options.ColumnLabels)); err != nil { return err } } } </del> return nil }