Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm: add ruler specific service account #7132

Merged
merged 15 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions operations/helm/charts/mimir-distributed/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Entries should include a reference to the Pull Request that introduced the chang
* [ENHANCEMENT] Add `jaegerReporterMaxQueueSize` Helm value for all components where configuring `JAEGER_REPORTER_MAX_QUEUE_SIZE` makes sense, and override the Jaeger client's default value of 100 for components expected to generate many trace spans. #7068 #7086 #7259
* [ENHANCEMENT] Rollout-operator: upgraded to v0.10.1. #7125
* [ENHANCEMENT] Query-frontend: configured `-shutdown-delay`, `-server.grpc.keepalive.max-connection-age` and termination grace period to reduce the likelihood of queries hitting terminated query-frontends. #7129
* [ENHANCEMENT] Add the possibility to create a dedicated serviceAccount for the `ruler` component by setting `ruler.serivceAcount.create` to true in the values. #7132
* [ENHANCEMENT] nginx, Gateway: set `proxy_http_version: 1.1` to proxy to HTTP 1.1. #5040
* [BUGFIX] Metamonitoring: update dashboards to drop unsupported `step` parameter in targets. #7157

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ For compatibility and to support upgrade from enterprise-metrics chart calculate
{{- end -}}

{{/*
Create the name of the service account
Create the name of the general service account
*/}}
{{- define "mimir.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
Expand All @@ -74,6 +74,20 @@ Create the name of the service account
{{- end -}}
{{- end -}}

{{/*
Create the name of the ruler service account
*/}}
{{- define "mimir.ruler.serviceAccountName" -}}
{{- if and .Values.ruler.serviceAccount.create (eq .Values.ruler.serviceAccount.name "") -}}
{{- $sa := default (include "mimir.fullname" .) .Values.serviceAccount.name }}
dimitarvdimitrov marked this conversation as resolved.
Show resolved Hide resolved
{{- printf "%s-%s" $sa "ruler" }}
dimitarvdimitrov marked this conversation as resolved.
Show resolved Hide resolved
{{- else if and .Values.ruler.serviceAccount.create (not (eq .Values.ruler.serviceAccount.name "")) -}}
{{- .Values.ruler.serviceAccount.name -}}
{{- else -}}
{{- include "mimir.serviceAccountName" . -}}
{{- end -}}
{{- end -}}

{{/*
Create the app name for clients. Defaults to the same logic as "mimir.fullname", and default client expects "prometheus".
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ subjects:
- kind: ServiceAccount
name: {{ include "rollout-operator.serviceAccountName" . }}
{{- end }}
{{- if .Values.ruler.serviceAccount.create }}
- kind: ServiceAccount
name: {{ template "mimir.ruler.serviceAccountName" . }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ spec:
{{- include "mimir.podAnnotations" (dict "ctx" . "component" "ruler") | nindent 8 }}
namespace: {{ .Release.Namespace | quote }}
spec:
serviceAccountName: {{ template "mimir.serviceAccountName" . }}
serviceAccountName: {{ template "mimir.ruler.serviceAccountName" . }}
{{- if .Values.ruler.priorityClassName }}
priorityClassName: {{ .Values.ruler.priorityClassName }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.ruler.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "mimir.ruler.serviceAccountName" . }}
labels:
{{- include "mimir.labels" (dict "ctx" .) | nindent 4 }}
{{- with .Values.ruler.serviceAccount.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- toYaml .Values.ruler.serviceAccount.annotations | nindent 4 }}
namespace: {{ .Release.Namespace | quote }}
{{- end }}
11 changes: 11 additions & 0 deletions operations/helm/charts/mimir-distributed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,17 @@ ruler:
annotations: {}
labels: {}

# -- Dedicated service account for ruler pods.
# If not set, the default service account defined at the begining of this file will be used.
# This service account can be used even if the default one is not set.
serviceAccount:
create: false
# -- Ruler specific service account name. If not set and create is set to true, the default
# name will be the default mimir service account's name with the "-ruler" suffix.
name: ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a doc comment (# --) about the meaning of the empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

annotations: {}
labels: {}

resources:
requests:
cpu: 100m
Expand Down
Loading