mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Merge pull request #30630 from silasbw/short-n0
Automatic merge from submit-queue Add a short `-n` for `kubectl --namespace` fixes #24078 `--namespace` is a very common flag for nearly every `kubectl` command we have. We should claim `-n` for it.
This commit is contained in:
commit
d40e2296b2
@ -142,6 +142,7 @@ list when adding new short flags
|
|||||||
|
|
||||||
* `-f`: Resource file
|
* `-f`: Resource file
|
||||||
* also used for `--follow` in `logs`, but should be deprecated in favor of `-F`
|
* also used for `--follow` in `logs`, but should be deprecated in favor of `-F`
|
||||||
|
* `-n`: Namespace scope
|
||||||
* `-l`: Label selector
|
* `-l`: Label selector
|
||||||
* also used for `--labels` in `expose`, but should be deprecated
|
* also used for `--labels` in `expose`, but should be deprecated
|
||||||
* `-L`: Label columns
|
* `-L`: Label columns
|
||||||
|
@ -1399,6 +1399,8 @@ __EOF__
|
|||||||
kubectl create "${kube_flags[@]}" --namespace=other -f docs/admin/limitrange/valid-pod.yaml
|
kubectl create "${kube_flags[@]}" --namespace=other -f docs/admin/limitrange/valid-pod.yaml
|
||||||
# Post-condition: valid-pod POD is created
|
# Post-condition: valid-pod POD is created
|
||||||
kube::test::get_object_assert 'pods --namespace=other' "{{range.items}}{{$id_field}}:{{end}}" 'valid-pod:'
|
kube::test::get_object_assert 'pods --namespace=other' "{{range.items}}{{$id_field}}:{{end}}" 'valid-pod:'
|
||||||
|
# Post-condition: verify shorthand `-n other` has the same results as `--namespace=other`
|
||||||
|
kube::test::get_object_assert 'pods -n other' "{{range.items}}{{$id_field}}:{{end}}" 'valid-pod:'
|
||||||
|
|
||||||
### Delete POD valid-pod in specific namespace
|
### Delete POD valid-pod in specific namespace
|
||||||
# Pre-condition: valid-pod POD exists
|
# Pre-condition: valid-pod POD exists
|
||||||
|
@ -158,7 +158,7 @@ func RecommendedContextOverrideFlags(prefix string) ContextOverrideFlags {
|
|||||||
return ContextOverrideFlags{
|
return ContextOverrideFlags{
|
||||||
ClusterName: FlagInfo{prefix + FlagClusterName, "", "", "The name of the kubeconfig cluster to use"},
|
ClusterName: FlagInfo{prefix + FlagClusterName, "", "", "The name of the kubeconfig cluster to use"},
|
||||||
AuthInfoName: FlagInfo{prefix + FlagAuthInfoName, "", "", "The name of the kubeconfig user to use"},
|
AuthInfoName: FlagInfo{prefix + FlagAuthInfoName, "", "", "The name of the kubeconfig user to use"},
|
||||||
Namespace: FlagInfo{prefix + FlagNamespace, "", "", "If present, the namespace scope for this CLI request"},
|
Namespace: FlagInfo{prefix + FlagNamespace, "n", "", "If present, the namespace scope for this CLI request"},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user