-
Notifications
You must be signed in to change notification settings - Fork 705
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
Remove unused DisableAuth from kubeops. Add decorator for user perms. #1453
Remove unused DisableAuth from kubeops. Add decorator for user perms. #1453
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You fell in the trap of adding different things to the same PR :P
The changes for removing the DisableAuth
setting for kubeops LGTM. Approving this PR in case you want to merge that part.
I have some concerns though about the decorator. Let me elaborate:
- The auth checker is something that was mandatory when working with Helm 2. Now that with Helm 3 we are using the user serviceaccount it should not be necessary. That obviously means less code for us to maintain (even though the code is already written, we would still need to apply fixes).
- We may mask the real error. For example, when installing something without write permissions, Helm returns the error that the user cannot create
secrets
in the namespace (because the release info is stored as asecret
) but we would return the list of elements related to the chart. We could fix that and also check if the user can create secrets, but then it's also possible to use other storage mechanisms like ConfigMaps or in memory, that would complicate our code more. If Helm changes the behavior we would need to adapt to them. As a summary, it would be more prone to errors. - In addition to the second point, I haven't checked yet but maybe if the user has permissions to create secrets, Helm 3 already returns all the permissions that the user need to deploy the chart, I will investigate that. If that is the case, it's just a matter from us to prettify the result from Helm.
I did... I thought I'd just try investigating bit further, then invested enough time for the sunk cost fallacy to kick in :)
Great, will do. Reverting the extra commit, but comments below.
Correct, it's not necessary, but...
the question is whether the benefit of the clean feedback to the user, which we already have, is worth keeping.
If the list of elements related to that chart require write access, that would not be masking the real error, but rather not showing all the errors, I think? Once RBAC is updated with correct perms for those other resources, you'd still see the helm error about being unable to create the secret (if we didn't also check that, which I think we would as you've mentioned).
I don't think it would. It is Kubeapps that needs to configure the driver when interacting with Helm, so it's trivial to add that resource (ie. Secret or ConfigMap currently).
The only behaviour Helm could change which would affect us is if they changed the default driver and we were using the default (which we do currently), which is both an unlikely decision for helm and easy to change at our end (we'd just be explicit with the driver, and updated when we decide). So yes, it's a little more code (which is already written for the helm2 work) to maintain, I honestly think it's just whether the detailed required RBAC perms is a benefit to keep.
Nice - that would be better, letting helm do the work. |
Let me investigate the error message and check if Helm already does the work for us. I will open an issue/PR with more info. |
Description of the change
Removes an unused field from the kubeops handler tests and renamed to clarify the same in tiller-proxy.
EDIT: second commit reverted, so following is not included.
I then got thinking, from an earlier review (see #1450 ) about how we could decorate the handler functions with the permission check, enabling the handler tested separately from the user permission checks etc. rather than the way it is included individually to each handler in tiller-proxy. So I've sketched that out here.
It is landable (if you agree with the direction) as the decorator isn't yet applied, but may not be worth landing unless someone wants to continue it today. I can do the remaining work tomorrow if no one is interested :)
Benefits
Sets up the
UserPermissionChecks
decorator so that we can have the same detail in the UI as per Andres' "Drawbacks" screenshots at #1450 .Once generating the manifests via helm3 is added (see the TODO), the decorator should be able to be applied like:
Applicable issues
Related to comment at #1450 (review)
cc @latiif @SimonAlling