apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    k8s-app: pod-checkpointer
  name: pod-checkpointer
  namespace: openshift-pod-checkpointer
spec:
  selector:
    matchLabels:
      k8s-app: pod-checkpointer
  template:
    metadata:
      labels:
        k8s-app: pod-checkpointer
      annotations:
        checkpointer.alpha.coreos.com/checkpoint: "true"
    spec:
      containers:
        - name: pod-checkpointer
          command:
            - /checkpoint
            - --kubeconfig=/etc/kubernetes/kubeconfig
            - --container-runtime-endpoint=unix:///var/run/crio/crio.sock
            - --lock-file=/var/run/lock/pod-checkpointer.lock
            - --checkpoint-grace-period=5m
          env:
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          imagePullPolicy: Always
          volumeMounts:
            - mountPath: /etc/kubernetes
              name: etc-kubernetes
            - mountPath: /var/run
              name: var-run
      serviceAccountName: pod-checkpointer-operator
      hostNetwork: true
      nodeSelector:
        node-role.kubernetes.io/master: ""
      restartPolicy: Always
      tolerations:
        - key: node-role.kubernetes.io/master
          operator: Exists
          effect: NoSchedule
      volumes:
        - name: etc-kubernetes
          hostPath:
            path: /etc/kubernetes
        - name: var-run
          hostPath:
            path: /var/run
  updateStrategy:
    rollingUpdate:
      maxUnavailable: 1
    type: RollingUpdate
