Skip to content

Commit bac167e

Browse files
committed
Add serviceAccountTokenCreationRoles helm chart array value
The array allows users to supply KEDA with the names and namespaces of service accounts that they would like the keda-operator to request tokens from. These service account tokens are then used in turn for the boundServiceAccountToken trigger source Signed-off-by: Max Cao <[email protected]>
1 parent d06840b commit bac167e

File tree

2 files changed

+63
-9
lines changed

2 files changed

+63
-9
lines changed

keda/templates/manager/minimal-rbac.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,51 @@ subjects:
146146
- kind: ServiceAccount
147147
name: {{ (.Values.serviceAccount.operator).name | default .Values.serviceAccount.name }}
148148
namespace: {{ .Release.Namespace }}
149+
{{- if .Values.serviceAccountTokenCreationRoles }}
150+
{{- range $r := .Values.serviceAccountTokenCreationRoles }}
151+
---
152+
apiVersion: rbac.authorization.k8s.io/v1
153+
kind: Role
154+
metadata:
155+
{{- with $.Values.additionalAnnotations }}
156+
annotations:
157+
{{- toYaml . | nindent 4 }}
158+
{{- end }}
159+
labels:
160+
app.kubernetes.io/name: {{ $.Values.operator.name }}-minimal
161+
{{- include "keda.labels" $ | indent 4 }}
162+
name: {{ $.Values.operator.name }}-token-creator-minimal
163+
namespace: {{ $r.namespace }}
164+
rules:
165+
- apiGroups:
166+
- ""
167+
resources:
168+
- serviceaccounts/token
169+
verbs:
170+
- create
171+
resourceNames:
172+
- {{ $r.name }}
173+
---
174+
apiVersion: rbac.authorization.k8s.io/v1
175+
kind: RoleBinding
176+
metadata:
177+
{{- with $.Values.additionalAnnotations }}
178+
annotations:
179+
{{- toYaml . | nindent 4 }}
180+
{{- end }}
181+
labels:
182+
app.kubernetes.io/name: {{ $.Values.operator.name }}-minimal
183+
{{- include "keda.labels" $ | indent 4 }}
184+
name: {{ $.Values.operator.name }}-token-creator-minimal
185+
namespace: {{ $r.namespace }}
186+
roleRef:
187+
apiGroup: rbac.authorization.k8s.io
188+
kind: Role
189+
name: {{ $.Values.operator.name }}-token-creator-minimal
190+
subjects:
191+
- kind: ServiceAccount
192+
name: {{ $.Values.operator.name }}
193+
namespace: {{ $.Release.Namespace }}
194+
{{- end }}
195+
{{- end }}
149196
{{- end }}

keda/values.yaml

+16-9
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ global:
1010
image:
1111
keda:
1212
# -- Image registry of KEDA operator
13-
registry: ghcr.io
13+
registry: quay.io
1414
# -- Image name of KEDA operator
15-
repository: kedacore/keda
15+
repository: macao/keda
1616
# -- Image tag of KEDA operator. Optional, given app version of Helm chart is used by default
17-
tag: ""
17+
tag: "main"
1818
metricsApiServer:
1919
# -- Image registry of KEDA Metrics API Server
20-
registry: ghcr.io
20+
registry: quay.io
2121
# -- Image name of KEDA Metrics API Server
22-
repository: kedacore/keda-metrics-apiserver
22+
repository: macao/keda-metrics-apiserver
2323
# -- Image tag of KEDA Metrics API Server. Optional, given app version of Helm chart is used by default
24-
tag: ""
24+
tag: "main"
2525
webhooks:
2626
# -- Image registry of KEDA admission-webhooks
27-
registry: ghcr.io
27+
registry: quay.io
2828
# -- Image name of KEDA admission-webhooks
29-
repository: kedacore/keda-admission-webhooks
29+
repository: macao/keda-admission-webhooks
3030
# -- Image tag of KEDA admission-webhooks . Optional, given app version of Helm chart is used by default
31-
tag: ""
31+
tag: "main"
3232
# -- Image pullPolicy for all KEDA components
3333
pullPolicy: Always
3434

@@ -867,3 +867,10 @@ customManagedBy: ""
867867
# -- Enable service links in pods. Although enabled, mirroring k8s default, it is highly recommended to disable,
868868
# due to its legacy status [Legacy container links](https://docs.docker.com/engine/network/links/)
869869
enableServiceLinks: true
870+
871+
# -- Creates role and rolebindings which allow the KEDA operator to request service account tokens from
872+
# namespaced service accounts in the array for use with the boundServiceAccountToken trigger source
873+
# If the namespace does not exist, this will cause the helm chart installation to fail.
874+
serviceAccountTokenCreationRoles: []
875+
# - name: myServiceAccount
876+
# namespace: myServiceAccountNamespace

0 commit comments

Comments
 (0)