Skip to content

Commit 9715a2a

Browse files
authored
fix(helm): Ensure non-default service account name works with namespaces-cache and configmaps-cache role bindings (#557)
Issue #, if available: N/A Relates to aws-controllers-k8s/kms-controller#83 Description of changes: This change ensures that the required `ClusterRoleBinding` and `RoleBinding` objects apply to a `ServiceAccount` with a custom name. Error seen with custom service account name: ``` pkg/mod/k8s.io/[email protected]/tools/cache/reflector.go:232: Failed to watch *v1.ConfigMap: failed to list *v1.ConfigMap: configmaps is forbidden: User "system:serviceaccount:kms-controller:kms-controller" cannot list resource "configmaps" in API group "" in the namespace "kms-controller" ``` By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent ba12790 commit 9715a2a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

templates/helm/templates/caches-role-binding.yaml.tpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ roleRef:
88
name: ack-namespaces-cache-{{ .ControllerName }}-controller
99
subjects:
1010
- kind: ServiceAccount
11-
name: ack-{{ .ControllerName }}-controller
11+
name: {{ IncludeTemplate "service-account.name" }}
1212
namespace: {{ "{{ .Release.Namespace }}" }}
1313
---
1414
apiVersion: rbac.authorization.k8s.io/v1
@@ -22,5 +22,5 @@ roleRef:
2222
name: ack-configmaps-cache-{{ .ControllerName }}-controller
2323
subjects:
2424
- kind: ServiceAccount
25-
name: ack-{{ .ControllerName }}-controller
26-
namespace: {{ "{{ .Release.Namespace }}" }}
25+
name: {{ IncludeTemplate "service-account.name" }}
26+
namespace: {{ "{{ .Release.Namespace }}" }}

0 commit comments

Comments
 (0)