Unlike many (most?) other kubectl create commands, kubectl create role ignores --namespace (-n).
This can result in unexpected/undesirable behaviour when e.g. piped to kubectl apply -f -, where the role is created in the wrong namespace (i.e. the default one).
Example command:
kubectl -n foo-ns create role foo-role --verb=list --resource=pods --dry-run=true -o yaml
Actual:
kind: Role
metadata:
creationTimestamp: null
name: foo-role
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- list
Expected:
kind: Role
metadata:
creationTimestamp: null
name: foo-role
namespace: foo-ns
rules:
- apiGroups:
- ""
resources:
- pods
verbs:
- list
@kubernetes/sig-cli-bugs
/area kubectl
/kind bug
/sig cli
@stephen-dexda: Reiterating the mentions to trigger a notification:
@kubernetes/sig-cli-bugs
In response to this:
@kubernetes/sig-cli-bugs
/area kubectl
/kind bug
/sig cli
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.
Is this feature actually required?
Can any maintainer acknowledge is this is an approved issue?
/help
cc @soltysh @seans3 I would like to take this.
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.
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
/remove-lifecycle stale
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.
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
/remove-lifecycle stale
The fix seems no response for a long time, I submit another PR: https://github.com/kubernetes/kubernetes/pull/90502
/assign zhouya0
/priority P2
Fixed by this PR and can be closed now.
/close
@zhouya0: Closing this issue.
In response to this:
Fixed by this PR and can be closed now.
/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.
Most helpful comment
Fixed by this PR and can be closed now.
/close