Skip to content

kubectl delete doesn't return error or print resource not found #8218

Closed

Description

@yujuhong

If you run kubectl delete resource <non_existent_resource_name>, kubectl exits with 0 and prints nothing.

E.g.

$ ./cluster/kubectl.sh delete pod abc
$ echo $?
0

I expected to see a "resource not found" message and/or an error code when this occurred. It's very misleading when you type the wrong resource name and think you delete it.

Activity

  1. added
    sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.
    on May 13, 2015
  2. liggitt commented on May 14, 2015

    @liggitt
    Member

    +1

  3. added
    priority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release.
    on May 14, 2015
  4. yujuhong commented on May 15, 2015

    @yujuhong
    ContributorAuthor
  5. self-assigned this
    on May 15, 2015
  6. bprashanth commented on May 15, 2015

    @bprashanth
    Contributor

    Personally i would prefer an fprintf and no error on 404 for delete

  7. j3ffml commented on May 15, 2015

    @j3ffml
    Contributor

    I'm with @yujuhong on this; it should both print an error and exit nonzero, at least by default. I'm happy to add a --ignore-not-found flag for users who want 404s to be silent.

  8. bprashanth commented on May 15, 2015

    @bprashanth
    Contributor

    I'm happy to add a --ignore-not-found flag for users who want 404s to be silent.

    I don't care about it that much :)
    Just that if i was scripting some cron like thing to delete periodically I would like an event or email or some such if deletion failed, but not if the thing is already deleted. I suppose one could always regex the error message or examine the error code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/kubectlpriority/important-soonMust be staffed and worked on either currently, or very soon, ideally in time for the next release.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions