Merge pull request #48655 from FengyunPan/remove-duplicate-item

Automatic merge from submit-queue

Filter duplicate ips or hostnames for ingress

Fix issue: #48654

**Release note**:
```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-08-08 00:52:04 -07:00 committed by GitHub
commit 362c4acc54

View File

@ -836,15 +836,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)] + "..."
}