apiVersion: apps/v1
kind: Deployment
metadata:
  name: metal3-baremetal-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: metal3-baremetal-operator
  template:
    metadata:
      labels:
        name: metal3-baremetal-operator
    spec:
      serviceAccountName: metal3-baremetal-operator
      hostNetwork: true
      containers:
        - name: baremetal-operator
          image: quay.io/metal3-io/baremetal-operator
          ports:
            - containerPort: 60000
              name: metrics
          command:
            - /baremetal-operator
          imagePullPolicy: Always
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: OPERATOR_NAME
              value: "baremetal-operator"
          envFrom:
            - configMapRef:
                name: ironic-bmo-configmap
        - name: ironic-dnsmasq
          image: quay.io/metal3-io/ironic
          imagePullPolicy: Always
          securityContext:
             capabilities:
               add: ["NET_ADMIN"]
          command:
            - /bin/rundnsmasq
          volumeMounts:
            - mountPath: /shared
              name: ironic-data-volume
          envFrom:
            - configMapRef:
                name: ironic-bmo-configmap
        - name: mariadb
          image: quay.io/metal3-io/ironic
          imagePullPolicy: Always
          command:
            - /bin/runmariadb
          volumeMounts:
            - mountPath: /shared
              name: ironic-data-volume
          env:
            - name: MARIADB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mariadb-password
                  key: password
        - name: ironic-httpd
          image: quay.io/metal3-io/ironic
          imagePullPolicy: Always
          securityContext:
             capabilities:
               add: ["NET_ADMIN"]
          command:
            - /bin/runhttpd
          volumeMounts:
            - mountPath: /shared
              name: ironic-data-volume
          envFrom:
            - configMapRef:
                name: ironic-bmo-configmap
        - name: ironic
          image: quay.io/metal3-io/ironic
          imagePullPolicy: Always
          command:
            - /bin/runironic
          volumeMounts:
            - mountPath: /shared
              name: ironic-data-volume
          envFrom:
            - configMapRef:
                name: ironic-bmo-configmap
          env:
            - name: MARIADB_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: mariadb-password
                  key: password
        - name: ironic-inspector
          image: quay.io/metal3-io/ironic-inspector
          imagePullPolicy: Always
          envFrom:
            - configMapRef:
                name: ironic-bmo-configmap
      initContainers:
        - name: ironic-ipa-downloader
          image: quay.io/metal3-io/ironic-ipa-downloader
          imagePullPolicy: Always
          command:
            - /usr/local/bin/get-resource.sh
          envFrom:
            - configMapRef:
                name: ironic-bmo-configmap
          volumeMounts:
            - mountPath: /shared
              name: ironic-data-volume
      volumes:
        - name: ironic-data-volume
          emptyDir: {}
