Files
charts/bitnami/grafana-loki/templates/query-frontend/deployment.yaml
cleverhu 5764e11ccb fix loki config volume hardcode (#13082)
Signed-off-by: cleverhu <shouping.hu@daocloud.io>

Signed-off-by: cleverhu <shouping.hu@daocloud.io>
2022-10-24 11:23:12 +02:00

163 lines
9.4 KiB
YAML

apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
kind: Deployment
metadata:
name: {{ template "grafana-loki.query-frontend.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.queryFrontend.replicaCount }}
{{- if .Values.queryFrontend.updateStrategy }}
strategy: {{- toYaml .Values.queryFrontend.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/loki-configmap.yaml") . | sha256sum }}
{{- if .Values.queryFrontend.podAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.podAnnotations "context" $) | nindent 8 }}
{{- end }}
labels: {{- include "common.labels.standard" . | nindent 8 }}
app.kubernetes.io/part-of: grafana-loki
app.kubernetes.io/component: query-frontend
loki-gossip-member: "true"
{{- if .Values.queryFrontend.podLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.podLabels "context" $) | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "grafana-loki.serviceAccountName" . }}
{{- include "grafana-loki.imagePullSecrets" . | nindent 6 }}
{{- if .Values.queryFrontend.hostAliases }}
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.hostAliases "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.queryFrontend.affinity }}
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.queryFrontend.affinity "context" $) | nindent 8 }}
{{- else }}
affinity:
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.queryFrontend.podAffinityPreset "component" "query-frontend" "context" $) | nindent 10 }}
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.queryFrontend.podAntiAffinityPreset "component" "query-frontend" "context" $) | nindent 10 }}
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.queryFrontend.nodeAffinityPreset.type "key" .Values.queryFrontend.nodeAffinityPreset.key "values" .Values.queryFrontend.nodeAffinityPreset.values) | nindent 10 }}
{{- end }}
{{- if .Values.queryFrontend.nodeSelector }}
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.queryFrontend.nodeSelector "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.queryFrontend.tolerations }}
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.tolerations "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.queryFrontend.topologySpreadConstraints }}
topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.topologySpreadConstraints "context" .) | nindent 8 }}
{{- end }}
{{- if .Values.queryFrontend.priorityClassName }}
priorityClassName: {{ .Values.queryFrontend.priorityClassName | quote }}
{{- end }}
{{- if .Values.queryFrontend.schedulerName }}
schedulerName: {{ .Values.queryFrontend.schedulerName }}
{{- end }}
{{- if .Values.queryFrontend.podSecurityContext.enabled }}
securityContext: {{- omit .Values.queryFrontend.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
initContainers:
{{- if .Values.queryFrontend.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.initContainers "context" $) | nindent 8 }}
{{- end }}
containers:
- name: grafana-loki-query-frontend
image: {{ template "grafana-loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if .Values.queryFrontend.containerSecurityContext.enabled }}
securityContext: {{- omit .Values.queryFrontend.containerSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
{{- else if .Values.queryFrontend.command }}
command: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.command "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else if .Values.queryFrontend.args }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.args "context" $) | nindent 12 }}
{{- else }}
args:
- -target=query-frontend
- -config.file={{ .Values.loki.dataDir }}/conf/loki.yaml
{{- if .Values.queryScheduler.enabled }}
- -frontend.scheduler-address={{ template "grafana-loki.query-scheduler.fullname" . }}:{{ .Values.queryScheduler.service.ports.grpc }}
{{- end }}
{{- end }}
{{- if .Values.queryFrontend.extraEnvVars }}
env: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraEnvVars "context" $) | nindent 12 }}
{{- end }}
envFrom:
{{- if .Values.queryFrontend.extraEnvVarsCM }}
- configMapRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraEnvVarsCM "context" $) }}
{{- end }}
{{- if .Values.queryFrontend.extraEnvVarsSecret }}
- secretRef:
name: {{ include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraEnvVarsSecret "context" $) }}
{{- end }}
ports:
- containerPort: {{ .Values.loki.containerPorts.http }}
name: http
- containerPort: {{ .Values.loki.containerPorts.grpc }}
name: grpc
{{- if .Values.queryFrontend.resources }}
resources: {{- toYaml .Values.queryFrontend.resources | nindent 12 }}
{{- end }}
{{- if not .Values.diagnosticMode.enabled }}
{{- if .Values.queryFrontend.customLivenessProbe }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.customLivenessProbe "context" $) | nindent 12 }}
{{- else if .Values.queryFrontend.livenessProbe.enabled }}
livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.queryFrontend.livenessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- end }}
{{- if .Values.queryFrontend.customReadinessProbe }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.customReadinessProbe "context" $) | nindent 12 }}
{{- else if .Values.queryFrontend.readinessProbe.enabled }}
readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.queryFrontend.readinessProbe "enabled") "context" $) | nindent 12 }}
httpGet:
path: /ready
port: http
{{- end }}
{{- if .Values.queryFrontend.customStartupProbe }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.customStartupProbe "context" $) | nindent 12 }}
{{- else if .Values.queryFrontend.startupProbe.enabled }}
startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.queryFrontend.startupProbe "enabled") "context" $) | nindent 12 }}
tcpSocket:
port: http
{{- end }}
{{- end }}
{{- if .Values.queryFrontend.lifecycleHooks }}
lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.lifecycleHooks "context" $) | nindent 12 }}
{{- end }}
volumeMounts:
- name: loki-config
mountPath: {{ .Values.loki.dataDir }}/conf/loki.yaml
subPath: loki.yaml
{{- if .Values.queryFrontend.extraVolumeMounts }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraVolumeMounts "context" $) | nindent 12 }}
{{- end }}
{{- if .Values.queryFrontend.sidecars }}
{{- include "common.tplvalues.render" ( dict "value" .Values.queryFrontend.sidecars "context" $) | nindent 8 }}
{{- end }}
volumes:
- name: loki-config
configMap:
name: {{ template "grafana-loki.loki.configmapName" . }}
{{- if .Values.queryFrontend.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraVolumes "context" $) | nindent 8 }}
{{- end }}