-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
whats the canonical YAML way to add a Role and a RoleBinding for a ServiceAccount into a Template? #11566
Comments
specify a namespace in the |
thanks @liggitt So I need to do something like this...
then define the |
No,
|
Ah, the issue with not knowing the destination namespace when processing a template. |
@liggitt yeah ;) I was hoping we could get a template parameter defined for the namespace the template is being created inside; like the downward API on env vars can be used to define an env var for a namespace - but I don't see how. If the namespace is missed off the e.g. when you create a kubernetes resource there's |
you can now set the namespace field in terms of a parameter value. There is still no automatic/implicit parameter that tells you the current namespace though, you have to collect that value from the user as a parameter. Might be good enough to close this, though. |
@liggitt @smarterclayton there was not unreasonable reluctance recently (#16021) to add the capability for templates to have a defaulting NAMESPACE parameter, and I think this is the number one use case. To get the current namespace into pod environment variables, downward API (env/valueFrom/fieldRef/fieldPath/metadata.namespace) can be used. Would it be possible to add an equivalent to the RoleBinding roleRef field? It would probably mean we could do away with having NAMESPACE as a parameter in quite a lot of templates. |
@jorgemoralespou fyi |
If you target 3.7+, you can use kubernetes RBAC objects for roles/bindings, and when specifying a roleRef, you must specify kind of ClusterRole or Role, and a ref to a Role is automatically to the rolebinding's namespace |
This already works on 3.4+ - use the ref with no namespace and kind service
account.
On Sep 12, 2017, at 6:30 PM, Jordan Liggitt <notifications@github.com> wrote:
If you target 3.7+, you can use native RBAC objects for roles/bindings, and
when specifying a roleRef, you must specify kind of ClusterRole or Role,
and a ref to a Role is automatically to the rolebinding's namespace
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#11566 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_pwmh3OePgS1hbCft2sTuSfdaXDDKks5shwYEgaJpZM4KgPr_>
.
|
sounds closeable. |
@smarterclayton I'm not following - doesn't that just avoid the need to specify the namespace of the SA? I'm talking about the namespace of the Role. Every time I don't specify it, OpenShift interprets it as meaning a ClusterRole. |
Right. The kube RBAC types specify |
A bit unclear to me. Anyone verified this pre 3.7? We're on 3.6 and the following does not work without specifying the namespace:
|
@anderssv On 3.7 I still need to specify |
Hi @jstrachan, can you help with my case?) Full code:
|
I've seen how to add roles via the CLI, but how should we define the required
Role
andRoleBinding
for aServiceAccount
inside an OpenShift Template?I could create a role OK:
then struggled to refer to the role in the
RoleBinding
Is there a way to refer to a role in the current namespace? I've seen
system:admin
to refer to global roles but haven't seen the magic prefix to refer to a local role inside a namespace.Any ideas?
The text was updated successfully, but these errors were encountered: