-
Notifications
You must be signed in to change notification settings - Fork 41
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
Intercept any API/Kind #185
Comments
Thanks for submitting a feature request, we really appreciated it! Let me explain the root cause behind I guess we found a smart and non-opinionated way to solve this and we were lucky (or good at, still unsure) on designing Capsule to overcome the list of owned Namespace resources: since all the Namespace resources are labeled with the key-value Besides that, we overcame also the limitations of other cluster-scoped resources used by Tenant resources, such as PriorityClass, Node, IngressClass, and StorageClass, although with a limitation: these must be labeled with their name. The limitation is that we're using the Kubernetes API Server filtering capabilities in order to proxy-pass the requests and get two birds with one stone. Finally, with more context, I can try to provide further analysis on the requested feature. Retrieving a Namespaced-scope resource for a specific Namespace is easy, we just need to issue When trying to retrieve resources at the cluster-wide level the flag There's no way to retrieve resources in two or more specific Namespaces due to the API design: a workaround could be using the fields selector that allows using the key A possible solution for this would be implementing a response writer as the API Server would do, and this is tracked in #57: @MaxFedotov was working on that and encountered several issues, mostly because of all the filtering, listing, and methods must be re-implemented. I don't have any idea on how to nail the requested feature according to the current design of |
Hi Dario, Thanks for your fast response. I am aware of your named points, let me elaborate on my use case a bit more: We are currently trying to bootstrap a tekton dashboard as tenant feature (). The tekton dashboard is very simplistic since it just forwards requests. If you want to see the overview of all tasks, it tries to query This is only speaking for namespaced resources as of now. Let me show you what i have tried so far (with my very limited experience): I have added a new module called It's basically the same as the namespace module, but allows as parameter to give any kind. The idea is to check the namespace of the kind with those which are allowed by the capsuleConfiguration. Here's the iteration which would add any additional interceptor: oliverbaehler@55ecf7e#diff-abd7ed06d2e103da6501fbaf553c64d33d62628dd46621aa8fbaab8452dac7f7 the dicts are just for testing, i would get it via the capsuelConfiguration https://github.com/oliverbaehler/capsule/blob/master/api/v1alpha1/capsuleconfiguration_types.go#L25 So if I create an object like this:
It works:
So I would just need to change the selector to Sorry I might be completely wrong .. (https://www.youtube.com/watch?v=rR4n-0KYeKQ) |
So I guess really the only solution would be to tag resources with the namespace as label the live in? Do you think that makes sense? |
Yes, unfortunately we cannot list with complex query against With that said, labelling resources with their tenant name is mandatory, we can plan a feature! |
Hi @prometherion. I could use your opinion on this one. I would have added the following configuration Option to the
But I don't know if it makes sense to add it to the How would you approach this? About labeling: I would have approached this with a kyverno policy, or were you thinking about adding this to capsule, so capsule would label all resources which are in a tenant namespace with the namespace's name? Would be nice as well. |
If I understood correctly, you would like to put in place a |
BTW, since the last effort with #196, wondering if we should provide this feature taking advantage of CRDs: what are your thoughts about this, @oliverbaehler? The rationale behind this proposal is to decouple Capsule Proxy features from Capsule. |
@prometherion Thanks for the feedback Use-CasesI think we need to differ the use-cases based on if a resource if namespaced or not Cluster Scoped ResourcesThe currently implemented option to proxy permissions to cluster scoped resources. So #196 makes sense to me. Here it would be interesting to add the capability to proxy any other cluster scoped resource (eg
Would be interesting if we could also add a label selector to each of the settings, what do you think?
Namespace Scoped ResourcesWe have some crd, which are not cluster scoped, that end users want to be able to list, and where we don't necessary need to map proxySettings but just let them access the not namespaced api endpoint of that resource. They then get returned what they are allowed to see but for me it's not required to assign certain resources to users. But that's just how I think about it. It comes from our devs which ask me:
Since we don't need to map cluster scoped resources, but just allow list operations for for namespaced resources, I think it makes sense to configure these on the capsule-proxy instance level, instead of having something like a CombiningWe should think of a good combination of both features could be a huge win. Here's my very amateur attempt for a draft:
I hope it makes some sense what I am trying to say.. :D |
I would simply start by adding a Option for |
I would change the scope of this feature to just by default intercept all namespaced resources. My best idea right now is:
Not sure if this works but I will give it at try :D |
@oliverbaehler @prometherion This sounds like it would solve some limitations we're hitting with Capsule/Capsule Proxy, mainly where we have a team that wants to develop a k8s operator. Right now what is happening is folks are developing using kubebuilder and everything of course works fine on kind, but then they come to a cluster with Capsule on it and they no longer have access to cluster-scoped get/list/watch/etc so are faced with re-writing a bunch of code to process namespaces individually. Ideally we want them to be able to have the same experience they can have on their own local cluster but limited to only their namespaces. It sounds like this work would help get us towards that? Let us know if you need any help/input :) |
Hi @carpenterm, i have a working draft. But we need to make the code a bit more production ready. I havent had time lately but we are working on it. |
We talked to some of our developers and they ask why they can't execute commands like
kubectl get task -A
(Tekton Task CR) an just get all the tasks they have access to with that command.And i thought it would be a great feature to dynamically configure which resources are intercepted for which users. For example something like this:
So as little as I understand from the code it would be difficult to change the implementation for the currently proxied resources/modules. However that's why I added an
api
field so we could differ between supported modules and a generic api and kind. Those we would have to handle differently.Before trying to create a solution I wanted to hear your opinions. For us this would help improve the customer experience tremendously and we need something like that in place.
The text was updated successfully, but these errors were encountered: