github.com/verrazzano/verrazzano@v1.7.0/platform-operator/thirdparty/charts/thanos/templates/compactor/_pod-template.tpl (about)

     1  {{/* vim: set filetype=mustache: */}}
     2  
     3  {{/*
     4  Compactor pod template. Shared between Cronjob and deployment
     5  */}}
     6  {{- define "thanos.compactor.podTemplate" -}}
     7  metadata:
     8    labels: {{- include "common.labels.standard" . | nindent 4 }}
     9      app.kubernetes.io/component: compactor
    10      {{- if .Values.commonLabels }}
    11      {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    12      {{- end }}
    13      {{- if .Values.compactor.podLabels }}
    14      {{- include "common.tplvalues.render" (dict "value" .Values.compactor.podLabels "context" $) | nindent 4 }}
    15      {{- end }}
    16    annotations:
    17      checksum/objstore-configuration: {{ include (print $.Template.BasePath "/objstore-secret.yaml") . | sha256sum }}
    18      {{- if .Values.compactor.podAnnotations }}
    19      {{- include "common.tplvalues.render" (dict "value" .Values.compactor.podAnnotations "context" $) | nindent 4 }}
    20      {{- end }}
    21  spec:
    22    {{- include "thanos.imagePullSecrets" . | nindent 2 }}
    23    serviceAccount: {{ include "thanos.serviceAccountName" (dict "component" "compactor" "context" $) }}
    24    automountServiceAccountToken: {{ .Values.compactor.automountServiceAccountToken }}
    25    {{- if .Values.compactor.hostAliases }}
    26    hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.hostAliases "context" $) | nindent 4 }}
    27    {{- end }}
    28    {{- if .Values.compactor.affinity }}
    29    affinity: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.affinity "context" $) | nindent 4 }}
    30    {{- else }}
    31    affinity:
    32      podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.compactor.podAffinityPreset "component" "compactor" "context" $) | nindent 6 }}
    33      podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.compactor.podAntiAffinityPreset "component" "compactor" "context" $) | nindent 6 }}
    34      nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.compactor.nodeAffinityPreset.type "key" .Values.compactor.nodeAffinityPreset.key "values" .Values.compactor.nodeAffinityPreset.values) | nindent 6 }}
    35    {{- end }}
    36    {{- if .Values.compactor.nodeSelector }}
    37    nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.nodeSelector "context" $) | nindent 4 }}
    38    {{- end }}
    39    {{- if .Values.compactor.tolerations }}
    40    tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.tolerations "context" $) | nindent 4 }}
    41    {{- end }}
    42    {{- if .Values.compactor.priorityClassName }}
    43    priorityClassName: {{ .Values.compactor.priorityClassName | quote }}
    44    {{- end }}
    45    {{- if .Values.compactor.schedulerName }}
    46    schedulerName: {{ .Values.compactor.schedulerName }}
    47    {{- end }}
    48    {{- if .Values.compactor.podSecurityContext.enabled }}
    49    securityContext: {{- omit .Values.compactor.podSecurityContext "enabled" | toYaml | nindent 4 }}
    50    {{- end }}
    51    {{- if .Values.compactor.topologySpreadConstraints }}
    52    topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.topologySpreadConstraints "context" $) | nindent 4 }}
    53    {{- end }}
    54    {{- if .Values.compactor.restartPolicy }}
    55    restartPolicy: {{ .Values.compactor.restartPolicy }}
    56    {{- else if .Values.compactor.cronJob.enabled }}
    57    restartPolicy: Never
    58    {{- end }}
    59    {{- if or .Values.compactor.initContainers (and .Values.volumePermissions.enabled .Values.compactor.persistence.enabled) }}
    60    initContainers:
    61      {{- if and .Values.volumePermissions.enabled .Values.compactor.persistence.enabled }}
    62      - name: init-chmod-data
    63        image: {{ include "thanos.volumePermissions.image" . }}
    64        imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
    65        command:
    66          - sh
    67          - -c
    68          - |
    69            mkdir -p /data
    70            chown -R "{{ .Values.compactor.containerSecurityContext.runAsUser }}:{{ .Values.compactor.podSecurityContext.fsGroup }}" /data
    71        securityContext:
    72          runAsUser: 0
    73        volumeMounts:
    74          - name: data
    75            mountPath: /data
    76      {{- end }}
    77      {{- if .Values.compactor.initContainers }}
    78      {{- include "common.tplvalues.render" (dict "value" .Values.compactor.initContainers "context" $) | nindent 4 }}
    79      {{- end }}
    80    {{- end }}
    81    containers:
    82      {{- if .Values.compactor.sidecars }}
    83      {{- include "common.tplvalues.render" (dict "value" .Values.compactor.sidecars "context" $) | nindent 4 }}
    84      {{- end }}
    85      - name: compactor
    86        image: {{ include "thanos.image" . }}
    87        imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
    88        {{- if .Values.compactor.containerSecurityContext.enabled }}
    89        securityContext: {{- omit .Values.compactor.containerSecurityContext "enabled" | toYaml | nindent 8 }}
    90        {{- end }}
    91        {{- if .Values.compactor.command }}
    92        command: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.command "context" $) | nindent 8 }}
    93        {{- end }}
    94        args:
    95          {{- if .Values.compactor.args }}
    96          {{- include "common.tplvalues.render" (dict "value" .Values.compactor.args "context" $) | nindent 8 }}
    97          {{- else }}
    98          - compact
    99          - --log.level={{ .Values.compactor.logLevel }}
   100          - --log.format={{ .Values.compactor.logFormat }}
   101          - --http-address=0.0.0.0:10902
   102          - --data-dir=/data
   103          - --retention.resolution-raw={{ .Values.compactor.retentionResolutionRaw }}
   104          - --retention.resolution-5m={{ .Values.compactor.retentionResolution5m }}
   105          - --retention.resolution-1h={{ .Values.compactor.retentionResolution1h }}
   106          - --consistency-delay={{ .Values.compactor.consistencyDelay }}
   107          - --objstore.config-file=/conf/objstore.yml
   108          {{- if (include "thanos.httpConfigEnabled" .) }}
   109          - --http.config=/conf/http/http-config.yml
   110          {{- end }}
   111          {{- if .Values.compactor.extraFlags }}
   112          {{- .Values.compactor.extraFlags | toYaml | nindent 8 }}
   113          {{- end }}
   114          {{- if not .Values.compactor.cronJob.enabled }}
   115          - --wait
   116          {{- end }}
   117          {{- end }}
   118        {{- if .Values.compactor.extraEnvVars }}
   119        env: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.extraEnvVars "context" $) | nindent 8 }}
   120        {{- end }}
   121        {{- if or .Values.compactor.extraEnvVarsCM .Values.compactor.extraEnvVarsSecret }}
   122        envFrom:
   123          {{- if .Values.compactor.extraEnvVarsCM }}
   124          - configMapRef:
   125              name: {{ include "common.tplvalues.render" (dict "value" .Values.compactor.extraEnvVarsCM "context" $) }}
   126          {{- end }}
   127          {{- if .Values.compactor.extraEnvVarsSecret }}
   128          - secretRef:
   129              name: {{ include "common.tplvalues.render" (dict "value" .Values.compactor.extraEnvVarsSecret "context" $) }}
   130          {{- end }}
   131        {{- end }}
   132        ports:
   133          - name: http
   134            containerPort: 10902
   135            protocol: TCP
   136        {{- if .Values.compactor.customLivenessProbe }}
   137        livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.customLivenessProbe "context" $) | nindent 8 }}
   138        {{- else if .Values.compactor.livenessProbe.enabled }}
   139        livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.compactor.livenessProbe "enabled") "context" $) | nindent 8 }}
   140          {{- if not .Values.auth.basicAuthUsers }}
   141          httpGet:
   142            path: /-/healthy
   143            port: http
   144            scheme: {{ ternary "HTTPS" "HTTP" .Values.https.enabled }}
   145          {{- else }}
   146          tcpSocket:
   147            port: http
   148          {{- end }}
   149        {{- end }}
   150        {{- if .Values.compactor.customReadinessProbe }}
   151        readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.customReadinessProbe "context" $) | nindent 8 }}
   152        {{- else if .Values.compactor.readinessProbe.enabled }}
   153        readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.compactor.readinessProbe "enabled") "context" $) | nindent 8 }}
   154          {{- if not .Values.auth.basicAuthUsers }}
   155          httpGet:
   156            path: /-/ready
   157            port: http
   158            scheme: {{ ternary "HTTPS" "HTTP" .Values.https.enabled }}
   159          {{- else }}
   160          tcpSocket:
   161            port: http
   162          {{- end }}
   163        {{- end }}
   164        {{- if .Values.compactor.customStartupProbe }}
   165        startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.customStartupProbe "context" $) | nindent 8 }}
   166        {{- else if .Values.compactor.startupProbe.enabled }}
   167        startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.compactor.startupProbe "enabled") "context" $) | nindent 8 }}
   168          {{- if not .Values.auth.basicAuthUsers }}
   169          httpGet:
   170            path: /-/ready
   171            port: http
   172            scheme: {{ ternary "HTTPS" "HTTP" .Values.https.enabled }}
   173          {{- else }}
   174          tcpSocket:
   175            port: http
   176          {{- end }}
   177        {{- end }}
   178        {{- if .Values.compactor.lifecycleHooks }}
   179        lifecycle: {{- include "common.tplvalues.render" (dict "value" .Values.compactor.lifecycleHooks "context" $) | nindent 8 }}
   180        {{- end }}
   181        {{- if .Values.compactor.resources }}
   182        resources: {{- toYaml .Values.compactor.resources | nindent 8 }}
   183        {{- end }}
   184        volumeMounts:
   185          - name: objstore-config
   186            mountPath: /conf
   187          {{- if (include "thanos.httpConfigEnabled" .) }}
   188          - name: http-config
   189            mountPath: /conf/http
   190          {{- if .Values.https.enabled }}
   191          - name: http-certs
   192            mountPath: /certs
   193          {{- end }}
   194          {{- end }}
   195          - name: data
   196            mountPath: /data
   197          {{- if .Values.compactor.extraVolumeMounts }}
   198          {{- include "common.tplvalues.render" (dict "value" .Values.compactor.extraVolumeMounts "context" $) | nindent 8 }}
   199          {{- end }}
   200    volumes:
   201      - name: objstore-config
   202        secret:
   203          secretName: {{ include "thanos.objstoreSecretName" . }}
   204          {{- if .Values.existingObjstoreSecretItems }}
   205          items: {{- toYaml .Values.existingObjstoreSecretItems | nindent 10 }}
   206          {{- end }}
   207      {{- if (include "thanos.httpConfigEnabled" .) }}
   208      - name: http-config
   209        secret:
   210          secretName: {{ include "thanos.httpConfigSecretName" . }}
   211      {{- if .Values.https.enabled }}
   212      - name: http-certs
   213        secret:
   214          secretName: {{ include "thanos.httpCertsSecretName" . }}
   215      {{- end }}
   216      {{- end }}
   217      - name: data
   218        {{- if .Values.compactor.persistence.enabled }}
   219        persistentVolumeClaim:
   220          claimName: {{ include "thanos.compactor.pvcName" . }}
   221        {{- else }}
   222        emptyDir: {}
   223        {{- end }}
   224      {{- if .Values.compactor.extraVolumes }}
   225      {{- include "common.tplvalues.render" (dict "value" .Values.compactor.extraVolumes "context" $) | nindent 4 }}
   226      {{- end }}
   227  {{- end -}}