# This yaml brings up node agent as a DaemonSet, which takes FlexVolume driver connection.
# A detailed tutorial will be added soon.
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: nodeagent
spec:
  template:
    metadata:
      labels:
        app: nodeagent
        version: v1
    spec:
      initContainers:
      - name: flexvol-driver
        image: gcr.io/istio-testing/flexvol:latest
        volumeMounts:
        - name: flexvol-driver-host
          mountPath: /host/driver
      containers:
      - name: nodeagent
        image: gcr.io/istio-testing/nodeagent:latest
        imagePullPolicy: Always
        command: ["/main"]
        args: ["--ca-address=istio-ca.istio-system.svc.cluster.local:8060"]
        volumeMounts:
        - name: test-mgmt
          mountPath: /tmp/udsuspver
        - name: test-workload
          mountPath: /tmp/nodeagent
      volumes:
        - name: test-mgmt
          hostPath:
            # directory location on host for the mgmt api between flexvolume driver and nodeagent
            type: DirectoryOrCreate
            path: /tmp/udsuspver
        - name: test-workload
          hostPath:
            # directory location on host for the uds between nodeagent and workload
            type: DirectoryOrCreate
            path: /tmp/nodeagent
        - name: flexvol-driver-host
          hostPath:
            type: DirectoryOrCreate
            path: /home/kubernetes/flexvolume/nodeagent~uds
