Skip to content

Commit

Permalink
kubectl: fix duplicate IP fields in Service describer
Browse files Browse the repository at this point in the history
For a LoadBalancer Service, there were two "IP" fields in the output of
`kubectl describe service` if its loadBalancerIP is not empty, which
looks ambiguous.
  • Loading branch information
tnqn committed May 24, 2024
1 parent 55295a2 commit 1e5c637
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion staging/src/k8s.io/kubectl/pkg/describe/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -3030,7 +3030,7 @@ func describeService(service *corev1.Service, endpointSlices []discoveryv1.Endpo
w.Write(LEVEL_0, "External IPs:\t%v\n", strings.Join(service.Spec.ExternalIPs, ","))
}
if service.Spec.LoadBalancerIP != "" {
w.Write(LEVEL_0, "IP:\t%s\n", service.Spec.LoadBalancerIP)
w.Write(LEVEL_0, "LoadBalancer IP:\t%s\n", service.Spec.LoadBalancerIP)
}
if service.Spec.ExternalName != "" {
w.Write(LEVEL_0, "External Name:\t%s\n", service.Spec.ExternalName)
Expand Down
8 changes: 4 additions & 4 deletions staging/src/k8s.io/kubectl/pkg/describe/describe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ func TestDescribeService(t *testing.T) {
IP Families: IPv4
IP: 1.2.3.4
IPs: <none>
IP: 5.6.7.8
LoadBalancer IP: 5.6.7.8
LoadBalancer Ingress: 5.6.7.8 (VIP)
Port: port-tcp 8080/TCP
TargetPort: 9527/TCP
Expand Down Expand Up @@ -821,7 +821,7 @@ func TestDescribeService(t *testing.T) {
IP Families: IPv4
IP: 1.2.3.4
IPs: <none>
IP: 5.6.7.8
LoadBalancer IP: 5.6.7.8
LoadBalancer Ingress: 5.6.7.8
Port: port-tcp 8080/TCP
TargetPort: targetPort/TCP
Expand Down Expand Up @@ -886,7 +886,7 @@ func TestDescribeService(t *testing.T) {
IP Families: IPv4
IP: 1.2.3.4
IPs: <none>
IP: 5.6.7.8
LoadBalancer IP: 5.6.7.8
Port: port-tcp 8080/TCP
TargetPort: targetPort/TCP
NodePort: port-tcp 31111/TCP
Expand Down Expand Up @@ -935,7 +935,7 @@ func TestDescribeService(t *testing.T) {
IP Families: IPv4
IP: 1.2.3.4
IPs: 1.2.3.4
IP: 5.6.7.8
LoadBalancer IP: 5.6.7.8
Port: port-tcp 8080/TCP
TargetPort: targetPort/TCP
NodePort: port-tcp 31111/TCP
Expand Down

0 comments on commit 1e5c637

Please sign in to comment.