Skip to content

Commit c3eff3d

Browse files
authored
Merge pull request #327 from SuganJoe/make-SA-labels-customizable
Adding the ability to service account to accept custom labels
2 parents 4938df9 + 178c74e commit c3eff3d

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Fix mounts for `jobs.preRegisterContentCommand` container to use the same mounts as the primary register-content container. (#322) (by @cognifloyd)
88
* Add support for providing custom st2actionrunner-specific docker repository, image name, pull policy, and pull secret via `values.yaml`. (#141) (by @Sheshagiri)
99
* Fix bug that hung an init container when `st2.packs.volumes.enabled` without `st2.packs.volumes.configs`. (#324) (by @rebrowning)
10+
* Add ability to create custom labels for service account.(#327)(by @SuganJoe)
1011

1112
## v0.100.0
1213
* Switch st2 to `v3.7` as a new default stable version (#274)

templates/service-account.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ metadata:
99
{{- toYaml .Values.serviceAccount.serviceAccountAnnotations | nindent 4 }}
1010
{{- end }}
1111
labels: {{- include "stackstorm-ha.labels" (list $ (include "stackstorm-ha.name" $)) | nindent 4 }}
12+
{{- if .Values.serviceAccount.serviceAccountLabels }}
13+
{{- toYaml .Values.serviceAccount.serviceAccountLabels | nindent 4 }}
14+
{{- end }}
1215
{{- if .Values.serviceAccount.pullSecret }}
1316
imagePullSecrets:
1417
- name: "{{ .Values.serviceAccount.pullSecret }}"

tests/unit/labels_test.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,24 @@ tests:
214214
path: metadata.labels.heritage
215215
value: Helm
216216

217+
- it: ServiceAccount accepts custom labels
218+
template: service-account.yaml
219+
set:
220+
serviceAccount:
221+
create: true
222+
serviceAccountLabels:
223+
foo: bar
224+
answer: "42"
225+
asserts:
226+
- isNotNull:
227+
path: metadata.labels
228+
- equal:
229+
path: metadata.labels.foo
230+
value: bar
231+
- equal:
232+
path: metadata.labels.answer
233+
value: "42"
234+
217235
- it: st2web Ingress has required labels
218236
template: ingress.yaml
219237
set:

values.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ serviceAccount:
3232
serviceAccountAnnotations: {}
3333
# Used to override service account name
3434
serviceAccountName:
35+
# Used to define any custom labels required
36+
#serviceAccountLabels: {}
37+
3538
# Fallback image pull secret.
3639
# If a pod does not have pull secrets, k8s will use the service account's pull secrets.
3740
# See: https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/#serviceaccount-admission-controller
@@ -67,7 +70,7 @@ st2:
6770
config: |
6871
[api]
6972
allow_origin = '*'
70-
73+
7174
#Override Definitions can be added here.
7275
#https://docs.stackstorm.com/latest/packs.html#overriding-pack-defaults
7376
overrides: {}

0 commit comments

Comments
 (0)