Skip to content

Exit code of kubectl config delete-* is not unified #1641

Open
@wafuwafu13

Description

@wafuwafu13

What happened?

Only exit code of kubectl config delete-user is 1

$ kubectl config delete-cluster || echo $?
Delete the specified cluster from the kubeconfig.

Examples:
  # Delete the minikube cluster
  kubectl config delete-cluster minikube

Usage:
  kubectl config delete-cluster NAME [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).
$ kubectl config delete-context || echo $?
Delete the specified context from the kubeconfig.

Examples:
  # Delete the context for the minikube cluster
  kubectl config delete-context minikube

Usage:
  kubectl config delete-context NAME [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).
$ kubectl config delete-user || echo $?
error: user to delete is required
See 'kubectl config delete-user -h' for help and examples
1

What did you expect to happen?

Exit code of kubectl config delete-user is 0

How can we reproduce it (as minimally and precisely as possible)?

Run kubectl config delete-user

Anything else we need to know?

https://github.com/kubernetes/kubernetes/blob/a87612b6676723b34a5b3d2d80ab4e04552221ae/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_cluster.go#L61-L64

https://github.com/kubernetes/kubernetes/blob/a87612b6676723b34a5b3d2d80ab4e04552221ae/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_context.go#L61-L64

https://github.com/kubernetes/kubernetes/blob/a87612b6676723b34a5b3d2d80ab4e04552221ae/staging/src/k8s.io/kubectl/pkg/cmd/config/delete_user.go#L87-L89

Kubernetes version

$ kubectl version
Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.29.4-eks-036c24b

Cloud provider

All

OS version

$ uname -a
Darwin tagawahirotakanoMacBook-Pro.local 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:12:58 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6000 arm64

Install tools

Homebrew

Container runtime (CRI) and version (if applicable)

Related plugins (CNI, CSI, ...) and versions (if applicable)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/featureCategorizes issue or PR as related to a new feature.sig/cliCategorizes an issue or PR as relevant to SIG CLI.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    Status

    Needs Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions