From 5dbadbb7e8ecd068f25d225c60960983fcb1fa10 Mon Sep 17 00:00:00 2001 From: Zach Tandara-Kuhns <71291209+zitikay@users.noreply.github.com> Date: Fri, 4 Dec 2020 13:13:07 -0500 Subject: [PATCH] Include serviceAccountName in deployments (#214) * option to include serviceAccountName in deployments * Update README with custom serviceAccount info Co-authored-by: tandz --- charts/pega/README.md | 14 ++++++++++++++ charts/pega/templates/_pega-deployment.tpl | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/charts/pega/README.md b/charts/pega/README.md index a2b168d1f..3a1339f33 100644 --- a/charts/pega/README.md +++ b/charts/pega/README.md @@ -426,6 +426,20 @@ tier: - name: MY_ENV_NAME value: MY_ENV_VALUE ``` + +### Service Account + +If the pod needs to be run with a specific [service account](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/), you can specify a custom `serviceAccountName` for your deployment tier. + +Example: + +```yaml +tier: + - name: my-tier + custom: + serviceAccountName: MY_SERVICE_ACCOUNT_NAME +``` + ### Custom Annotations for Pods You may optionally provide custom annotations for Pods as metadata to be consumed by other tools and libraries. Pod annotations may be specified by using the `podAnnotations` element for a given `tier`. diff --git a/charts/pega/templates/_pega-deployment.tpl b/charts/pega/templates/_pega-deployment.tpl index 8ab43a2d9..208725974 100644 --- a/charts/pega/templates/_pega-deployment.tpl +++ b/charts/pega/templates/_pega-deployment.tpl @@ -44,6 +44,11 @@ spec: {{- include "generatedPodAnnotations" .root | indent 8 }} spec: +{{- if .custom }} +{{- if .custom.serviceAccountName }} + serviceAccountName: {{ .custom.serviceAccountName }} +{{- end }} +{{- end }} volumes: # Volume used to mount config files. - name: {{ template "pegaVolumeConfig" }}