Replies: 5 comments 7 replies
-
Chiming in with a use case here. We're building an internal developer platform for a pretty large enterprise. Our users (application developers) declaratively specify that they have a "system" by creating a configuration file in a central repo. In there they specify some fundamental aspects of their system, such as ownership, what environments it has (prod, staging, etc.), in what regions they want to deploy their services, what cloud vendor they need to use. Given this we want to create one KCP workspace per environment and make sure that the relevant APIs are available there. We don't want our users to have to understand KCP concepts, to them it should just look like they are getting their own k8s cluster with a few less standard resources and a set of custom resources. It's worth noting that creating this system configuration results in more things happening, e.g. the system gets registered in our software catalog and becomes visible in out developer portal, etc. |
Beta Was this translation helpful? Give feedback.
-
I have not thought through the details of permissions carefully yet, but we are doing this in the mailbox controller in edge-mc. See the run-through in https://github.com/kcp-dev/edge-mc/blob/main/docs/poc2023q1/mailbox-controller.md , recently successfully tested against v0.11.0 of kcp-dev/kcp. It runs the mailbox controller as the user in the current context of the admin.kubeconfig created by |
Beta Was this translation helpful? Give feedback.
-
I don't understand this: |
Beta Was this translation helpful? Give feedback.
-
Thank you @ncdc for opening this issue, I really appreciate the openness of the team in discussing this use case and sharing the internals of how the system works.
We are still defining requirements and learning what we can do, but also in our case we are currently playing around with the idea of offering “workspace as a service”; as per the discussion thread we can describe it also as a “a higher-level button for creating a workspace” or “some sort of catalog / workspace builder wizard that spits out a kubeconfig with APIs preconfigured”.
I'm not sure I fully grasp yet what workspace ownership entails, but I think that a mechanism to specify the ownership for the workspace being created makes sense not only for controllers. For humans, think e.g. platform administrators, it means they can create orgs or high-level workspaces and then end-over ownership to someone else. For controllers, it could be a very specific and explicit way out of the service account restriction, which makes sense per se but in this specific use case it is limiting how we can programmatically control the system. If I try to think about what we want the ownership to be set to, I can think at two models: one, with ownership always assigned to a highly privileged user, which is probably ok only for single-tenant deployments/less complex organizations, or another model when you can programmatically assign ownership to different users. |
Beta Was this translation helpful? Give feedback.
-
@yhrn @fabriziopandini @lionelvillard I'm writing a KEP for |
Beta Was this translation helpful? Give feedback.
-
We are starting to get a few requests to be able to create workspaces programmatically, from controllers that talk to an APIExport view where the export claims Workspaces and the binding accepts the claim. This poses some challenges, such as:
system:kcp:admin
group. When creating a workspace this way, the new workspace's owner annotation lists this service account as the owner. But, the service account is in the parent workspace, and we do not allow service accounts to operate outside of their own workspace. This means that workspace initialization cannot succeed, because that flow impersonates the workspace owner to perform actions. Because the owner is a service account in a different workspace, this impersonation is always rejected by the authorization chain.We do not want to change the restriction that a service account may only operate inside its workspace. Therefore, we need to come up with some new ideas for how to resolve this.
When we thought about workspace creation initially, we assumed it would be something that the user (an actual human) would do, mainly because there are aspects such as what's described above related to workspace ownership and permissions that are required for workspace initialization.
For folks interested in programmatically creating workspaces, we'd love to hear your use cases. Especially details around ownership, given that you want to have a controller create workspaces for users.
cc @fabriziopandini @yastij
Beta Was this translation helpful? Give feedback.
All reactions