<commit_before>{{- $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
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:
      {{- if .Values.enterprise.tokengen.priorityClassName }}
      priorityClassName: {{ .Values.enterprise.tokengen.priorityClassName }}
      {{- end }}
      securityContext:
        {{- toYaml .Values.enterprise.tokengen.securityContext | nindent 8 }}
      {{- if .Values.imagePullSecrets }}
      imagePullSecrets:
      {{- range .Values.imagePullSecrets }}
        - name: {{ . }}
      {{- end }}
      {{- end }}
      initContainers:
        - name: loki
          image: {{ template "loki.image" . }}
          imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
          args:
            - -config.file=/etc/loki/config/config.yaml
            - -target=tokengen
            - -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<commit_msg>[Helm] Updating tokgen job imagePullSecret templating (#7524)<commit_after>{{- $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
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:
      {{- if .Values.enterprise.tokengen.priorityClassName }}
      priorityClassName: {{ .Values.enterprise.tokengen.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=tokengen
            - -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
{'fraction_non_alphanumeric': 0.14721485411140584, 'fraction_numerical': 0.007736516357206013, 'mean_word_length': 2.0146568954030646, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7318018', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1398, 'n_words': 243}