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

add hostPorts to pod describer #57507

Merged
merged 1 commit into from
Jan 16, 2018

Conversation

dixudx
Copy link
Member

@dixudx dixudx commented Dec 21, 2017

What this PR does / why we need it:
Missing HostPorts when describing pods

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:
/assign @mengqiy @shiywang
Release note:

None

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 21, 2017
if strings.Contains(hostPortString, ",") {
w.Write(LEVEL_2, "HostPorts:\t%s\n", hostPortString)
} else {
if len(hostPortString) == 1 {
Copy link
Contributor

@php-coder php-coder Dec 21, 2017

Choose a reason for hiding this comment

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

This condition looks weird. When the length of the string can be equal to 1?

Copy link
Member Author

Choose a reason for hiding this comment

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

My mistake. Updated. PTAL. Thanks.

if len(hostPortString) == 0 {
w.Write(LEVEL_2, "HostPort:\t<none>\n")
} else {
w.Write(LEVEL_2, "HostPort:\t%s\n", hostPortString)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that having more if conditions just for respecting plural form doesn't worth it. This code also could benefit from using stringOrNone():

w.Write(LEVEL_2, "HostPorts:\t%s\n", stringOrNone(hostPortString))

Copy link
Member Author

Choose a reason for hiding this comment

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

@php-coder Excellent.

Updated. PTAL. Thanks.

@dixudx
Copy link
Member Author

dixudx commented Dec 26, 2017

@kubernetes/sig-cli-pr-reviews PTAL. Thanks.

@k8s-ci-robot k8s-ci-robot added the sig/cli Categorizes an issue or PR as relevant to SIG CLI. label Dec 26, 2017
@deads2k
Copy link
Contributor

deads2k commented Jan 2, 2018

/assign juanvallejo

}
hostPortString := describeContainerHostPorts(container.Ports)
if strings.Contains(hostPortString, ",") {
w.Write(LEVEL_2, "HostPorts:\t%s\n", hostPortString)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/HostPorts/Host Ports/

if strings.Contains(hostPortString, ",") {
w.Write(LEVEL_2, "HostPorts:\t%s\n", hostPortString)
} else {
w.Write(LEVEL_2, "HostPort:\t%s\n", stringOrNone(hostPortString))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/HostPort/Host Port/

@juanvallejo
Copy link
Contributor

@dixudx one nit, otherwise lgtm

@dixudx
Copy link
Member Author

dixudx commented Jan 12, 2018

@juanvallejo @php-coder Updated. PTAL. Thanks.

@php-coder
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 12, 2018
@dixudx
Copy link
Member Author

dixudx commented Jan 12, 2018

ping @smarterclayton @kubernetes/sig-cli-maintainers for approval. Thanks.

@k8s-github-robot
Copy link

/test all

Tests are more than 96 hours old. Re-running tests.

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-github-robot
Copy link

/test all

Tests are more than 96 hours old. Re-running tests.

@deads2k
Copy link
Contributor

deads2k commented Jan 16, 2018

/approve no-issue

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, dixudx, php-coder, soltysh

Associated issue requirement bypassed by: deads2k

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

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your 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 Jan 16, 2018
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

/test all

Tests are more than 96 hours old. Re-running tests.

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit ff626a3 into kubernetes:master Jan 16, 2018
@dixudx dixudx deleted the describe_pod_hostport branch January 17, 2018 01:28
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/cli Categorizes an issue or PR as relevant to SIG CLI. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants