apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    k8s-app: yurt-operator-agent
  name: agent
  namespace: kube-system
spec:
  selector:
    matchLabels:
      k8s-app: yurt-operator-agent
  template:
    metadata:
      labels:
        k8s-app: yurt-operator-agent
    spec:
      volumes:
        - name: host-var-tmp
          hostPath:
            path: /var/tmp
            type: Directory
        - name: kubernetes
          hostPath:
            path: /etc/kubernetes
            type: Directory
      initContainers:
        - command:
            - sh
            - -c
            - |
              cp /assets/* /tmp/
          image: openyurt-operator-agent:v1.0.2
          imagePullPolicy: IfNotPresent
          name: yurt-operator-prepare
          volumeMounts:
            - mountPath: /tmp
              name: host-var-tmp
      containers:
        - command:
            - /agent
          args:
            - --node-name=$(NODE_NAME)
          image: openyurt-operator-agent:v1.0.2
          imagePullPolicy: IfNotPresent
          name: yurt-operator-agent
          env:
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
          securityContext:
            privileged: true
          volumeMounts:
            - mountPath: /tmp
              name: host-var-tmp
            - mountPath: /etc/kubernetes
              name: kubernetes
          resources:
            limits:
              cpu: 1000m
              memory: 1024Mi
            requests:
              cpu: 100m
              memory: 20Mi
      hostNetwork: true
      hostPID: true
      serviceAccountName: yurt-operator-agent
      restartPolicy: Always
      tolerations:
        - operator: Exists
