apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: contrail-controller-control
  namespace: kube-system
  labels:
    app: contrail-controller-control
spec:
  selector:
    matchLabels:
      app: contrail-controller-control
  template:
    metadata:
      labels:
        app: contrail-controller-control
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: "node-role.kubernetes.io/master"
                    operator: Exists
      tolerations:
        - key: node-role.kubernetes.io/master
          operator: Exists
          effect: NoSchedule
        - key: node.kubernetes.io/not-ready
          operator: Exists
          effect: NoSchedule
      hostNetwork: true
      initContainers:
        - name: contrail-node-init
          image: "hub.juniper.net/contrail/contrail-node-init:2011.138"
          imagePullPolicy: IfNotPresent
          securityContext:
            privileged: true
          env:
            - name: CONTRAIL_STATUS_IMAGE
              value: "hub.juniper.net/contrail/contrail-status:2011.138"
          envFrom:
            - configMapRef:
                name: env
          volumeMounts:
            - mountPath: /host/usr/bin
              name: host-usr-bin

      containers:
        - name: contrail-controller-control
          image: "hub.juniper.net/contrail/contrail-controller-control-control:2011.138"
          imagePullPolicy: IfNotPresent
          envFrom:
            - configMapRef:
                name: env
          volumeMounts:
            - mountPath: /var/log/contrail
              name: control-logs

        - name: contrail-controller-control-dns
          image: "hub.juniper.net/contrail/contrail-controller-control-dns:2011.138"
          imagePullPolicy: IfNotPresent
          envFrom:
            - configMapRef:
                name: env
          volumeMounts:
            - mountPath: /etc/contrail
              name: dns-config
            - mountPath: /var/log/contrail
              name: control-logs

        - name: contrail-controller-control-named
          image: "hub.juniper.net/contrail/contrail-controller-control-named:2011.138"
          imagePullPolicy: IfNotPresent
          envFrom:
            - configMapRef:
                name: env
          securityContext:
            privileged: true
          volumeMounts:
            - mountPath: /etc/contrail
              name: dns-config
            - mountPath: /var/log/contrail
              name: control-logs

        - name: contrail-controller-nodemgr
          image: "hub.juniper.net/contrail/contrail-nodemgr:2011.138"
          imagePullPolicy: IfNotPresent
          envFrom:
            - configMapRef:
                name: env
            - configMapRef:
                name: configzookeeperenv
            - configMapRef:
                name: nodemgr-config
          env:
            - name: NODE_TYPE
              value: control
          volumeMounts:
            - mountPath: /var/log/contrail
              name: control-logs
            - mountPath: /mnt
              name: docker-unix-socket

        - name: contrail-controller-provisioner
          image: "hub.juniper.net/contrail/contrail-provisioner:2011.138"
          imagePullPolicy: IfNotPresent
          envFrom:
            - configMapRef:
                name: env
            - configMapRef:
                name: defaults-env
            - configMapRef:
                name: configzookeeperenv
            - configMapRef:
                name: nodemgr-config
          env:
            - name: NODE_TYPE
              value: control
          volumeMounts:
            - mountPath: /var/log/contrail
              name: control-logs

      imagePullSecrets:
        - name: contrail-registry
      volumes:
        - name: control-logs
          hostPath:
            path: /var/log/contrail/control
        - name: docker-unix-socket
          hostPath:
            path: /var/run
        - name: dns-config
          emptyDir: {}
        - name: host-usr-bin
          hostPath:
            path: /usr/bin
