# Example with two configmaps
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: ip-masq-agent
  namespace: default
  labels:
    component: ip-masq-agent
    kubernetes.io/cluster-service: "true"
    addonmanager.kubernetes.io/mode: Reconcile
spec:
  selector:
    matchLabels:
      k8s-app: ip-masq-agent
  template:
    metadata:
      labels:
        k8s-app: ip-masq-agent
    spec:
      hostNetwork: true
      containers:
      - name: ip-masq-agent
        image: docker.io/mattstam/ip-masq-agent:v2.6.1-11-gabd856e-dirty__linux_amd64
        imagePullPolicy: Always
        args:
          - --v=2
        securityContext:
          privileged: false
          capabilities:
            add: ["NET_ADMIN", "NET_RAW"]
        # Uses projected volumes to merge all data in /etc/config
        volumeMounts:
          - name: ip-masq-agent-volume
            mountPath: /etc/config
            readOnly: true
      volumes:
      - name: ip-masq-agent-volume
        projected:
          sources:
            # Note these ConfigMaps must be created in the same namespace as the daemonset
            - configMap:
                name: ip-masq-agent-config
                optional: true
                items:
                  - key: ip-masq-agent
                    path: ip-masq-agent
                    mode: 444
            - configMap:
                name: ip-masq-agent-config-cloud
                optional: true
                items:
                  # Avoiding duplicate paths
                  - key: ip-masq-agent-cloud
                    path: ip-masq-agent-cloud
                    mode: 444
