deployment-gateway.yaml 4.65 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
{{- if .Values.gateway.enabled }}
{{ $dict := dict "ctx" . "component" "gateway" }}
apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "tempo.resourceName" $dict }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "tempo.labels" $dict | nindent 4 }}
spec:
  minReadySeconds: 10
{{- if not .Values.gateway.autoscaling.enabled }}
  replicas: {{ .Values.gateway.replicas }}
{{- end }}
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      {{- include "tempo.selectorLabels" $dict | nindent 6 }}
  template:
    metadata:
      annotations:
        checksum/config: {{ include (print .Template.BasePath "/gateway/configmap-gateway.yaml") . | sha256sum }}
        {{- with .Values.tempo.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
        {{- with .Values.gateway.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      labels:
        {{- include "tempo.selectorLabels" $dict | nindent 8 }}
        {{- with .Values.tempo.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
        {{- with .Values.gateway.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      {{- if or (.Values.gateway.priorityClassName) (.Values.global.priorityClassName) }}
      priorityClassName: {{ default .Values.gateway.priorityClassName .Values.global.priorityClassName }}
      {{- end }}
      serviceAccountName: {{ include "tempo.serviceAccountName" . }}
      {{- with .Values.tempo.podSecurityContext }}
      securityContext:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      terminationGracePeriodSeconds: {{ .Values.gateway.terminationGracePeriodSeconds }}
      enableServiceLinks: false
      {{- include "tempo.gatewayImagePullSecrets" . | nindent 6 -}}
      {{- with .Values.gateway.hostAliases }}
      hostAliases:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      containers:
        - name: nginx
          image: "{{ include "tempo.imageReference" $dict }}"
          imagePullPolicy: {{ .Values.gateway.image.pullPolicy }}
          ports:
            - name: http-metrics
              containerPort: 8080
              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 }}
          volumeMounts:
            - name: config
              mountPath: /etc/nginx
            {{- if .Values.enterprise.enabled }}
            - name: license
              mountPath: /license
            {{- end }}
            {{- 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 }}
          {{- with .Values.tempo.securityContext }}
          securityContext:
            {{- toYaml . | nindent 12 }}
          {{- end }}
      {{- if semverCompare ">= 1.19-0" .Capabilities.KubeVersion.Version }}
      {{- with .Values.gateway.topologySpreadConstraints }}
      topologySpreadConstraints:
        {{- tpl . $ | nindent 8 }}
      {{- end }}
      {{- end }}
      {{- with .Values.gateway.affinity }}
      affinity:
        {{- tpl . $ | nindent 8 }}
      {{- end }}
      {{- with .Values.gateway.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.gateway.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      volumes:
        - name: config
          configMap:
            name: {{ include "tempo.resourceName" (dict "ctx" . "component" "gateway") }}
        {{- if .Values.enterprise.enabled -}}
        - name: license
          secret:
            secretName: {{ tpl .Values.license.secretName . }}
        {{- end }}
        {{- if .Values.gateway.basicAuth.enabled }}
        - name: auth
          secret:
            secretName: {{ include "tempo.gatewayAuthSecret" . }}
        {{- end }}
        - name: tmp
          emptyDir: {}
        - name: docker-entrypoint-d-override
          emptyDir: {}
        {{- if .Values.gateway.extraVolumes }}
        {{- toYaml .Values.gateway.extraVolumes | nindent 8 }}
        {{- end }}
{{- end }}