Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the output of kubectl describe service more informative #125117

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tnqn
Copy link
Member

@tnqn tnqn commented May 24, 2024

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

InternalTrafficPolicy has been GA and LoadBalancerIPMode has been beta and enabled by default. Adding them to the output of kubectl describe service to make it more informative.

In addition, for a LoadBalancer Service, there were two "IP" fields in the output of kubectl describe service if its loadBalancerIP is not empty, which looks confusing. The second "IP" is the loadBalancer IP in spec.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

`kubectl describe service` now shows internal traffic policy and ip mode of load balancer IP

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels May 24, 2024
@k8s-ci-robot k8s-ci-robot added area/kubectl sig/cli Categorizes an issue or PR as relevant to SIG CLI. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 24, 2024
@tnqn
Copy link
Member Author

tnqn commented May 24, 2024

/sig network
/sig cli

@k8s-ci-robot k8s-ci-robot added the sig/network Categorizes an issue or PR as relevant to SIG Network. label May 24, 2024
@ardaguclu
Copy link
Member

From sig-cli POV, this looks good to me. But I'd prefer sig-network reviews first.

@tnqn
Copy link
Member Author

tnqn commented May 29, 2024

@ardaguclu thanks for the review.

@danwinship @aojea could you please take a look?

@@ -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)
Copy link
Contributor

@danwinship danwinship Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be something like "Requested LoadBalancer IP" to distinguish it from the "LoadBalancer Ingress" (which is the assigned IP/hostname). Though that would be the new longest field name and it seems like we probably don't want the field names to be too long (since it pushes the field values further away, making it harder to read) so if we could abbreviate that somehow...

Alternatively, this field is deprecated anyway and we discourage people from using it, so maybe we should just remove it from "kubectl describe"? (Is describe supposed to show everything or just the most useful stuff?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. How about "Desired LoadBalancer IP"? It has the same length as "External Traffic Policy", so it won't push the values further away.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer Requested over Desired honestly, better an english native to judge here, at least in spanish desire has some connotations that will not ideal for this context :)

Copy link
Member Author

@tnqn tnqn Jun 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see desired is already used in some objects' describers :)

w.Write(LEVEL_0, "Replicas:\t%d current / %d desired\n", controller.Status.Replicas, *controller.Spec.Replicas)

w.Write(LEVEL_0, "Desired Number of Nodes Scheduled: %d\n", daemon.Status.DesiredNumberScheduled)

w.Write(LEVEL_0, "Replicas:\t%d desired | %d updated | %d total | %d available | %d unavailable\n", *(d.Spec.Replicas), d.Status.UpdatedReplicas, d.Status.Replicas, d.Status.AvailableReplicas, d.Status.UnavailableReplicas)

Please let me know if I should still update it to Requested. It will push values two spaces further when the field is not empty, but it's not the longest field, "LoadBalancer Source Ranges" is the one, but none of the tests set it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danwinship @aojea as "desired" is already used in several describers, do you think it could be used in Service describer, or you prefer using "Requested" (which would push the values two spaces unless "LoadBalancer Source Ranges" is also set).

@danwinship
Copy link
Contributor

lgtm
other than the svc.Spec.LoadBalancerIP thing

@ardaguclu
Copy link
Member

/approve

@ardaguclu
Copy link
Member

/triage accepted
/priority backlog

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Jun 5, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ardaguclu, tnqn

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 5, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/network Categorizes an issue or PR as relevant to SIG Network. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

None yet

5 participants