1
0
mirror of https://github.com/coreos/prometheus-operator.git synced 2026-02-05 15:46:31 +01:00

[helm/prometheus] Custom ServiceAccountName when rbac disabled (#1230)

* Allows custom serviceAccountName value

* Adapt best practices for serviceAccount
This commit is contained in:
Ricardo Hernandez
2018-04-22 21:04:10 +01:00
committed by Giancarlo Rubio
parent 210782b5fa
commit a18f90f504
7 changed files with 23 additions and 6 deletions

View File

@@ -9,4 +9,4 @@ maintainers:
name: kube-prometheus
sources:
- https://github.com/coreos/prometheus-operator
version: 0.0.52
version: 0.0.53

View File

@@ -6,7 +6,7 @@ dependencies:
condition: deployAlertManager
- name: prometheus
version: 0.0.27
version: 0.0.28
#e2e-repository: file://../prometheus
repository: https://s3-eu-west-1.amazonaws.com/coreos-charts/stable/

View File

@@ -7,4 +7,4 @@ maintainers:
name: prometheus
sources:
- https://github.com/coreos/prometheus-operator
version: 0.0.27
version: 0.0.28

View File

@@ -34,3 +34,14 @@ Return the appropriate apiVersion value to use for the prometheus-operator manag
{{- printf "%s" "monitoring.coreos.com/v1alpha1" -}}
{{- end -}}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "prometheus.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "prometheus.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

View File

@@ -53,7 +53,7 @@ spec:
{{ toYaml .Values.secrets | indent 4 }}
{{- end }}
{{- if .Values.global.rbacEnable }}
serviceAccountName: {{ template "prometheus.fullname" . }}
serviceAccountName: {{ template "prometheus.serviceAccountName" .}}
{{- end }}
{{ if and .Values.config.specifiedInValues .Values.config.value }}
{{- else if .Values.serviceMonitorsSelector }}

View File

@@ -1,4 +1,4 @@
{{- if .Values.global.rbacEnable }}
{{- if and .Values.global.rbacEnable .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
@@ -7,5 +7,5 @@ metadata:
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "prometheus.fullname" . }}
name: {{ template "prometheus.serviceAccountName" .}}
{{- end }}

View File

@@ -97,6 +97,12 @@ paused: false
global:
rbacEnable: true
## serviceAccount to use by Prometheus
##
serviceAccount:
create: true
name: ""
## Number of Prometheus replicas desired
##
replicaCount: 1