github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/thanos/templates/query-frontend/deployment.yaml (about)

     1  {{- $query := (include "thanos.query.values" . | fromYaml) -}}
     2  {{- if .Values.queryFrontend.enabled }}
     3  apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
     4  kind: Deployment
     5  metadata:
     6    name: {{ include "common.names.fullname" . }}-query-frontend
     7    namespace: {{ .Release.Namespace | quote }}
     8    labels: {{- include "common.labels.standard" . | nindent 4 }}
     9      app.kubernetes.io/component: query-frontend
    10      {{- if .Values.commonLabels }}
    11      {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    12      {{- end }}
    13    {{- if .Values.commonAnnotations }}
    14    annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    15    {{- end }}
    16  spec:
    17    {{- if not .Values.queryFrontend.autoscaling.enabled }}
    18    replicas: {{ .Values.queryFrontend.replicaCount }}
    19    {{- end }}
    20    {{- if .Values.queryFrontend.updateStrategy }}
    21    strategy: {{- toYaml .Values.queryFrontend.updateStrategy | nindent 4 }}
    22    {{- end }}
    23    selector:
    24      matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
    25        app.kubernetes.io/component: query-frontend
    26    template:
    27      metadata:
    28        labels: {{- include "common.labels.standard" . | nindent 8 }}
    29          app.kubernetes.io/component: query-frontend
    30          {{- if .Values.commonLabels }}
    31          {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }}
    32          {{- end }}
    33          {{- if .Values.queryFrontend.podLabels }}
    34          {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.podLabels "context" $) | nindent 8 }}
    35          {{- end }}
    36        {{- if or .Values.queryFrontend.podAnnotations (include "thanos.queryFrontend.createConfigmap" .) }}
    37        annotations:
    38          {{- if (include "thanos.queryFrontend.createConfigmap" .) }}
    39          checksum/query-frontend-configuration: {{ include (print $.Template.BasePath "/query-frontend/configmap.yaml") . | sha256sum }}
    40          {{- end }}
    41          {{- if .Values.queryFrontend.podAnnotations }}
    42          {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.podAnnotations "context" $) | nindent 8 }}
    43          {{- end }}
    44        {{- end }}
    45      spec:
    46        {{- include "thanos.imagePullSecrets" . | nindent 6 }}
    47        serviceAccount: {{ include "thanos.serviceAccountName" (dict "component" "query-frontend" "context" $) }}
    48        automountServiceAccountToken: {{ .Values.queryFrontend.automountServiceAccountToken }}
    49        {{- if .Values.queryFrontend.hostAliases }}
    50        hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.hostAliases "context" $) | nindent 8 }}
    51        {{- end }}
    52        {{- if .Values.queryFrontend.affinity }}
    53        affinity: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.affinity "context" $) | nindent 8 }}
    54        {{- else }}
    55        affinity:
    56          podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.queryFrontend.podAffinityPreset "component" "query-frontend" "context" $) | nindent 10 }}
    57          podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.queryFrontend.podAntiAffinityPreset "component" "query-frontend" "context" $) | nindent 10 }}
    58          nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.queryFrontend.nodeAffinityPreset.type "key" .Values.queryFrontend.nodeAffinityPreset.key "values" .Values.queryFrontend.nodeAffinityPreset.values) | nindent 10 }}
    59        {{- end }}
    60        {{- if .Values.queryFrontend.nodeSelector }}
    61        nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.nodeSelector "context" $) | nindent 8 }}
    62        {{- end }}
    63        {{- if .Values.queryFrontend.tolerations }}
    64        tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.tolerations "context" $) | nindent 8 }}
    65        {{- end }}
    66        {{- if .Values.queryFrontend.priorityClassName }}
    67        priorityClassName: {{ .Values.queryFrontend.priorityClassName | quote }}
    68        {{- end }}
    69        {{- if .Values.queryFrontend.schedulerName }}
    70        schedulerName: {{ .Values.queryFrontend.schedulerName }}
    71        {{- end }}
    72        {{- if .Values.queryFrontend.podSecurityContext.enabled }}
    73        securityContext: {{- omit .Values.queryFrontend.podSecurityContext "enabled" | toYaml | nindent 8 }}
    74        {{- end }}
    75        {{- if .Values.queryFrontend.topologySpreadConstraints }}
    76        topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.topologySpreadConstraints "context" $) | nindent 8 }}
    77        {{- end }}
    78        {{- if .Values.queryFrontend.initContainers }}
    79        initContainers: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.initContainers "context" $) | nindent 8 }}
    80        {{- end }}
    81        containers:
    82          {{- if .Values.queryFrontend.sidecars }}
    83          {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.sidecars "context" $) | nindent 8 }}
    84          {{- end }}
    85          - name: query-frontend
    86            image: {{ include "thanos.image" . }}
    87            imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
    88            {{- if .Values.queryFrontend.containerSecurityContext.enabled }}
    89            securityContext: {{- omit .Values.queryFrontend.containerSecurityContext "enabled" | toYaml | nindent 12 }}
    90            {{- end }}
    91            {{- if .Values.queryFrontend.command }}
    92            command: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.command "context" $) | nindent 12 }}
    93            {{- end }}
    94            args:
    95              {{- if .Values.queryFrontend.args }}
    96              {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.args "context" $) | nindent 12 }}
    97              {{- else }}
    98              - query-frontend
    99              - --log.level={{ .Values.queryFrontend.logLevel }}
   100              - --log.format={{ .Values.queryFrontend.logFormat }}
   101              - --http-address=0.0.0.0:10902
   102              - --query-frontend.downstream-url=http://{{ include "common.names.fullname" . }}-query:{{ if $query.service.http }}{{ coalesce $query.service.ports.http $query.service.http.port }}{{ else }}{{ $query.service.ports.http }}{{ end }}
   103              {{- if (include "thanos.httpConfigEnabled" .) }}
   104              - --http.config=/conf/http/http-config.yml
   105              {{- end }}
   106              {{- if or .Values.queryFrontend.config .Values.queryFrontend.existingConfigmap }}
   107              - --query-range.response-cache-config-file=/conf/cache/config.yml
   108              {{- end }}
   109              {{- if .Values.queryFrontend.extraFlags }}
   110              {{- .Values.queryFrontend.extraFlags | toYaml | nindent 12 }}
   111              {{- end }}
   112              {{- end }}
   113            {{- if .Values.queryFrontend.extraEnvVars }}
   114            env: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraEnvVars "context" $) | nindent 12 }}
   115            {{- end }}
   116            {{- if or .Values.queryFrontend.extraEnvVarsCM .Values.queryFrontend.extraEnvVarsSecret }}
   117            envFrom:
   118              {{- if .Values.queryFrontend.extraEnvVarsCM }}
   119              - configMapRef:
   120                  name: {{ include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraEnvVarsCM "context" $) }}
   121              {{- end }}
   122              {{- if .Values.queryFrontend.extraEnvVarsSecret }}
   123              - secretRef:
   124                  name: {{ include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraEnvVarsSecret "context" $) }}
   125              {{- end }}
   126            {{- end }}
   127            ports:
   128              - name: http
   129                containerPort: 10902
   130                protocol: TCP
   131            {{- if .Values.queryFrontend.customLivenessProbe }}
   132            livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.customLivenessProbe "context" $) | nindent 12 }}
   133            {{- else if .Values.queryFrontend.livenessProbe.enabled }}
   134            livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.queryFrontend.livenessProbe "enabled") "context" $) | nindent 12 }}
   135              {{- if not .Values.auth.basicAuthUsers }}
   136              httpGet:
   137                path: /-/healthy
   138                port: http
   139                scheme: {{ ternary "HTTPS" "HTTP" .Values.https.enabled }}
   140              {{- else }}
   141              tcpSocket:
   142                port: http
   143              {{- end }}
   144            {{- end }}
   145            {{- if .Values.queryFrontend.customReadinessProbe }}
   146            readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.customReadinessProbe "context" $) | nindent 12 }}
   147            {{- else if .Values.queryFrontend.readinessProbe.enabled }}
   148            readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.queryFrontend.readinessProbe "enabled") "context" $) | nindent 12 }}
   149              {{- if not .Values.auth.basicAuthUsers }}
   150              httpGet:
   151                path: /-/ready
   152                port: http
   153                scheme: {{ ternary "HTTPS" "HTTP" .Values.https.enabled }}
   154              {{- else }}
   155              tcpSocket:
   156                port: http
   157              {{- end }}
   158            {{- end }}
   159            {{- if .Values.queryFrontend.customStartupProbe }}
   160            startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.customStartupProbe "context" $) | nindent 12 }}
   161            {{- else if .Values.queryFrontend.startupProbe.enabled }}
   162            startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.queryFrontend.startupProbe "enabled") "context" $) | nindent 12 }}
   163              {{- if not .Values.auth.basicAuthUsers }}
   164              httpGet:
   165                path: /-/ready
   166                port: http
   167                scheme: {{ ternary "HTTPS" "HTTP" .Values.https.enabled }}
   168              {{- else }}
   169              tcpSocket:
   170                port: http
   171              {{- end }}
   172            {{- end }}
   173            {{- if .Values.queryFrontend.lifecycleHooks }}
   174            lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.lifecycleHooks "context" $) | nindent 12 }}
   175            {{- end }}
   176            {{- if .Values.queryFrontend.resources }}
   177            resources: {{- toYaml .Values.queryFrontend.resources | nindent 12 }}
   178            {{- end }}
   179            volumeMounts:
   180              {{- if or .Values.queryFrontend.config .Values.queryFrontend.existingConfigmap }}
   181              - name: cache-config
   182                mountPath: /conf/cache
   183              {{- end }}
   184              {{- if (include "thanos.httpConfigEnabled" .) }}
   185              - name: http-config
   186                mountPath: /conf/http
   187              {{- if .Values.https.enabled }}
   188              - name: http-certs
   189                mountPath: /certs
   190              {{- end }}
   191              {{- end }}
   192              {{- if .Values.queryFrontend.extraVolumeMounts }}
   193              {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraVolumeMounts "context" $) | nindent 12 }}
   194              {{- end }}
   195        volumes:
   196          {{- if (include "thanos.httpConfigEnabled" .) }}
   197          - name: http-config
   198            secret:
   199              secretName: {{ include "thanos.httpConfigSecretName" . }}
   200          {{- if .Values.https.enabled }}
   201          - name: http-certs
   202            secret:
   203              secretName: {{ include "thanos.httpCertsSecretName" . }}
   204          {{- end }}
   205          {{- end }}
   206          {{- if or .Values.queryFrontend.config .Values.queryFrontend.existingConfigmap }}
   207          - name: cache-config
   208            configMap:
   209              name: {{ include "thanos.queryFrontend.configmapName" . }}
   210          {{- end }}
   211          {{- if .Values.queryFrontend.extraVolumes }}
   212          {{- include "common.tplvalues.render" (dict "value" .Values.queryFrontend.extraVolumes "context" $) | nindent 8 }}
   213          {{- end }}
   214  {{- end }}