deployment-distributor.yaml 4.83 KB
Newer Older
Vũ Hoàng Nam's avatar
Vũ Hoàng Nam committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "loki.distributorFullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "loki.distributorLabels" . | nindent 4 }}
    app.kubernetes.io/part-of: memberlist
  {{- with .Values.loki.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
{{- if not .Values.distributor.autoscaling.enabled }}
  replicas: {{ .Values.distributor.replicas }}
{{- end }}
  strategy:
    rollingUpdate:
      maxSurge: {{ .Values.distributor.maxSurge }}
      maxUnavailable: 1
  revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
  selector:
    matchLabels:
      {{- include "loki.distributorSelectorLabels" . | nindent 6 }}
  template:
    metadata:
      annotations:
        {{- include "loki.config.checksum" . | nindent 8 }}
        {{- with .Values.loki.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
        {{- with .Values.distributor.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      labels:
        {{- include "loki.distributorSelectorLabels" . | nindent 8 }}
        app.kubernetes.io/part-of: memberlist
        {{- with .Values.loki.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
        {{- with .Values.distributor.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      serviceAccountName: {{ include "loki.serviceAccountName" . }}
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.distributor.hostAliases }}
      hostAliases:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- include "loki.distributorPriorityClassName" . | nindent 6 }}
      securityContext:
        {{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
      terminationGracePeriodSeconds: {{ .Values.distributor.terminationGracePeriodSeconds }}
      containers:
        - name: distributor
          image: {{ include "loki.distributorImage" . }}
          imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
          {{- if or .Values.loki.command .Values.distributor.command }}
          command:
            - {{ coalesce .Values.distributor.command .Values.loki.command | quote }}
          {{- end }}
          args:
            - -config.file=/etc/loki/config/config.yaml
            - -target=distributor
            {{- with .Values.distributor.extraArgs }}
            {{- toYaml . | nindent 12 }}
            {{- end }}
          ports:
            - name: http
              containerPort: 3100
              protocol: TCP
            - name: grpc
              containerPort: 9095
              protocol: TCP
            - name: http-memberlist
              containerPort: 7946
              protocol: TCP
          {{- with .Values.distributor.extraEnv }}
          env:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          {{- with .Values.distributor.extraEnvFrom }}
          envFrom:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          securityContext:
            {{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
          readinessProbe:
            {{- toYaml .Values.loki.readinessProbe | nindent 12 }}
          livenessProbe:
            {{- toYaml .Values.loki.livenessProbe | nindent 12 }}
          volumeMounts:
            - name: config
              mountPath: /etc/loki/config
            - name: runtime-config
              mountPath: /var/{{ include "loki.name" . }}-runtime
            {{- with .Values.distributor.extraVolumeMounts }}
            {{- toYaml . | nindent 12 }}
            {{- end }}
          resources:
            {{- toYaml .Values.distributor.resources | nindent 12 }}
        {{- if .Values.distributor.extraContainers }}
        {{- toYaml .Values.distributor.extraContainers | nindent 8}}
        {{- end }}
      {{- with .Values.distributor.affinity }}
      affinity:
        {{- tpl . $ | nindent 8 }}
      {{- end }}
      {{- with .Values.distributor.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.distributor.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      volumes:
        - name: config
          {{- if .Values.loki.existingSecretForConfig }}
          secret:
            secretName: {{ .Values.loki.existingSecretForConfig }}
          {{- else if .Values.loki.configAsSecret }}
          secret:
            secretName: {{ include "loki.fullname" . }}-config
          {{- else }}
          configMap:
            name: {{ include "loki.fullname" . }}
          {{- end }}
        - name: runtime-config
          configMap:
            name: {{ template "loki.fullname" . }}-runtime
        {{- with .Values.distributor.extraVolumes }}
        {{- toYaml . | nindent 8 }}
        {{- end }}