Skip to content

Commit 79c0a29

Browse files
authored
[release-1.27] [occm] Use standard service account name in OCCM helm chart (kubernetes#2448)
* Use standard service account name in OCCM helm chart (kubernetes#2332) This removes the `openstack-` prefix from the service account name used by the cloud-controller-manager and moves the default values into the values file. The change is motivated by the following: - Create suitable service accounts, cluster roles and cluster role bindings for use with `--use-service-accounts-credentials=true` - Normalise service account names in the helm chart and plain manifests - Adhere to naming conventions across external cloud controller managers for different clouds (e.g. AWS, GCP, ...) Specifically the first point deserves further details. Prior to this change, users who install the cloud controller manager with helm, would run into the following error when creating load balancers: ``` E0818 08:27:33.802407 11 controller.go:291] error processing service default/hello-bug (will retry): failed to ensure load balancer: failed to patch service object default/hello-bug: services "hello-bug" is forbidden: User "system:serviceaccount:kube-system:cloud-controller-manager" cannot patch resource "services" in API group "" in the namespace "default" ``` Which is due to the fact that the controller is running with the `cloud-controller-manager` service account because `--use-service-account-credentials` is set to `true` by default and the client is initialised with: ``` clientset := clientBuilder.ClientOrDie("cloud-controller-manager") ``` Whilst users can work around this by passing `--use-service-account-credentials=false`, the desired behaviour would be to install suitable RBAC in the first place. See: - https://kubernetes.io/docs/concepts/architecture/cloud-controller/ - https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/ - kubernetes#2049 - kubernetes#1722 - kubernetes#1755 Signed-off-by: Wolodja Wentland <[email protected]> * Remove spurious whitespace in OCCM values file (kubernetes#2347) The space character was sadly introduced in an earlier PR and had not been picked up by the helm linter, presumably because the GHA did not run. Signed-off-by: Wolodja Wentland <[email protected]> --------- Signed-off-by: Wolodja Wentland <[email protected]> Signed-off-by: Wolodja Wentland <[email protected]>
1 parent f7abe10 commit 79c0a29

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed

charts/openstack-cloud-controller-manager/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Openstack Cloud Controller Manager Helm Chart
44
icon: https://object-storage-ca-ymq-1.vexxhost.net/swift/v1/6e4619c416ff4bd19e1c087f27a43eea/www-images-prod/openstack-logo/OpenStack-Logo-Vertical.png
55
home: https://github.com/kubernetes/cloud-provider-openstack
66
name: openstack-cloud-controller-manager
7-
version: 2.27.5
7+
version: 2.27.6
88
maintainers:
99
- name: eumel8
1010

charts/openstack-cloud-controller-manager/templates/clusterrole.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4-
name: system:openstack-cloud-controller-manager
4+
name: {{ .Values.clusterRoleName }}
55
annotations:
66
{{- with .Values.commonAnnotations }}
77
{{- toYaml . | nindent 4 }}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
---
12
apiVersion: rbac.authorization.k8s.io/v1
23
kind: ClusterRoleBinding
34
metadata:
4-
name: system:openstack-cloud-controller-manager
5+
name: {{ .Values.clusterRoleName }}
56
annotations:
67
{{- with .Values.commonAnnotations }}
78
{{- toYaml . | nindent 4 }}
89
{{- end }}
910
roleRef:
1011
apiGroup: rbac.authorization.k8s.io
1112
kind: ClusterRole
12-
name: system:openstack-cloud-controller-manager
13+
name: {{ .Values.clusterRoleName }}
1314
subjects:
1415
- kind: ServiceAccount
15-
name: openstack-cloud-controller-manager
16+
name: {{ .Values.serviceAccountName }}
1617
namespace: {{ .Release.Namespace | quote }}

charts/openstack-cloud-controller-manager/templates/daemonset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ spec:
3939
tolerations:
4040
{{- toYaml . | nindent 8 }}
4141
{{- end }}
42-
serviceAccountName: openstack-cloud-controller-manager
42+
serviceAccountName: {{ .Values.serviceAccountName }}
4343
containers:
4444
- name: openstack-cloud-controller-manager
4545
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"

charts/openstack-cloud-controller-manager/templates/serviceaccount.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
kind: ServiceAccount
33
metadata:
4-
name: openstack-cloud-controller-manager
4+
name: {{ .Values.serviceAccountName }}
55
namespace: {{ .Release.Namespace }}
66
annotations:
77
{{- with .Values.commonAnnotations }}

charts/openstack-cloud-controller-manager/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,7 @@ extraVolumeMounts:
121121
# cluster name that used for created cluster
122122
cluster:
123123
name: kubernetes
124+
125+
clusterRoleName: system:cloud-controller-manager
126+
127+
serviceAccountName: cloud-controller-manager

0 commit comments

Comments
 (0)