apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: tuned
  namespace: openshift-cluster-node-tuning-operator
  labels:
    openshift-app: tuned
spec:
  selector:
    matchLabels:
      openshift-app: tuned
  template:
    metadata:
      labels:
        openshift-app: tuned
    spec:
      serviceAccountName: tuned
      automountServiceAccountToken: true
      containers:
      - command: ["/var/lib/tuned/bin/run","start"]
        resources:
          requests:
            cpu: 10m
            memory: 50Mi
        image: ${CLUSTER_NODE_TUNED_IMAGE}
        imagePullPolicy: IfNotPresent
        lifecycle:
          preStop:
            exec:
              command: ["/var/lib/tuned/bin/run","stop"]
        name: tuned
        securityContext:
          privileged: true
        terminationMessagePolicy: FallbackToLogsOnError
        volumeMounts:
        - mountPath: /etc/tuned/recommend.d
          name: etc-tuned-recommend
        - mountPath: /var/lib/tuned/profiles-data
          name: var-lib-tuned-profiles-data
        - mountPath: /sys
          name: sys
        - mountPath: /var/run/dbus
          name: var-run-dbus
          readOnly: true
        - mountPath: /run/systemd/system
          name: run-systemd-system
          readOnly: true
        - mountPath: /lib/modules
          name: lib-modules
          readOnly: true
        - mountPath: /etc/grub.d
          name: etc-grub
        - mountPath: /etc/default/grub
          name: etc-default-grub
        - mountPath: /boot/grub2
          name: boot-grub2
        - mountPath: /etc/grub2.cfg
          name: boot-grub2-cfg
        - mountPath: /etc/grub2-efi.cfg
          name: boot-grub2-cfg
        env:
          - name: OCP_NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: RESYNC_PERIOD
            value: "60"
          - name: RELEASE_VERSION
            value: ""
      volumes:
      - hostPath:
          path: /sys
        name: sys
      - hostPath:
          path: /var/run/dbus
        name: var-run-dbus
      - hostPath:
          path: /run/systemd/system
        name: run-systemd-system
      - hostPath:
          path: /lib/modules
        name: lib-modules
      - hostPath:
          path: /boot/grub2
        name: boot-grub2
      - hostPath:
          path: /boot/grub2/grub.cfg
          type: File
        name: boot-grub2-cfg
      - hostPath:
          path: /etc/grub.d
        name: etc-grub
      - hostPath:
          path: /etc/default/grub
        name: etc-default-grub
      - configMap:
          items:
          - key: tuned-ocp-recommend
            path: 50-openshift.conf
          name: tuned-recommend
          optional: true
        name: etc-tuned-recommend
      - configMap:
          items:
          - key: tuned-profiles-data
            path: tuned-profiles.yaml
          name: tuned-profiles
          optional: true
        name: var-lib-tuned-profiles-data
      dnsPolicy: ClusterFirst
      nodeSelector:
        kubernetes.io/os: linux
      priorityClassName: "system-node-critical"
      hostNetwork: true
      hostPID: true
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      tolerations:
      # tolerate all taints so that tuned is always present on all nodes
      - operator: Exists
