oc-k8s/opencloud/charts/loki/templates/gateway/deployment-gateway-nginx.yaml

139 lines
4.8 KiB
YAML

{{- if and .Values.gateway.enabled (not (and .Values.enterprise.enabled .Values.enterprise.gelGateway)) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "loki.gatewayFullname" . }}
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki.gatewayLabels" . | nindent 4 }}
{{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
annotations:
{{- with .Values.loki.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.gateway.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{- if not .Values.gateway.autoscaling.enabled }}
replicas: {{ .Values.gateway.replicas }}
{{- end }}
{{- with .Values.gateway.deploymentStrategy }}
strategy:
{{ toYaml . | trim | indent 4 }}
{{- end }}
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
selector:
matchLabels:
{{- include "loki.gatewaySelectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include "loki.configMapOrSecretContentHash" (dict "ctx" . "name" "/gateway/configmap-gateway.yaml") }}
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.gateway.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- with .Values.loki.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.gateway.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "loki.gatewaySelectorLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "loki.serviceAccountName" . }}
{{ include "loki.enableServiceLinks" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end -}}
{{- include "loki.gatewayPriorityClassName" . | nindent 6 }}
securityContext:
{{- toYaml .Values.gateway.podSecurityContext | nindent 8 }}
terminationGracePeriodSeconds: {{ .Values.gateway.terminationGracePeriodSeconds }}
containers:
- name: nginx
image: {{ include "loki.gatewayImage" . }}
imagePullPolicy: {{ .Values.gateway.image.pullPolicy }}
ports:
- name: http-metrics
containerPort: {{ .Values.gateway.containerPort }}
protocol: TCP
{{- with .Values.gateway.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.gateway.extraEnvFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
readinessProbe:
{{- toYaml .Values.gateway.readinessProbe | nindent 12 }}
securityContext:
{{- toYaml .Values.gateway.containerSecurityContext | nindent 12 }}
{{- with .Values.gateway.lifecycle }}
lifecycle:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/nginx
{{- if .Values.gateway.basicAuth.enabled }}
- name: auth
mountPath: /etc/nginx/secrets
{{- end }}
- name: tmp
mountPath: /tmp
- name: docker-entrypoint-d-override
mountPath: /docker-entrypoint.d
{{- if .Values.gateway.extraVolumeMounts }}
{{- toYaml .Values.gateway.extraVolumeMounts | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.gateway.resources | nindent 12 }}
{{- if .Values.gateway.extraContainers }}
{{- toYaml .Values.gateway.extraContainers | nindent 8}}
{{- end }}
{{- with .Values.gateway.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.gateway.dnsConfig }}
dnsConfig:
{{- tpl . $ | nindent 8 }}
{{- end }}
{{- with .Values.gateway.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.gateway.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.gateway.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
configMap:
name: {{ include "loki.gatewayFullname" . }}
{{- if .Values.gateway.basicAuth.enabled }}
- name: auth
secret:
secretName: {{ include "loki.gatewayAuthSecret" . }}
{{- end }}
- name: tmp
emptyDir: {}
- name: docker-entrypoint-d-override
emptyDir: {}
{{- if .Values.gateway.extraVolumes }}
{{- toYaml .Values.gateway.extraVolumes | nindent 8 }}
{{- end }}
{{- end }}