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

outputs <none> for colums not found #51750

Merged

Conversation

jianhuiz
Copy link
Contributor

@jianhuiz jianhuiz commented Aug 31, 2017

What this PR does / why we need it:

outputs <none> for columns specified by -o custom-columns but not found in object

currently kubectl outputs an error of "xxx is not found" when a column is not in the returned json (omitted because of empty value or no such field in the object type at all). This PR suppress this error but outputs <none> at that field. This makes it convenient to output the objects details, especially when getting objects of different type in one command.

example:

$ kubectl get deploy,rs,po -o custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,REPLICAS:.status.replicas
NAMESPACE   NAME                      REPLICAS
default     deck                      1
default     deck-433074128            1
default     deck-433074128-vxcg9      <none>

Special notes for your reviewer:

Release note:

outputs `<none>` for columns specified by `-o custom-columns` but not found in object

@kubernetes/kubectl-reviewers

@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 31, 2017
@k8s-github-robot k8s-github-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Aug 31, 2017
@jianhuiz jianhuiz force-pushed the kubectl-custom-colume-not-found branch from 33aa958 to 00620d9 Compare September 1, 2017 04:09
@dims
Copy link
Member

dims commented Sep 1, 2017

/approve no-issue

@jianhuiz
Copy link
Contributor Author

jianhuiz commented Sep 1, 2017

/assign @janetkuo

@kubernetes/sig-cli-maintainers
@kubernetes/sig-cli-pr-reviews

@k8s-ci-robot k8s-ci-robot added the sig/cli Categorizes an issue or PR as relevant to SIG CLI. label Sep 1, 2017
@jianhuiz jianhuiz force-pushed the kubectl-custom-colume-not-found branch from 00620d9 to 4f2894c Compare September 1, 2017 20:09
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Sep 1, 2017
@dims
Copy link
Member

dims commented Sep 5, 2017

/unassign @dims

@jianhuiz jianhuiz force-pushed the kubectl-custom-colume-not-found branch from 3756859 to 091a9df Compare September 27, 2017 18:37
@janetkuo
Copy link
Member

janetkuo commented Oct 4, 2017

/retest

@janetkuo
Copy link
Member

janetkuo commented Oct 4, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 4, 2017
@janetkuo
Copy link
Member

janetkuo commented Oct 4, 2017

/approve no-issue

@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, janetkuo, jianhuiz

Associated issue requirement bypassed by: janetkuo

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-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 4, 2017
@k8s-github-robot
Copy link

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

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 51750, 53195, 53384, 53410). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit ecfff66 into kubernetes:master Oct 5, 2017
@k8s-ci-robot
Copy link
Contributor

@jianhuiz: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
pull-kubernetes-e2e-kops-aws 091a9df link /test pull-kubernetes-e2e-kops-aws

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

openshift-merge-robot added a commit to openshift/origin that referenced this pull request Oct 25, 2017
Automatic merge from submit-queue (batch tested with PRs 16885, 17023).

UPSTREAM: 51750: output `<none>` for colums not found

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1505796

Picks changes introduced in kubernetes/kubernetes#51750
to allow the custom-columns to succeed / print all known column values even when
an object's field does not exist.

**Before**
```
$ oc get dc mydc -o custom-columns=NAME:.metadata.name,UNKNOWN:.metadata.unknown
error: unknown is not found
```

**After**
```
$ oc get dc mydc -o custom-columns=NAME:.metadata.name,UNKNOWN:.metadata.unknown
NAME      UNKNOWN
mydc      <none>
```

cc @openshift/cli-review
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 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. 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.

6 participants