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

feat: Add commonly used configurations to global scope #14406

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
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
30 changes: 30 additions & 0 deletions production/helm/loki/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -1116,3 +1116,33 @@ Return the appropriate apiVersion for HorizontalPodAutoscaler.
{{- print "autoscaling/v2beta1" -}}
{{- end -}}
{{- end -}}

{{/*
Return the templated list for extraEnv and extraEnvFrom
Params:
. = extraEnv/extraEnvFrom list
*/}}
{{- define "loki.templateEnv" -}}
{{- $extraEnv := . }}
{{- with $extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end -}}

{{/*
Return the templated dict/list for extraArgs
Params:
. = extraArgs dict/list
*/}}
{{- define "loki.templateArgs" -}}
{{- $extraArgs := . }}
{{- if and $extraArgs (kindIs "slice" $extraArgs) }}
{{- with $extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- else if and $extraArgs (kindIs "map" $extraArgs) -}}
{{- range $key, $value := $extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ spec:
- -admin.client.s3.secret-access-key={{ .Values.minio.secretKey }}
- -admin.client.s3.insecure=true
{{- end }}
{{- range $key, $value := .Values.adminApi.extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.adminApi.extraArgs }}
volumeMounts:
- name: config
mountPath: /etc/loki/config
Expand Down Expand Up @@ -118,9 +117,8 @@ spec:
securityContext:
{{- toYaml .Values.adminApi.containerSecurityContext | nindent 12 }}
env:
{{- if .Values.adminApi.env }}
{{ toYaml .Values.adminApi.env | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.adminApi.extraEnv }}
{{- with .Values.adminApi.extraContainers }}
{{ toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,8 @@ spec:
- -config.file=/etc/loki/config/config.yaml
- -target={{ .Values.backend.targetModule }}
- -legacy-read-mode=false
{{- with .Values.backend.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.backend.extraArgs }}
ports:
- name: http-metrics
containerPort: {{ .Values.loki.server.http_listen_port }}
Expand All @@ -173,14 +172,12 @@ spec:
- name: http-memberlist
containerPort: 7946
protocol: TCP
{{- with .Values.backend.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.backend.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.backend.extraEnv }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.backend.extraEnvFrom }}
securityContext:
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
readinessProbe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ spec:
args:
- -config.file=/etc/loki/config/config.yaml
- -target=bloom-builder
{{- with .Values.bloomBuilder.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.bloomBuilder.extraArgs }}
ports:
- name: http-metrics
containerPort: 3100
Expand All @@ -80,14 +79,12 @@ spec:
- name: http-memberlist
containerPort: 7946
protocol: TCP
{{- with .Values.bloomBuilder.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.bloomBuilder.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.bloomBuilder.extraEnv }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.bloomBuilder.extraEnvFrom }}
securityContext:
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
readinessProbe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ spec:
args:
- -config.file=/etc/loki/config/config.yaml
- -target=bloom-gateway
{{- with .Values.bloomGateway.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.bloomGateway.extraArgs }}
ports:
- name: http-metrics
containerPort: 3100
Expand All @@ -88,14 +87,12 @@ spec:
- name: http-memberlist
containerPort: 7946
protocol: TCP
{{- with .Values.bloomGateway.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.bloomGateway.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.bloomGateway.extraEnv }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.bloomGateway.extraEnvFrom }}
securityContext:
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
{{- include "loki.bloomGateway.readinessProbe" . | nindent 10 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ spec:
args:
- -config.file=/etc/loki/config/config.yaml
- -target=bloom-planner
{{- with .Values.bloomPlanner.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.bloomPlanner.extraArgs }}
ports:
- name: http-metrics
containerPort: 3100
Expand All @@ -88,14 +87,12 @@ spec:
- name: http-memberlist
containerPort: 7946
protocol: TCP
{{- with .Values.bloomPlanner.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.bloomPlanner.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.bloomPlanner.extraEnv }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.bloomPlanner.extraEnvFrom }}
securityContext:
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
{{- include "loki.bloomPlanner.readinessProbe" . | nindent 10 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ spec:
args:
- -config.file=/etc/loki/config/config.yaml
- -target=compactor
{{- with .Values.compactor.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.compactor.extraArgs }}
ports:
- name: http-metrics
containerPort: 3100
Expand All @@ -95,14 +94,12 @@ spec:
- name: http-memberlist
containerPort: 7946
protocol: TCP
{{- with .Values.compactor.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.compactor.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.compactor.extraEnv }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.compactor.extraEnvFrom }}
securityContext:
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
{{- include "loki.compactor.readinessProbe" . | nindent 10 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ spec:
- -distributor.zone-awareness-enabled=true
{{- end }}
{{- end }}
{{- with .Values.distributor.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.distributor.extraArgs }}
ports:
- name: http-metrics
containerPort: 3100
Expand All @@ -88,14 +87,12 @@ spec:
- name: http-memberlist
containerPort: 7946
protocol: TCP
{{- with .Values.distributor.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.distributor.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.distributor.extraEnv }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.distributor.extraEnvFrom }}
securityContext:
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
readinessProbe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ spec:
- -gateway.proxy.ruler.url=http://{{ template "loki.backendFullname" . }}-headless.{{ .Release.Namespace }}.svc:3100
- -gateway.proxy.query-scheduler.url=http://{{ template "loki.backendFullname" . }}-headless.{{ .Release.Namespace }}.svc:3100
{{- end }}
{{- range $key, $value := .Values.enterpriseGateway.extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.enterpriseGateway.extraArgs }}
volumeMounts:
- name: config
mountPath: /etc/loki/config
Expand All @@ -111,9 +110,8 @@ spec:
securityContext:
{{- toYaml .Values.enterpriseGateway.containerSecurityContext | nindent 12 }}
env:
{{- if .Values.enterpriseGateway.env }}
{{ toYaml .Values.enterpriseGateway.env | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.enterpriseGateway.extraEnv }}
{{- with .Values.enterpriseGateway.extraContainers }}
{{ toYaml . | nindent 8 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,10 @@ spec:
- name: http-metrics
containerPort: {{ .Values.gateway.containerPort }}
protocol: TCP
{{- with .Values.gateway.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.gateway.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.gateway.extraEnv }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.gateway.extraEnvFrom }}
readinessProbe:
{{- toYaml .Values.gateway.readinessProbe | nindent 12 }}
securityContext:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,8 @@ spec:
args:
- -config.file=/etc/loki/config/config.yaml
- -target=index-gateway
{{- with .Values.indexGateway.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.indexGateway.extraArgs }}
ports:
- name: http-metrics
containerPort: 3100
Expand All @@ -90,14 +89,12 @@ spec:
containerPort: 7946
protocol: TCP
{{- end }}
{{- with .Values.indexGateway.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.indexGateway.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.indexGateway.extraEnv }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.indexGateway.extraEnvFrom }}
securityContext:
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
readinessProbe:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ spec:
- -ingester.unregister-on-shutdown=false
- -ingester.tokens-file-path=/var/loki/ring-tokens
- -target=ingester
{{- with .Values.ingester.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.ingester.extraArgs }}
ports:
- name: http-metrics
containerPort: 3100
Expand All @@ -117,14 +116,12 @@ spec:
- name: http-memberlist
containerPort: 7946
protocol: TCP
{{- with .Values.ingester.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.ingester.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.ingester.extraEnv }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.ingester.extraEnvFrom }}
securityContext:
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
{{- include "loki.ingester.readinessProbe" . | nindent 10 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ spec:
- -ingester.unregister-on-shutdown=false
- -ingester.tokens-file-path=/var/loki/ring-tokens
- -target=ingester
{{- with .Values.ingester.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateArgs" .Values.loki.extraArgs }}
{{ include "loki.templateArgs" .Values.ingester.extraArgs }}
ports:
- name: http-metrics
containerPort: 3100
Expand All @@ -117,14 +116,12 @@ spec:
- name: http-memberlist
containerPort: 7946
protocol: TCP
{{- with .Values.ingester.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.ingester.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.loki.extraEnv }}
{{ include "loki.templateEnv" .Values.ingester.extraEnv }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
{{ include "loki.templateEnv" .Values.loki.extraEnvFrom }}
{{ include "loki.templateEnv" .Values.ingester.extraEnvFrom }}
securityContext:
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
{{- include "loki.ingester.readinessProbe" . | nindent 10 }}
Expand Down
Loading