tokengen-job.yaml 3.41 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
{{- if .Values.enterprise.enabled -}}
{{ if .Values.tokengenJob.enable }}
{{ $dict := dict "ctx" . "component" "tokengen-job" }}
apiVersion: batch/v1
kind: Job
metadata:
  name: {{ include "tempo.resourceName" $dict }}
  labels:
    {{- include "tempo.labels" $dict | nindent 4 }}
  annotations:
    {{- if .Values.tokengenJob.annotations }}
    {{- toYaml .Values.tokengenJob.annotations | nindent 4 }}
    {{- end }}
    "helm.sh/hook": post-install
  namespace: {{ .Release.Namespace | quote }}
spec:
  backoffLimit: 6
  completions: 1
  parallelism: 1
  selector:
  template:
    metadata:
      labels:
        {{- include "tempo.podLabels" $dict | nindent 8 }}
        {{- with .Values.tokengenJob.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      namespace: {{ .Release.Namespace | quote }}
    spec:
      serviceAccountName: {{ template "tempo.serviceAccountName" . }}
      {{- if .Values.tokengenJob.priorityClassName }}
      priorityClassName: {{ .Values.tokengenJob.priorityClassName }}
      {{- end }}
      securityContext:
        {{- toYaml .Values.tokengenJob.securityContext | nindent 8 }}
      {{- if .Values.tempo.image.pullSecrets }}
      imagePullSecrets:
      {{- range .Values.tempo.image.pullSecrets }}
        - name: {{ . }}
      {{- end }}
      {{- end }}
      {{- with .Values.tokengenJob.hostAliases }}
      hostAliases:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      initContainers:
        {{- toYaml .Values.tokengenJob.initContainers | nindent 8 }}
      containers:
        - name: tokengen
          image: "{{ include "tempo.imageReference" $dict }}"
          imagePullPolicy: {{ .Values.tempo.image.pullPolicy }}
          args:
            - "-target=tokengen"
            - "-config.expand-env=true"
            - "-config.file=/conf/tempo.yaml"
            {{- range $key, $value := .Values.tokengenJob.extraArgs }}
            - "-{{ $key }}={{ $value }}"
            {{- end }}
          volumeMounts:
            - mountPath: /conf
              name: config
            - mountPath: /runtime-config
              name: runtime-config
            - name: license
              mountPath: /license
            {{- if .Values.tokengenJob.extraVolumeMounts }}
              {{ toYaml .Values.tokengenJob.extraVolumeMounts | nindent 12 }}
            {{- end }}
          env:
            {{- with .Values.global.extraEnv }}
              {{ toYaml . | nindent 12 }}
            {{- end }}
            {{- with .Values.tokengenJob.env }}
              {{ toYaml . | nindent 12 }}
            {{- end }}
          envFrom:
            {{- with .Values.global.extraEnvFrom }}
              {{- toYaml . | nindent 12 }}
            {{- end }}
            {{- with .Values.tokengenJob.extraEnvFrom }}
              {{- toYaml . | nindent 12 }}
            {{- end }}
          securityContext:
            {{- toYaml .Values.tokengenJob.containerSecurityContext | nindent 12 }}
      restartPolicy: OnFailure
      volumes:
        - name: config
          {{- include "tempo.configVolume" . | nindent 10 }}
        - name: runtime-config
          {{- include "tempo.runtimeVolume" . | nindent 10 }}
        {{- if .Values.tokengenJob.extraVolumes }}
        {{ toYaml .Values.tokengenJob.extraVolumes | nindent 8 }}
        {{- end }}
        - name: license
          secret:
            secretName: {{ tpl .Values.license.secretName . }}
        - name: storage
          emptyDir: {}
{{- end -}}
{{- end -}}