---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: contrail-image-installer
  namespace: contrail-system
  labels:
    app: contrail-image-download
spec:
  template:
    metadata:
      labels:
        app: contrail-image-download
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: "node-role.kubernetes.io/infra"
                operator: Exists
      hostNetwork: true
      initContainers:
      - name: contrail-download-contrail-status-image
        image: "{{ contrail_registry }}/contrail-status:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-redis-image
        image: "redis:4.0.2"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-node-init-image
        image: "{{ contrail_registry }}/contrail-node-init:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-node-manager-image
        image: "{{ contrail_registry }}/contrail-nodemgr:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-external-cassandra-image
        image: "{{ contrail_registry }}/contrail-external-cassandra:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-external-zookeeper-image
        image: "{{ contrail_registry }}/contrail-external-zookeeper:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-external-rabbitmq-image
        image: "{{ contrail_registry }}/contrail-external-rabbitmq:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-external-kafka-image
        image: "{{ contrail_registry }}/contrail-external-kafka:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-analytics-api-image
        image: "{{ contrail_registry }}/contrail-analytics-api:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-analytics-collector-image
        image: "{{ contrail_registry }}/contrail-analytics-collector:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-analytics-alarm-gen-image
        image: "{{ contrail_registry }}/contrail-analytics-alarm-gen:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-analytics-query-engine-image
        image: "{{ contrail_registry }}/contrail-analytics-query-engine:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-analytics-snmp-collector-image
        image: "{{ contrail_registry }}/contrail-analytics-snmp-collector:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-analytics-topology-image
        image: "{{ contrail_registry }}/contrail-analytics-snmp-topology:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-controller-control-image
        image: "{{ contrail_registry }}/contrail-controller-control-control:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-controller-control-dns-image
        image: "{{ contrail_registry }}/contrail-controller-control-dns:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-controller-control-named-image
        image: "{{ contrail_registry }}/contrail-controller-control-named:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-controller-config-image
        image: "{{ contrail_registry }}/contrail-controller-config-api:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-controller-config-devicemgr-image
        image: "{{ contrail_registry }}/contrail-controller-config-devicemgr:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-controller-config-schema-image
        image: "{{ contrail_registry }}/contrail-controller-config-schema:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-controller-config-svc-monitor-image
        image: "{{ contrail_registry }}/contrail-controller-config-svcmonitor:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-controller-webui-job-image
        image: "{{ contrail_registry }}/contrail-controller-webui-job:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-controller-webui-web-image
        image: "{{ contrail_registry }}/contrail-controller-webui-web:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      - name: contrail-download-controller-kube-manager-image
        image: "{{ contrail_registry }}/contrail-kubernetes-kube-manager:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["/bin/true"]
      containers:
      - name: contrail-download-image
        image: "{{ contrail_registry }}/contrail-status:{{ contrail_container_tag }}"
        imagePullPolicy: "IfNotPresent"
        command: ["tailf","/dev/null"]
        securityContext:
          privileged: true
{% if contrail_registry_username is defined and contrail_registry_password %}
      imagePullSecrets:
      - name: contrail-registry-secret
{% endif %}
