Skip to content

WIP - Shard bootstrapping#86

Closed
xrstf wants to merge 8 commits intokcp-dev:mainfrom
xrstf:shard-bootstrapping
Closed

WIP - Shard bootstrapping#86
xrstf wants to merge 8 commits intokcp-dev:mainfrom
xrstf:shard-bootstrapping

Conversation

@xrstf
Copy link
Copy Markdown
Contributor

@xrstf xrstf commented Aug 26, 2025

Summary

We want to provision RBAC rules for kubeconfigs. For that the idea is to connect to the kubeconfig's target (shard, rootshard or front-proxy) and create the Kube objects that way. This allows the operator to profit from the front-proxy's shard resolving capabilities (so that a Kubeconfig that targets a front-proxy can ask to provision RBAC in any workspace).

However the front-proxy will remove the system:masters group from the authInfo, so when we rely on it, we could not connect through a front-proxy to a shard and still be authorized to do anything.

To solve this, this PR adds a new bootstrapping controller that will place a ClusterRole and ClusterRoleBinding on each shard's system:admin cluster. This gives anyone named system:kcp-operator permissions to do what we need to do (atm this is nothing, but once the RBAC-for-kubeconfig stuff is implemented, we need to be allowed to create CR/CRBs in every possible workspace).

A new condition on Shards and RootShards informs users about the status of the bootstrapping. This will be important for the kubeconfig controller, so it can defer provisioning RBAC if bootstrapping hasn't completed yet.

To gain access to perform this bootstrapping, a single new client cert is created, which is owned by the RootShard. Since all shards use the same ClientCA, they will all accept it.

What Type of PR Is This?

/kind feature

Release Notes

The kcp-operator will provision a ClusterRoleBinding on each shard's `system:admin` cluster to give itself permissions to manage shards. This introduces the `system:kcp-operator` username that is bound to a `system:kcp-operator` ClusterRole.

xrstf added 6 commits August 26, 2025 19:22
This is to bootstrap the necessary RBAC on each shard to allow other controllers in the operator to
perform their actions *even if they have to go through a front-proxy that drops system:masters*.

On-behalf-of: @SAP christoph.mewes@sap.com
On-behalf-of: @SAP christoph.mewes@sap.com
On-behalf-of: @SAP christoph.mewes@sap.com
On-behalf-of: @SAP christoph.mewes@sap.com
@kcp-ci-bot kcp-ci-bot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has signed the DCO. labels Aug 26, 2025
@kcp-ci-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from xrstf. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Aug 26, 2025
On-behalf-of: @SAP christoph.mewes@sap.com
@xrstf
Copy link
Copy Markdown
Contributor Author

xrstf commented Aug 26, 2025

/retest

@xrstf xrstf mentioned this pull request Aug 27, 2025
@xrstf xrstf closed this Sep 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants