Files
devops-infra-helm-charts-gcp/helm-templates/mimir-distributed/templates/tokengen/tokengen-job.yaml
T
2026-08-26 03:39:42 +05:30

105 lines
3.8 KiB
YAML

{{- if .Values.enterprise.enabled -}}
{{ if .Values.tokengenJob.enable }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "mimir.resourceName" (dict "ctx" . "component" "tokengen") }}
labels:
{{- include "mimir.labels" (dict "ctx" . "component" "tokengen") | 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 "mimir.podLabels" (dict "ctx" . "component" "tokengen") | nindent 8 }}
annotations:
{{- include "mimir.podAnnotations" (dict "ctx" . "component" "tokengen") | nindent 8 }}
namespace: {{ .Release.Namespace | quote }}
spec:
serviceAccountName: {{ template "mimir.serviceAccountName" . }}
{{- if .Values.tokengenJob.priorityClassName }}
priorityClassName: {{ .Values.tokengenJob.priorityClassName }}
{{- end }}
securityContext:
{{- include "mimir.lib.podSecurityContext" (dict "ctx" . "component" "tokengen") | nindent 8 }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
initContainers:
{{- toYaml .Values.tokengenJob.initContainers | nindent 8 }}
containers:
- name: tokengen
image: "{{ include "mimir.imageReference" . }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "-target=tokengen"
- "-config.expand-env=true"
- "-config.file=/etc/mimir/mimir.yaml"
{{- range $key, $value := .Values.tokengenJob.extraArgs }}
- "-{{ $key }}={{ $value }}"
{{- end }}
volumeMounts:
{{- if .Values.tokengenJob.extraVolumeMounts }}
{{ toYaml .Values.tokengenJob.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- if .Values.global.extraVolumeMounts }}
{{ toYaml .Values.global.extraVolumeMounts | nindent 12 }}
{{- end }}
- name: config
mountPath: /etc/mimir
- name: license
mountPath: /license
- name: active-queries
mountPath: /active-query-tracker
{{- if or .Values.global.extraEnv .Values.tokengenJob.env }}
env:
{{- with .Values.global.extraEnv }}
{{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.tokengenJob.env }}
{{ toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if or .Values.global.extraEnvFrom .Values.tokengenJob.extraEnvFrom }}
envFrom:
{{- with .Values.global.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.tokengenJob.extraEnvFrom }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
securityContext:
{{- toYaml .Values.tokengenJob.containerSecurityContext | nindent 12 }}
restartPolicy: OnFailure
volumes:
- name: config
{{- include "mimir.configVolume" . | nindent 10 }}
{{- if .Values.tokengenJob.extraVolumes }}
{{ toYaml .Values.tokengenJob.extraVolumes | nindent 8 }}
{{- end }}
{{- if .Values.global.extraVolumes }}
{{ toYaml .Values.global.extraVolumes | nindent 8 }}
{{- end }}
- name: license
secret:
secretName: {{ tpl .Values.license.secretName . }}
- name: storage
emptyDir: {}
- name: active-queries
emptyDir: {}
{{- end -}}
{{- end -}}