Skip to content

Commit e6765ff

Browse files
committed
fix(rbac): grant kubeadm bootstrap SA read on KamajiControlPlane (CAPI v1.14.0)
Signed-off-by: Victor Hang <victor@stackhpc.com>
1 parent fd74107 commit e6765ff

3 files changed

Lines changed: 57 additions & 0 deletions

File tree

config/control-plane-components.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15394,6 +15394,27 @@ subjects:
1539415394
name: capi-kamaji-controller-manager
1539515395
namespace: kamaji-system
1539615396
---
15397+
apiVersion: rbac.authorization.k8s.io/v1
15398+
kind: ClusterRoleBinding
15399+
metadata:
15400+
labels:
15401+
app.kubernetes.io/component: rbac
15402+
app.kubernetes.io/created-by: cluster-api-control-plane-provider-kamaji
15403+
app.kubernetes.io/instance: manager-rolebinding
15404+
app.kubernetes.io/managed-by: kustomize
15405+
app.kubernetes.io/name: clusterrolebinding
15406+
app.kubernetes.io/part-of: cluster-api-control-plane-provider-kamaji
15407+
cluster.x-k8s.io/provider: kamaji
15408+
name: capi-kamaji-capi-kamaji-control-plane-kubeadm-bootstrap-rolebinding
15409+
roleRef:
15410+
apiGroup: rbac.authorization.k8s.io
15411+
kind: ClusterRole
15412+
name: capi-kamaji-capi-kamaji-control-plane-role
15413+
subjects:
15414+
- kind: ServiceAccount
15415+
name: capi-kubeadm-bootstrap-manager
15416+
namespace: capi-kubeadm-bootstrap-system
15417+
---
1539715418
apiVersion: apps/v1
1539815419
kind: Deployment
1539915420
metadata:
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# As of Cluster API v1.14.0 (kubernetes-sigs/cluster-api#13433, "Write kubeadm
2+
# control plane version file for workers to use to fetch the matching kubeadm
3+
# binary") the kubeadm bootstrap controller resolves the control-plane Kubernetes
4+
# version by reading the object referenced by `Cluster.spec.controlPlaneRef`.
5+
# When a Cluster uses a KamajiControlPlane, the bootstrap controller issues a
6+
# `get kamajicontrolplanes.controlplane.cluster.x-k8s.io`, which otherwise fails
7+
# with:
8+
# failed to read control plane version: ... kamajicontrolplanes... is forbidden:
9+
# User "system:serviceaccount:capi-kubeadm-bootstrap-system:capi-kubeadm-bootstrap-manager"
10+
# cannot get resource "kamajicontrolplanes" in API group "controlplane.cluster.x-k8s.io"
11+
#
12+
# The bootstrap controller reads via an APIReader (no /status), so the
13+
# get/list/watch rules already present in capi_role.yaml are sufficient; we bind
14+
# that same ClusterRole to the kubeadm bootstrap manager ServiceAccount.
15+
apiVersion: rbac.authorization.k8s.io/v1
16+
kind: ClusterRoleBinding
17+
metadata:
18+
labels:
19+
app.kubernetes.io/name: clusterrolebinding
20+
app.kubernetes.io/instance: manager-rolebinding
21+
app.kubernetes.io/component: rbac
22+
app.kubernetes.io/created-by: cluster-api-control-plane-provider-kamaji
23+
app.kubernetes.io/part-of: cluster-api-control-plane-provider-kamaji
24+
app.kubernetes.io/managed-by: kustomize
25+
name: capi-kamaji-control-plane-kubeadm-bootstrap-rolebinding
26+
roleRef:
27+
apiGroup: rbac.authorization.k8s.io
28+
kind: ClusterRole
29+
name: capi-kamaji-control-plane-role
30+
subjects:
31+
- kind: ServiceAccount
32+
name: capi-kubeadm-bootstrap-manager
33+
namespace: capi-kubeadm-bootstrap-system

config/rbac/kustomization.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ resources:
1313
# as well as to read the instance statuses.
1414
- capi_role.yaml
1515
- capi_role_binding.yaml
16+
# Since Cluster API v1.14.0 the kubeadm bootstrap controller reads the
17+
# KamajiControlPlane to resolve the control-plane version (upstream #13433).
18+
- capi_kubeadm_bootstrap_role_binding.yaml

0 commit comments

Comments
 (0)