From 11e8f3a88dddcac5f83490eb44ff05a43e1ab113 Mon Sep 17 00:00:00 2001 From: FengyunPan Date: Sat, 29 Jul 2017 11:23:23 +0800 Subject: [PATCH] Filter duplicate ips or hostnames for ingress Fix issue: #48654 --- pkg/printers/internalversion/printers.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/printers/internalversion/printers.go b/pkg/printers/internalversion/printers.go index 32c80da9f7b..4d0834cb534 100644 --- a/pkg/printers/internalversion/printers.go +++ b/pkg/printers/internalversion/printers.go @@ -702,15 +702,16 @@ func printCronJobList(list *batch.CronJobList, options printers.PrintOptions) ([ // `wide` indicates whether the returned value is meant for --o=wide output. If not, it's clipped to 16 bytes. func loadBalancerStatusStringer(s api.LoadBalancerStatus, wide bool) string { ingress := s.Ingress - result := []string{} + result := sets.NewString() for i := range ingress { if ingress[i].IP != "" { - result = append(result, ingress[i].IP) + result.Insert(ingress[i].IP) } else if ingress[i].Hostname != "" { - result = append(result, ingress[i].Hostname) + result.Insert(ingress[i].Hostname) } } - r := strings.Join(result, ",") + + r := strings.Join(result.List(), ",") if !wide && len(r) > loadBalancerWidth { r = r[0:(loadBalancerWidth-3)] + "..." }