-
Notifications
You must be signed in to change notification settings - Fork 117
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
Rbac-manager doesn't handle the case where a namespace does not exist and is later created #53
Comments
:plus-1: on this. Here's our scenario. In a development cluster, we have automation that dynamically creates and deletes Our process is essentially:
However, step 3 does not happen. |
One possible solution: RBAC Manager could run reconciliation on a periodic schedule. My impression is that it only runs when an |
I added code as part of the 0.7.0 release that was supposed to help with this. We run a namespace controller that should trigger new reconcile loops for any RBAC Definitions with namespace selectors. If that's still not working in 0.7.0 or beyond, hopefully it's an easy fix. |
Ah ok – I was glomming on to this existing issue, but the problem I saw is sort of a subset of the original poster's issues. My issue was failure / early termination of the first reconciliation run(s) before any namespace exists matching the |
@tklovett I tested this with the latest rbac-manager and I can't seem to reproduce your issue. I have this rbac-defintion:
And I ran through this process. I checked the bindings using rbac-lookup, created a namespace, labelled it, and then I checked the bindings again. After the namespace is labelled, rbac-manager has created the desired binding.
|
If you're still seeing the issue, could you please provide your rbac-definition, your rbac-manager version, and an example of the namespace yaml that you are expecting to see the issue with? |
In addition, I tested the original issue posted here, and in fact, rbac-manager does create the service account, but creates it in the default namespace. To reproduce:
|
Still need to verify/resolve the SA getting created in the wrong NS, but the issue with the namespace not existing would be solved by #103 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I'm reopening this because I hit this again today using 0.9.3 |
Cannot reproduce |
Same is present on |
I would expect the namespace reconciler to handle the case where an rbac definition is applied that creates a service account in a namespace that doesn't exist yet. However, if I do this and then create the namespace, the serviceaccount never gets created.
Rbacdefinition:
apiVersion: rbacmanager.reactiveops.io/v1beta1
kind: RBACDefinition
metadata:
name: ci-access
rbacBindings:
subjects:
name: ci
namespace: infra
roleBindings:
namespaceSelector:
matchLabels:
team: ci-access
Log output from rbac-manager:
rbac-manager-5b796664cf-9fphp rbac-manager time="2019-05-22T14:38:44Z" level=info msg="Watching RBAC Definitions"
rbac-manager-5b796664cf-9fphp rbac-manager time="2019-05-22T14:38:57Z" level=info msg="Reconciling RBACDefinition ci-access"
rbac-manager-5b796664cf-9fphp rbac-manager time="2019-05-22T14:38:57Z" level=info msg="Creating Service Account: ci"
rbac-manager-5b796664cf-9fphp rbac-manager time="2019-05-22T14:38:57Z" level=error msg="Error creating Service Account: namespaces "infra" not found"
rbac-manager-5b796664cf-9fphp rbac-manager time="2019-05-22T14:39:02Z" level=info msg="Reconciling infra namespace for ci-access"
Commands that I issued through this process:
k apply -f rbacdefinition.yaml
k create ns infra
This was done with the latest dev version from this PR - image dev-b00465642bcb377030cad73386bcf6cf8cf565e3 and the all.yaml from this PR as well.
The text was updated successfully, but these errors were encountered: