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
        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
      - 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
