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

kubectl should return more information on failure #6132

Closed
thockin opened this issue Mar 28, 2015 · 12 comments
Closed

kubectl should return more information on failure #6132

thockin opened this issue Mar 28, 2015 · 12 comments
Labels
area/kubectl area/usability lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/cli Categorizes an issue or PR as relevant to SIG CLI.

Comments

@thockin
Copy link
Member

thockin commented Mar 28, 2015

After making a kubectl create call with bad JSON, kubectl would read-back the master's understanding of what I wrote and show me a diff. Something like that

@davidopp davidopp added priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Mar 28, 2015
@bgrant0607
Copy link
Member

Have you tried --validate, which reads the swagger?

diff and dry-run are already in cli-roadmap.md.

@bgrant0607
Copy link
Member

See also #5889 and #6284.

@bgrant0607 bgrant0607 added priority/backlog Higher priority than priority/awaiting-more-evidence. area/usability and removed priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. labels Jun 30, 2015
@bgrant0607
Copy link
Member

Another case where more info is desired on failure is update failure. Somewhere we discussed returning the whole object on conflict, for instance. A related discussion is #9569 (comment)
cc @smarterclayton @lavalamp

@bgrant0607 bgrant0607 changed the title idea: kubectl [get update] --read-back flag kubectl should return more information on failure Jul 1, 2015
@bgrant0607
Copy link
Member

Related: #8668

@smarterclayton
Copy link
Contributor

I would prefer to have this behavior by default for our error object if we
can - it's a big performance win and reduces client annoyance.

On Jul 1, 2015, at 5:30 PM, Brian Grant notifications@github.com wrote:

Another case where more info is desired on failure is update failure.
Somewhere we discussed returning the whole object on conflict, for
instance. A related discussion is #9569 (comment)
#9569 (comment)
cc @smarterclayton https://github.com/smarterclayton @lavalamp
https://github.com/lavalamp


Reply to this email directly or view it on GitHub
#6132 (comment)
.

@bgrant0607 bgrant0607 added this to the v1.2-candidate milestone Sep 12, 2015
@bgrant0607 bgrant0607 added team/ux and removed sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Sep 16, 2015
@bgrant0607 bgrant0607 removed this from the next-candidate milestone Apr 28, 2016
@k8s-github-robot
Copy link

@thockin There are no sig labels on this issue. Please add a sig label by:
(1) mentioning a sig: @kubernetes/sig-<team-name>-misc
(2) specifying the label manually: /sig <label>

Note: method (1) will trigger a notification to the team. You can find the team list here.

@k8s-github-robot k8s-github-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label May 31, 2017
@0xmichalis
Copy link
Contributor

@kubernetes/sig-cli-misc

@k8s-ci-robot k8s-ci-robot added the sig/cli Categorizes an issue or PR as relevant to SIG CLI. label Jun 2, 2017
@0xmichalis 0xmichalis removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. team/ux (deprecated - do not use) labels Jun 2, 2017
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 26, 2017
@bgrant0607
Copy link
Member

/remove-lifecycle stale
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 22, 2018
@brianpursley
Copy link
Member

Hi @thockin, @smarterclayton, @bgrant0607
This issue has been open for a while, so I'm just checking to see if it is still an issue or not in the latest version.

It looks like there currently are some useful error messages given when there are problems with the json. Do you think these are sufficient or is something more detailed needed?

Here is what I tried, using kubectl v1.18.0:


Test 1: Invalid json (removed " before metadata)

kubectl create -f - << EOF
{
    "kind": "Pod",
    "apiVersion": "v1",
    metadata": {
        "name": "nginx"
    },
    "spec": {
        "containers": [
            {
                "name": "nginx",
                "image": "nginx"
            }
        ],
        "restartPolicy": "Never"
    }
}
EOF
error: error parsing STDIN: json: line 3: invalid character 'm' looking for beginning of object key string

Test 2: Json is valid but does not conform (changed spec to xspec)

kubectl create -f - << EOF
{
    "kind": "Pod",
    "apiVersion": "v1",
    "metadata": {
        "name": "nginx"
    },
    "xspec": {
        "containers": [
            {
                "name": "nginx",
                "image": "nginx"
            }
        ],
        "restartPolicy": "Never"
    }
}
EOF
error: error validating "STDIN": error validating data: ValidationError(Pod): unknown field "xspec" in io.k8s.api.core.v1.Pod; if you choose to ignore these errors, turn validation off with --validate=false

@bgrant0607
Copy link
Member

Thanks. I think we can close this.
/close

@k8s-ci-robot
Copy link
Contributor

@bgrant0607: Closing this issue.

In response to this:

Thanks. I think we can close this.
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubectl area/usability lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/backlog Higher priority than priority/awaiting-more-evidence. sig/cli Categorizes an issue or PR as relevant to SIG CLI.
Projects
None yet
Development

No branches or pull requests

9 participants