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

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