Files
Charlie Egan 780761f5f3 stable/stackdriver-exporter: Allow setting of pod ServiceAccount name (#15931)
* Allow setting of pod service account name

This makes it possible to use a serviceAccount other than the default.

I need this to aid my use the chart in conjunction with GKE's [Workload
Identity
feature](https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity)
which requires the use of an annotated service account for pods using
Google APIs.

Signed-off-by: Charlie Egan <charlieegan3@users.noreply.github.com>

* Enable creation of SA

Based on this:
https://helm.sh/docs/chart_best_practices/#role-based-access-control

Made in response to:
https://github.com/helm/charts/pull/15931#issuecomment-515846998

Signed-off-by: Charlie Egan <charlieegan3@users.noreply.github.com>

* Add notes about new variables to readme

Signed-off-by: Charlie Egan <charlieegan3@users.noreply.github.com>
2019-07-29 12:42:48 -07:00

44 lines
1.4 KiB
Go

{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "stackdriver-exporter.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "stackdriver-exporter.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "stackdriver-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "stackdriver-exporter.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "stackdriver-exporter.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}