Skip to content

Commit

Permalink
[prometheus] automountServiceAccountToken to be configurable (#3998)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian H. Lee <[email protected]>
Signed-off-by: MH <[email protected]>
Co-authored-by: MH <[email protected]>
  • Loading branch information
ianhlee and zanhsieh authored Nov 21, 2023
1 parent b837e3b commit 228dc45
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: prometheus
appVersion: v2.47.2
version: 25.6.0
version: 25.7.0
kubeVersion: ">=1.19.0-0"
description: Prometheus is a monitoring system and time series database.
home: https://prometheus.io/
Expand Down
3 changes: 3 additions & 0 deletions charts/prometheus/templates/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ spec:
{{- end }}
{{- end }}
serviceAccountName: {{ template "prometheus.serviceAccountName.server" . }}
{{- if kindIs "bool" .Values.server.automountServiceAccountToken }}
automountServiceAccountToken: {{ .Values.server.automountServiceAccountToken }}
{{- end }}
{{- if .Values.server.extraInitContainers }}
initContainers:
{{ toYaml .Values.server.extraInitContainers | indent 8 }}
Expand Down
4 changes: 3 additions & 1 deletion charts/prometheus/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ metadata:
namespace: {{ include "prometheus.namespace" . }}
annotations:
{{ toYaml .Values.serviceAccounts.server.annotations | indent 4 }}
{{- if .Values.serviceAccounts.server.automountServiceAccountToken }}
{{- if kindIs "bool" .Values.server.automountServiceAccountToken }}
automountServiceAccountToken: {{ .Values.server.automountServiceAccountToken }}
{{- else if kindIs "bool" .Values.serviceAccounts.server.automountServiceAccountToken }}
automountServiceAccountToken: {{ .Values.serviceAccounts.server.automountServiceAccountToken }}
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/prometheus/templates/sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ spec:
{{- end }}
{{- end }}
serviceAccountName: {{ template "prometheus.serviceAccountName.server" . }}
{{- if kindIs "bool" .Values.server.automountServiceAccountToken }}
automountServiceAccountToken: {{ .Values.server.automountServiceAccountToken }}
{{- end }}
{{- if .Values.server.extraInitContainers }}
initContainers:
{{ toYaml .Values.server.extraInitContainers | indent 8 }}
Expand Down
9 changes: 8 additions & 1 deletion charts/prometheus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ serviceAccounts:
create: true
name: ""
annotations: {}
# automountServiceAccountToken:

## Opt out of automounting Kubernetes API credentials.
## It will be overriden by server.automountServiceAccountToken value, if set.
# automountServiceAccountToken: false

## Additional labels to attach to all resources
commonMetaLabels: {}
Expand Down Expand Up @@ -98,6 +101,10 @@ server:
##
name: server

## Opt out of automounting Kubernetes API credentials.
## If set it will override serviceAccounts.server.automountServiceAccountToken value for ServiceAccount.
# automountServiceAccountToken: false

## Use a ClusterRole (and ClusterRoleBinding)
## - If set to false - we define a RoleBinding in the defined namespaces ONLY
##
Expand Down

0 comments on commit 228dc45

Please sign in to comment.