<commit_before>{{- if .Values.nodeinit.enabled }}
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: cilium-node-init
  namespace: {{ .Release.Namespace }}
  labels:
    app: cilium-node-init
spec:
  selector:
    matchLabels:
      app: cilium-node-init
  template:
    metadata:
      annotations:
        {{- with .Values.nodeinit.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      labels:
        app: cilium-node-init
        {{- with .Values.nodeinit.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | trim | nindent 8 }}
      {{- end }}
      hostPID: true
      hostNetwork: true
      priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.nodeinit.priorityClassName "system-node-critical") }}
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      volumes:
      # To access iptables concurrently with other processes (e.g. kube-proxy)
      - hostPath:
          path: /run/xtables.lock
          type: FileOrCreate
        name: xtables-lock
      containers:
        - name: node-init
          image: {{ include "cilium.image" .Values.nodeinit.image | quote }}
          imagePullPolicy: {{ .Values.nodeinit.image.pullPolicy }}
          securityContext:
            privileged: true
          volumeMounts:
            # To access iptables concurrently with other processes (e.g. kube-proxy)
            - mountPath: /run/xtables.lock
              name: xtables-lock
          lifecycle:
{{- if and (.Values.eni.enabled) (not .Values.enableIPv4Masquerade) }}
            postStart:
              exec:
                command:
                  - "/bin/sh"
                  - "-c"
                  - |
                    {{- tpl (.Files.Get "files/nodeinit/poststart.bash") . | nindent 20 }}
{{- end }}
{{- if .Values.nodeinit.revertReconfigureKubelet }}
            preStop:
              exec:
                command:
                  - nsenter
                  - --target=1
                  - --mount
                  - --
                  - /bin/sh
                  - -c
                  - |
                    {{- tpl (.Files.Get "files/nodeinit/prestop.bash") . | nindent 20 }}
          {{- end }}
          env:
          - name: CHECKPOINT_PATH
            value: /tmp/node-init.cilium.io
          # STARTUP_SCRIPT is the script run on node bootstrap. Node
          # bootstrapping can be customized in this script. This script is invoked
          # using nsenter, so it runs in the host's network and mount namespace using
          # the host's userland tools!
          - name: STARTUP_SCRIPT<commit_msg>helm: remove the masquerade check in poststart<commit_after>{{- if .Values.nodeinit.enabled }}
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: cilium-node-init
  namespace: {{ .Release.Namespace }}
  labels:
    app: cilium-node-init
spec:
  selector:
    matchLabels:
      app: cilium-node-init
  template:
    metadata:
      annotations:
        {{- with .Values.nodeinit.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      labels:
        app: cilium-node-init
        {{- with .Values.nodeinit.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | trim | nindent 8 }}
      {{- end }}
      hostPID: true
      hostNetwork: true
      priorityClassName: {{ include "cilium.priorityClass" (list $ .Values.nodeinit.priorityClassName "system-node-critical") }}
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      volumes:
      # To access iptables concurrently with other processes (e.g. kube-proxy)
      - hostPath:
          path: /run/xtables.lock
          type: FileOrCreate
        name: xtables-lock
      containers:
        - name: node-init
          image: {{ include "cilium.image" .Values.nodeinit.image | quote }}
          imagePullPolicy: {{ .Values.nodeinit.image.pullPolicy }}
          securityContext:
            privileged: true
          volumeMounts:
            # To access iptables concurrently with other processes (e.g. kube-proxy)
            - mountPath: /run/xtables.lock
              name: xtables-lock
          lifecycle:
{{- if .Values.eni.enabled }}
            postStart:
              exec:
                command:
                  - "/bin/sh"
                  - "-c"
                  - |
                    {{- tpl (.Files.Get "files/nodeinit/poststart.bash") . | nindent 20 }}
{{- end }}
{{- if .Values.nodeinit.revertReconfigureKubelet }}
            preStop:
              exec:
                command:
                  - nsenter
                  - --target=1
                  - --mount
                  - --
                  - /bin/sh
                  - -c
                  - |
                    {{- tpl (.Files.Get "files/nodeinit/prestop.bash") . | nindent 20 }}
          {{- end }}
          env:
          - name: CHECKPOINT_PATH
            value: /tmp/node-init.cilium.io
          # STARTUP_SCRIPT is the script run on node bootstrap. Node
          # bootstrapping can be customized in this script. This script is invoked
          # using nsenter, so it runs in the host's network and mount namespace using
          # the host's userland tools!
          - name: STARTUP_SCRIPT
{'fraction_non_alphanumeric': 0.1163839769036449, 'fraction_numerical': 0.0037892457596535546, 'mean_word_length': 1.454827280779451, 'pattern_counts': {'":': 0, '<': 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': '418105', 'n_tokens_mistral': 1656, 'n_tokens_neox': 1573, 'n_words': 372}