Like Prometheus, but for logs.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
loki/production/helm/loki/templates/tokengen/job-tokengen.yaml

130 lines
4.8 KiB

{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
{{ if and $isSimpleScalable .Values.enterprise.tokengen.enabled .Values.enterprise.enabled }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: {{ template "enterprise-logs.tokengenFullname" . }}
labels:
{{- include "enterprise-logs.tokengenLabels" . | nindent 4 }}
{{- with .Values.enterprise.tokengen.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
annotations:
{{- with .Values.enterprise.tokengen.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
"helm.sh/hook": post-install
"helm.sh/hook-weight": "10"
spec:
backoffLimit: 6
completions: 1
parallelism: 1
template:
metadata:
labels:
{{- include "enterprise-logs.tokengenSelectorLabels" . | nindent 8 }}
{{- with .Values.enterprise.tokengen.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
annotations:
{{- with .Values.enterprise.tokengen.annotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.enterprise.tokengen.priorityClassName }}
priorityClassName: {{ . }}
{{- end }}
securityContext:
{{- toYaml .Values.enterprise.tokengen.securityContext | nindent 8 }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
{{- end }}
initContainers:
- name: loki
image: {{ template "loki.image" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
args:
- -config.file=/etc/loki/config/config.yaml
- -target={{ .Values.enterprise.tokengen.targetModule }}
- -tokengen.token-file=/shared/admin-token
{{- with .Values.enterprise.tokengen.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- if .Values.enterprise.tokengen.extraVolumeMounts }}
{{ toYaml .Values.enterprise.tokengen.extraVolumeMounts | nindent 12 }}
{{- end }}
- name: shared
mountPath: /shared
- name: config
mountPath: /etc/loki/config
- name: runtime-config
mountPath: /etc/loki/runtime-config
- name: license
mountPath: /etc/loki/license
env:
{{- if .Values.enterprise.tokengen.env }}
{{ toYaml .Values.enterprise.tokengen.env | nindent 12 }}
{{- end }}
{{- with .Values.enterprise.tokengen.extraEnvFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
containers:
- name: create-secret
image: {{ include "loki.kubectlImage" . }}
imagePullPolicy: {{ .Values.kubectlImage.pullPolicy }}
command:
- /bin/bash
- -euc
- |
kubectl create secret generic "{{ include "enterprise-logs.adminTokenSecret" . }}" --from-file=token=/shared/admin-token
{{- with .Values.enterprise.adminToken.additionalNamespaces }}
{{- range . }}
kubectl --namespace "{{ . }}" create secret generic "{{ include "enterprise-logs.adminTokenSecret" $ }}" --from-file=token=/shared/admin-token
{{- end }}
{{- end }}
volumeMounts:
{{- if .Values.enterprise.tokengen.extraVolumeMounts }}
{{ toYaml .Values.enterprise.tokengen.extraVolumeMounts | nindent 12 }}
{{- end }}
- name: shared
mountPath: /shared
- name: config
mountPath: /etc/loki/config
- name: license
mountPath: /etc/loki/license
restartPolicy: OnFailure
serviceAccount: {{ template "enterprise-logs.tokengenFullname" . }}
serviceAccountName: {{ template "enterprise-logs.tokengenFullname" . }}
{{- with .Values.enterprise.tokengen.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
{{- if .Values.enterprise.useExternalConfig }}
secret:
secretName: {{ .Values.enterprise.externalConfigName }}
{{- else }}
configMap:
name: {{ include "loki.name" . }}
{{- end }}
- name: runtime-config
configMap:
name: {{ template "loki.name" . }}-runtime
- name: license
secret:
{{- if .Values.enterprise.useExternalLicense }}
secretName: {{ .Values.enterprise.externalLicenseName }}
{{- else }}
secretName: enterprise-logs-license
{{- end }}
- name: shared
emptyDir: {}
{{- if .Values.enterprise.tokengen.extraVolumes }}
{{ toYaml .Values.enterprise.tokengen.extraVolumes | nindent 8 }}
{{- end }}
{{- end }}