Skip to content

✨ Add kubeadm cluster role - #24

Merged
abhay-nutanix merged 2 commits into
release-1.10.10from
issue/clusterRoleBinding
Aug 14, 2026
Merged

abhay-nutanix merged 2 commits into
release-1.10.10from
issue/clusterRoleBinding

Conversation

@abhay-nutanix

Copy link
Copy Markdown

This PR backports kubeadm RBAC permission reconciliation to control plane upgrade paths by introducing/ensuring the kubeadm cluster role bindings needed during version transitions.

How was this tested

  1. Build and Prepare Controller Images
    Build Targets: Compiled the CAPI core, Kubeadm bootstrap, Kubeadm control plane (KCP), and Docker infrastructure (CAPD) controller manager binaries into local container images using make.

Tag Matching: Retagged local container images to match the exact versions expected by the local repository templates and manifests (e.g., local.test/capi/...:v1.10.99 and :v1.10.x-dev).

  1. Set Up the Management Cluster (Kind)
    Docker Socket Mounting: Configured a Kind cluster definition (kind-cluster-with-docker.yaml) with /var/run/docker.sock mounted into the node so CAPD could manage Docker containers directly on the host.

Preloading Images: Loaded all built container images directly into the Kind cluster (kind load docker-image ... --name capi-mgmt).

Provider Initialization: Initialized Cluster API using ./bin/clusterctl init pointing to the local repository (infrastructure-docker, kubeadm-control-plane, kubeadm-bootstrap, and cluster-api).

Image Pull Policy Patching: Patched all four controller deployments to imagePullPolicy: IfNotPresent to prevent Kubernetes from attempting to pull non-existent local.test URLs over the network.

  1. Local Repository Setup & Manifest Generation
    Template Setup: Copied required cluster definitions and ClusterClasses (cluster-template-development.yaml as cluster-template.yaml and clusterclass-quick-start.yaml) into the local provider repository path (~/.cluster-api/overrides/ / local-repository/).

Workload Cluster Manifest Generation: Generated and applied the test cluster YAML using:

./bin/clusterctl generate cluster test-docker \
  --infrastructure docker \
  --kubernetes-version v1.30.0 \
  --control-plane-machine-count 1 \
  --worker-machine-count 1 | kubectl apply -f -
  1. Workload Cluster Networking & Host Access
    Kubeconfig Retrieval: Extracted the workload cluster kubeconfig using ./bin/clusterctl get kubeconfig test-docker > test-docker.kubeconfig.

Port-Forwarding Adjustment: Replaced the unreachable internal Docker container IP (172.18.0.x:6443) in the kubeconfig with the host port exposed by test-docker-lb on Docker Desktop (e.g., 127.0.0.1:55000).

CNI Installation: Applied Calico to the workload cluster to allow nodes to transition to Ready and initialize system pods.

  1. Final PR Testing & Verification
    Unit Testing: Ran package-level tests via go test for workload_cluster_rbac_test.go to test RBAC logic in isolation.

Workload Cluster Inspection: Verified the creation of kubeadm-managed ClusterRoles and ClusterRoleBindings (such as kubeadm:cluster-admins introduced in PR kubernetes-sigs#13664) directly on the workload cluster.

Drift / Self-Healing Test: Deleted the managed RBAC object (kubeadm:cluster-admins) from the workload cluster, triggered a KCP reconciliation loop on the management cluster, and verified that KCP successfully restored the deleted resource.

@abhay-nutanix abhay-nutanix changed the title Add kubeadm cluster role ✨ Add kubeadm cluster role Aug 14, 2026
}

parsedVersionForPermissions, err := semver.ParseTolerant(controlPlane.KCP.Spec.Version)
if err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we check for nil

Management: &internal.Management{Client: env},
Workload: &fakeWorkloadCluster{
Status: internal.ClusterStatus{Nodes: 1},
Workload: &internal.Workload{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

@abhay-nutanix
abhay-nutanix merged commit b4e6939 into release-1.10.10 Aug 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants