kubernetes / kubernetes/kubectl
Exit code of `kubectl config delete-*` is not unified
- Dominant language
- Go
- Stars
- 3.3k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
### What happened?
Only exit code of `kubectl config delete-user` is 1
```zsh
$ 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).
```
```zsh
$ 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).
```
```zsh
$ 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
```console
$ 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
```console
$ 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)
Contributor guide
Research direction
Start by comparing staging/src/k8s.io/kubectl/pkg/cmd/config/delete_cluster.go, delete_context.go, and delete_user.go at the referenced command implementations. Reproduce the three kubectl config delete-* invocations and inspect how each command returns its error; done means their exit-code behavior is consistent with the issue's expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100