mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
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:
commit
362c4acc54
@ -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.
|
// `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 {
|
func loadBalancerStatusStringer(s api.LoadBalancerStatus, wide bool) string {
|
||||||
ingress := s.Ingress
|
ingress := s.Ingress
|
||||||
result := []string{}
|
result := sets.NewString()
|
||||||
for i := range ingress {
|
for i := range ingress {
|
||||||
if ingress[i].IP != "" {
|
if ingress[i].IP != "" {
|
||||||
result = append(result, ingress[i].IP)
|
result.Insert(ingress[i].IP)
|
||||||
} else if ingress[i].Hostname != "" {
|
} 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 {
|
if !wide && len(r) > loadBalancerWidth {
|
||||||
r = r[0:(loadBalancerWidth-3)] + "..."
|
r = r[0:(loadBalancerWidth-3)] + "..."
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user