Files
deprecated-helm-charts/stable/stackdriver-exporter/templates/deployment.yaml
T
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

110 lines
4.2 KiB
YAML

apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: {{ template "stackdriver-exporter.fullname" . }}
labels:
chart: {{ template "stackdriver-exporter.chart" . }}
app: {{ template "stackdriver-exporter.name" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ template "stackdriver-exporter.name" . }}
release: "{{ .Release.Name }}"
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
labels:
app: {{ template "stackdriver-exporter.name" . }}
release: "{{ .Release.Name }}"
{{- if .Values.annotations }}
annotations:
{{ toYaml .Values.annotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.affinity }}
affinity:
{{ toYaml .Values.affinity | indent 8 }}
{{- end }}
serviceAccount: {{ template "stackdriver-exporter.serviceAccountName" . }}
restartPolicy: {{ .Values.restartPolicy }}
volumes:
{{- if .Values.stackdriver.serviceAccountSecret }}
- name: stackdriver-service-account
secret:
secretName: {{ .Values.stackdriver.serviceAccountSecret | quote }}
{{- else if .Values.stackdriver.serviceAccountKey }}
- name: stackdriver-service-account
secret:
secretName: {{ template "stackdriver-exporter.fullname" . }}
{{- end}}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["stackdriver_exporter"]
volumeMounts:
{{- if or .Values.stackdriver.serviceAccountSecret .Values.stackdriver.serviceAccountKey }}
- name: stackdriver-service-account
mountPath: /etc/secrets/service-account/
{{- end}}
env:
{{- if or .Values.stackdriver.serviceAccountSecret .Values.stackdriver.serviceAccountKey }}
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /etc/secrets/service-account/credentials.json
{{- end }}
- name: STACKDRIVER_EXPORTER_GOOGLE_PROJECT_ID
value: {{ .Values.stackdriver.projectId | quote }}
- name: STACKDRIVER_EXPORTER_MONITORING_METRICS_TYPE_PREFIXES
value: {{ .Values.stackdriver.metrics.typePrefixes | quote }}
- name: STACKDRIVER_EXPORTER_MONITORING_METRICS_INTERVAL
value: {{ .Values.stackdriver.metrics.interval | quote }}
- name: STACKDRIVER_EXPORTER_MONITORING_METRICS_OFFSET
value: {{ .Values.stackdriver.metrics.offset | quote }}
- name: STACKDRIVER_EXPORTER_WEB_LISTEN_ADDRESS
value: {{ .Values.web.listenAddress | quote }}
- name: STACKDRIVER_EXPORTER_WEB_TELEMETRY_PATH
value: {{ .Values.web.path | quote }}
- name: STACKDRIVER_EXPORTER_MAX_RETRIES
value: {{ .Values.stackdriver.maxRetries | quote }}
- name: STACKDRIVER_EXPORTER_HTTP_TIMEOUT
value: {{ .Values.stackdriver.httpTimeout | quote }}
- name: STACKDRIVER_EXPORTER_MAX_BACKOFF_DURATION
value: {{ .Values.stackdriver.maxBackoff | quote }}
- name: STACKDRIVER_EXPORTER_BACKODFF_JITTER_BASE
value: {{ .Values.stackdriver.backoffJitter | quote }}
- name: STACKDRIVER_EXPORTER_RETRY_STATUSES
value: {{ .Values.stackdriver.retryStatuses | quote}}
resources:
{{ toYaml .Values.resources | indent 12 }}
ports:
- containerPort: {{ .Values.service.httpPort }}
name: http
livenessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 30
timeoutSeconds: 10
readinessProbe:
httpGet:
path: /health
port: http
initialDelaySeconds: 10
timeoutSeconds: 10
{{- if .Values.nodeSelector }}
nodeSelector:
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- end }}