[stable/prometheus-cloudwatch-exporter] Enable to set an existing service account name (#22272)

* Define serviceAccountName and use it instead of fullname

Signed-off-by: ada-u <yuta@adachi.life>

* Remove `.serviceAccount.create` condition to pass the existing sa name

e.g. pass the sa name created by eksctl for using IRSA

Signed-off-by: ada-u <yuta@adachi.life>

* Bump chart version to 0.8.0

Signed-off-by: ada-u <yuta@adachi.life>

* Fix default image version to 0.8.0

Signed-off-by: ada-u <yuta@adachi.life>
This commit is contained in:
YutaAdachi
2020-05-21 12:04:14 -07:00
committed by GitHub
parent 1e959d2a28
commit e785e38ca5
6 changed files with 17 additions and 8 deletions
@@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "0.8.0"
description: A Helm chart for prometheus cloudwatch-exporter
name: prometheus-cloudwatch-exporter
version: 0.7.0
version: 0.8.0
home: https://github.com/prometheus/cloudwatch_exporter
sources:
- https://github.com/prometheus/cloudwatch_exporter
@@ -52,7 +52,7 @@ The following table lists the configurable parameters of the Cloudwatch Exporter
| Parameter | Description | Default |
| --------------------------------- | ----------------------------------------------------------------------- | --------------------------- |
| `image.repository` | Image | `prom/cloudwatch-exporter` |
| `image.tag` | Image tag | `cloudwatch_exporter-0.6.0` |
| `image.tag` | Image tag | `cloudwatch_exporter-0.8.0` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `command` | Container entrypoint command | `[]` |
| `service.type` | Service type | `ClusterIP` |
@@ -31,6 +31,17 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create serviceAccountName for deployment.
*/}}
{{- define "prometheus-cloudwatch-exporter.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "prometheus-cloudwatch-exporter.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for deployment.
*/}}
@@ -10,7 +10,7 @@ metadata:
heritage: {{ .Release.Service }}
subjects:
- kind: ServiceAccount
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
name: {{ template "prometheus-cloudwatch-exporter.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
@@ -106,10 +106,8 @@ spec:
securityContext:
{{ toYaml . | indent 8 }}
{{- end }}
{{- if .Values.serviceAccount.create }}
serviceAccount: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
serviceAccountName: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
{{- end }}
serviceAccount: {{ template "prometheus-cloudwatch-exporter.serviceAccountName" . }}
serviceAccountName: {{ template "prometheus-cloudwatch-exporter.serviceAccountName" . }}
volumes:
- configMap:
defaultMode: 420
@@ -2,7 +2,7 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "prometheus-cloudwatch-exporter.fullname" . }}
name: {{ template "prometheus-cloudwatch-exporter.serviceAccountName" . }}
labels:
app: {{ template "prometheus-cloudwatch-exporter.name" . }}
chart: {{ template "prometheus-cloudwatch-exporter.chart" . }}