apiVersion: apps/v1
kind: DaemonSet
metadata:
  labels:
    k8s-app: yurt-tunnel-agent
  name: yurt-tunnel-agent
  namespace: kube-system
spec:
  selector:
    matchLabels:
      k8s-app: yurt-tunnel-agent
  template:
    metadata:
      labels:
        k8s-app: yurt-tunnel-agent
    spec:
      nodeSelector:
        beta.kubernetes.io/os: linux
        openyurt.io/edge-enable-reverseTunnel-client: "true"
      containers:
      - command:
        - yurt-tunnel-agent
        args:
        - --node-name=$(NODE_NAME)
        - --v=2
        image: openyurt/yurt-tunnel-agent:latest
        imagePullPolicy: IfNotPresent
        name: yurt-tunnel-agent
        volumeMounts:
        - name: k8s-dir
          mountPath: /etc/kubernetes
        - name: kubelet-pki
          mountPath: /var/lib/kubelet/pki
        - name: tunnel-agent-dir
          mountPath: /var/lib/yurttunnel-agent
        env:
        - name: NODE_NAME
          valueFrom:
            fieldRef:
              fieldPath: spec.nodeName
        - name: POD_IP
          valueFrom:
            fieldRef:
              fieldPath: status.podIP
        - name: NODE_IP
          valueFrom:
            fieldRef:
              fieldPath: status.hostIP
      hostNetwork: true
      restartPolicy: Always
      volumes:
      - name: k8s-dir
        hostPath:
          path: /etc/kubernetes
          type: Directory
      - name: kubelet-pki
        hostPath:
          path: /var/lib/kubelet/pki
          type: Directory
      - name: tunnel-agent-dir
        hostPath:
          path: /var/lib/yurttunnel-agent
          type: DirectoryOrCreate
