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

     1  {{- if .Values.query.enabled }}
     2  apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }}
     3  kind: Deployment
     4  metadata:
     5    name: {{ include "common.names.fullname" . }}-query
     6    namespace: {{ .Release.Namespace | quote }}
     7    labels: {{- include "common.labels.standard" . | nindent 4 }}
     8      app.kubernetes.io/component: query
     9      {{- if .Values.commonLabels }}
    10      {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    11      {{- end }}
    12    {{- if .Values.commonAnnotations }}
    13    annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    14    {{- end }}
    15  spec:
    16    {{- if not .Values.query.autoscaling.enabled }}
    17    replicas: {{ .Values.query.replicaCount }}
    18    {{- end }}
    19    {{- if .Values.query.updateStrategy }}
    20    strategy: {{- toYaml .Values.query.updateStrategy | nindent 4 }}
    21    {{- end }}
    22    selector:
    23      matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
    24        app.kubernetes.io/component: query
    25    template:
    26      metadata:
    27        labels: {{- include "common.labels.standard" . | nindent 8 }}
    28          app.kubernetes.io/component: query
    29          {{- if .Values.commonLabels }}
    30          {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }}
    31          {{- end }}
    32          {{- if .Values.query.podLabels }}
    33          {{- include "common.tplvalues.render" (dict "value" .Values.query.podLabels "context" $) | nindent 8 }}
    34          {{- end }}
    35        {{- if or (include "thanos.query.createSDConfigmap" .) .Values.query.existingSDConfigmap .Values.query.podAnnotations }}
    36        annotations:
    37          {{- if or (include "thanos.query.createSDConfigmap" .) .Values.query.existingSDConfigmap }}
    38          checksum/ruler-configuration: {{ include (print $.Template.BasePath "/query/sd-configmap.yaml") . | sha256sum }}
    39          {{- end }}
    40          {{- if .Values.query.podAnnotations }}
    41          {{- include "common.tplvalues.render" (dict "value" .Values.query.podAnnotations "context" $) | nindent 8 }}
    42          {{- end }}
    43        {{- end }}
    44      spec:
    45        {{- include "thanos.imagePullSecrets" . | nindent 6 }}
    46        serviceAccount: {{ include "thanos.serviceAccountName" (dict "component" "query" "context" $) }}
    47        automountServiceAccountToken: {{ .Values.query.automountServiceAccountToken }}
    48        {{- if .Values.query.hostAliases }}
    49        hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.query.hostAliases "context" $) | nindent 8 }}
    50        {{- end }}
    51        {{- if .Values.query.affinity }}
    52        affinity: {{- include "common.tplvalues.render" (dict "value" .Values.query.affinity "context" $) | nindent 8 }}
    53        {{- else }}
    54        affinity:
    55          podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.query.podAffinityPreset "component" "query" "context" $) | nindent 10 }}
    56          podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.query.podAntiAffinityPreset "component" "query" "topologyKey" .Values.query.podAntiAffinityPresetTopologyKey "context" $) | nindent 10 }}
    57          nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.query.nodeAffinityPreset.type "key" .Values.query.nodeAffinityPreset.key "values" .Values.query.nodeAffinityPreset.values) | nindent 10 }}
    58        {{- end }}
    59        {{- if .Values.query.nodeSelector }}
    60        nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.query.nodeSelector "context" $) | nindent 8 }}
    61        {{- end }}
    62        {{- if .Values.query.tolerations }}
    63        tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.query.tolerations "context" $) | nindent 8 }}
    64        {{- end }}
    65        {{- if .Values.query.priorityClassName }}
    66        priorityClassName: {{ .Values.query.priorityClassName | quote }}
    67        {{- end }}
    68        {{- if .Values.query.schedulerName }}
    69        schedulerName: {{ .Values.query.schedulerName }}
    70        {{- end }}
    71        {{- if .Values.query.podSecurityContext.enabled }}
    72        securityContext: {{- omit .Values.query.podSecurityContext "enabled" | toYaml | nindent 8 }}
    73        {{- end }}
    74        {{- if .Values.query.topologySpreadConstraints }}
    75        topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.query.topologySpreadConstraints "context" $) | nindent 8 }}
    76        {{- end }}
    77        {{- if .Values.query.initContainers }}
    78        initContainers: {{- include "common.tplvalues.render" (dict "value" .Values.query.initContainers "context" $) | nindent 8 }}
    79        {{- end }}
    80        containers:
    81          {{- if .Values.query.sidecars }}
    82          {{- include "common.tplvalues.render" (dict "value" .Values.query.sidecars "context" $) | nindent 8 }}
    83          {{- end }}
    84          - name: query
    85            image: {{ include "thanos.image" . }}
    86            imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
    87            {{- if .Values.query.containerSecurityContext.enabled }}
    88            securityContext: {{- omit .Values.query.containerSecurityContext "enabled" | toYaml | nindent 12 }}
    89            {{- end }}
    90            {{- if .Values.query.command }}
    91            command: {{- include "common.tplvalues.render" (dict "value" .Values.query.command "context" $) | nindent 12 }}
    92            {{- end }}
    93            args:
    94              {{- if .Values.query.args }}
    95              {{- include "common.tplvalues.render" (dict "value" .Values.query.args "context" $) | nindent 12 }}
    96              {{- else }}
    97              - query
    98              - --log.level={{ .Values.query.logLevel }}
    99              - --log.format={{ .Values.query.logFormat }}
   100              - --grpc-address=0.0.0.0:10901
   101              - --http-address=0.0.0.0:10902
   102              {{- if (include "thanos.httpConfigEnabled" .) }}
   103              - --http.config=/conf/http/http-config.yml
   104              {{- end }}
   105              {{- if kindIs "string" .Values.query.replicaLabel }}
   106              - --query.replica-label={{ .Values.query.replicaLabel }}
   107              {{- else }}
   108              {{- range .Values.query.replicaLabel }}
   109              - --query.replica-label={{ . }}
   110              {{- end }}
   111              {{- end }}
   112              {{- if or (include "thanos.query.createSDConfigmap" .) .Values.query.existingSDConfigmap }}
   113              - --store.sd-files=/conf/sd/servicediscovery.yml
   114              {{- end }}
   115              {{- if and .Values.query.dnsDiscovery.enabled .Values.query.dnsDiscovery.sidecarsService .Values.query.dnsDiscovery.sidecarsNamespace }}
   116              - --endpoint=dnssrv+_grpc._tcp.{{- include "common.tplvalues.render" ( dict "value" .Values.query.dnsDiscovery.sidecarsService "context" $) -}}.{{- include "common.tplvalues.render"  ( dict "value" .Values.query.dnsDiscovery.sidecarsNamespace "context" $) -}}.svc.{{ .Values.clusterDomain }}
   117              {{- end }}
   118              {{- if and .Values.storegateway.enabled .Values.storegateway.sharded.enabled }}
   119              {{- $shards := int 0 }}
   120              {{- if .Values.storegateway.sharded.hashPartitioning.shards }}
   121              {{- $shards = int .Values.storegateway.sharded.hashPartitioning.shards }}
   122              {{- else }}
   123              {{- $shards = len .Values.storegateway.sharded.timePartitioning }}
   124              {{- end }}
   125              {{- range $index, $_ := until $shards }}
   126              - --endpoint=dnssrv+_grpc._tcp.{{ include "common.names.fullname" $ }}-storegateway-{{ toString $index }}.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}
   127              {{- end }}
   128              {{- end }}
   129              {{- if and .Values.storegateway.enabled .Values.query.dnsDiscovery.enabled (not .Values.storegateway.sharded.enabled ) }}
   130              - --endpoint=dnssrv+_grpc._tcp.{{ include "common.names.fullname" . }}-storegateway{{ if .Values.storegateway.service.additionalHeadless }}-headless{{ end }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
   131              {{- end }}
   132              {{- if and .Values.ruler.enabled .Values.query.dnsDiscovery.enabled }}
   133              - --endpoint=dnssrv+_grpc._tcp.{{ include "common.names.fullname" . }}-ruler{{ if .Values.ruler.service.additionalHeadless }}-headless{{ end }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
   134              {{- end }}
   135              {{- if and .Values.receive.enabled .Values.query.dnsDiscovery.enabled }}
   136              - --endpoint=dnssrv+_grpc._tcp.{{ include "common.names.fullname" . }}-receive{{ if .Values.receive.service.additionalHeadless }}-headless{{ end }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
   137              {{- end }}
   138              {{- range .Values.query.stores }}
   139              - --endpoint={{ . }}
   140              {{- end }}
   141              {{- if .Values.query.grpc.server.tls.enabled }}
   142              - --grpc-server-tls-cert=/certs/server/{{ include "common.secrets.key" (dict "existingSecret" .Values.query.grpc.server.tls.existingSecret "key" "tls-cert") }}
   143              - --grpc-server-tls-key=/certs/server/{{ include "common.secrets.key" (dict "existingSecret" .Values.query.grpc.server.tls.existingSecret "key" "tls-key") }}
   144              - --grpc-server-tls-client-ca=/certs/server/{{ include "common.secrets.key" (dict "existingSecret" .Values.query.grpc.server.tls.existingSecret "key" "ca-cert") }}
   145              {{- end }}
   146              {{- if .Values.query.grpc.client.tls.enabled }}
   147              - --grpc-client-tls-secure
   148              - --grpc-client-tls-cert=/certs/client/{{ include "common.secrets.key" (dict "existingSecret" .Values.query.grpc.client.tls.existingSecret "key" "tls-cert") }}
   149              - --grpc-client-tls-key=/certs/client/{{ include "common.secrets.key" (dict "existingSecret" .Values.query.grpc.client.tls.existingSecret "key" "tls-key") }}
   150              - --grpc-client-tls-ca=/certs/client/{{ include "common.secrets.key" (dict "existingSecret" .Values.query.grpc.client.tls.existingSecret "key" "ca-cert") }}
   151              {{- end }}
   152              {{- if .Values.query.grpc.client.serverName }}
   153              - --grpc-client-server-name={{ .Values.query.grpc.client.serverName }}
   154              {{- end }}
   155              {{- if .Values.query.extraFlags }}
   156              {{- .Values.query.extraFlags | toYaml | nindent 12 }}
   157              {{- end }}
   158              {{- end }}
   159            {{- if .Values.query.extraEnvVars }}
   160            env: {{- include "common.tplvalues.render" (dict "value" .Values.query.extraEnvVars "context" $) | nindent 12 }}
   161            {{- end }}
   162            {{- if or .Values.query.extraEnvVarsCM .Values.query.extraEnvVarsSecret }}
   163            envFrom:
   164              {{- if .Values.query.extraEnvVarsCM }}
   165              - configMapRef:
   166                  name: {{ include "common.tplvalues.render" (dict "value" .Values.query.extraEnvVarsCM "context" $) }}
   167              {{- end }}
   168              {{- if .Values.query.extraEnvVarsSecret }}
   169              - secretRef:
   170                  name: {{ include "common.tplvalues.render" (dict "value" .Values.query.extraEnvVarsSecret "context" $) }}
   171              {{- end }}
   172            {{- end }}
   173            ports:
   174              - name: http
   175                containerPort: 10902
   176                protocol: TCP
   177              - name: grpc
   178                containerPort: 10901
   179                protocol: TCP
   180            {{- if .Values.query.customLivenessProbe }}
   181            livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.query.customLivenessProbe "context" $) | nindent 12 }}
   182            {{- else if .Values.query.livenessProbe.enabled }}
   183            livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.query.livenessProbe "enabled") "context" $) | nindent 12 }}
   184              {{- if not .Values.auth.basicAuthUsers }}
   185              httpGet:
   186                path: /-/healthy
   187                port: http
   188                scheme: {{ ternary "HTTPS" "HTTP" .Values.https.enabled }}
   189              {{- else }}
   190              tcpSocket:
   191                port: http
   192              {{- end }}
   193            {{- end }}
   194            {{- if .Values.query.customReadinessProbe }}
   195            readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.query.customReadinessProbe "context" $) | nindent 12 }}
   196            {{- else if .Values.query.readinessProbe.enabled }}
   197            readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.query.readinessProbe "enabled") "context" $) | nindent 12 }}
   198              {{- if not .Values.auth.basicAuthUsers }}
   199              httpGet:
   200                path: /-/ready
   201                port: http
   202                scheme: {{ ternary "HTTPS" "HTTP" .Values.https.enabled }}
   203              {{- else }}
   204              tcpSocket:
   205                port: http
   206              {{- end }}
   207            {{- end }}
   208            {{- if .Values.query.customStartupProbe }}
   209            startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.query.customStartupProbe "context" $) | nindent 12 }}
   210            {{- else if .Values.query.startupProbe.enabled }}
   211            startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.query.startupProbe "enabled") "context" $) | nindent 12 }}
   212              {{- if not .Values.auth.basicAuthUsers }}
   213              httpGet:
   214                path: /-/ready
   215                port: http
   216                scheme: {{ ternary "HTTPS" "HTTP" .Values.https.enabled }}
   217              {{- else }}
   218              tcpSocket:
   219                port: http
   220              {{- end }}
   221            {{- end }}
   222            {{- if .Values.query.lifecycleHooks }}
   223            lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.query.lifecycleHooks "context" $) | nindent 12 }}
   224            {{- end }}
   225            {{- if .Values.query.resources }}
   226            resources: {{- toYaml .Values.query.resources | nindent 12 }}
   227            {{- end }}
   228            volumeMounts:
   229              {{- if (include "thanos.httpConfigEnabled" .) }}
   230              - name: http-config
   231                mountPath: /conf/http
   232              {{- if .Values.https.enabled }}
   233              - name: http-certs
   234                mountPath: /certs
   235              {{- end }}
   236              {{- end }}
   237              {{- if or (include "thanos.query.createSDConfigmap" .) .Values.query.existingSDConfigmap }}
   238              - name: sd-config
   239                mountPath: /conf/sd
   240              {{- end }}
   241              {{- if .Values.query.grpc.server.tls.enabled }}
   242              - name: grpc-server-tls
   243                mountPath: /certs/server
   244              {{- end }}
   245              {{- if .Values.query.grpc.client.tls.enabled }}
   246              - name: grpc-client-tls
   247                mountPath: /certs/client
   248              {{- end }}
   249              {{- if .Values.query.extraVolumeMounts }}
   250              {{- include "common.tplvalues.render" (dict "value" .Values.query.extraVolumeMounts "context" $) | nindent 12 }}
   251              {{- end }}
   252        volumes:
   253          {{- if (include "thanos.httpConfigEnabled" .) }}
   254          - name: http-config
   255            secret:
   256              secretName: {{ include "thanos.httpConfigSecretName" . }}
   257          {{- if .Values.https.enabled }}
   258          - name: http-certs
   259            secret:
   260              secretName: {{ include "thanos.httpCertsSecretName" . }}
   261          {{- end }}
   262          {{- end }}
   263          {{- if or (include "thanos.query.createSDConfigmap" .) .Values.query.existingSDConfigmap }}
   264          - name: sd-config
   265            configMap:
   266              name: {{ include "thanos.query.SDConfigmapName" . }}
   267          {{- end }}
   268          {{- if .Values.query.grpc.server.tls.enabled }}
   269          - name: grpc-server-tls
   270            secret:
   271              secretName: {{ include "common.secrets.name" (dict "existingSecret" .Values.query.grpc.server.tls.existingSecret "defaultNameSuffix" "query-grpc-server" "context" $) }}
   272          {{- end }}
   273          {{- if .Values.query.grpc.client.tls.enabled }}
   274          - name: grpc-client-tls
   275            secret:
   276              secretName: {{ include "common.secrets.name" (dict "existingSecret" .Values.query.grpc.client.tls.existingSecret "defaultNameSuffix" "query-grpc-client" "context" $) }}
   277          {{- end }}
   278          {{- if .Values.query.extraVolumes }}
   279          {{- include "common.tplvalues.render" (dict "value" .Values.query.extraVolumes "context" $) | nindent 8 }}
   280          {{- end }}
   281  {{- end }}