kind: Deployment
apiVersion: apps/v1
metadata:
  name: openstack-cloud-controller-manager
  namespace: openshift-cloud-controller-manager
  labels:
    app: openstack-cloud-controller-manager
spec:
  replicas: 2
  selector:
    matchLabels:
      app: openstack-cloud-controller-manager
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
      labels:
        app: openstack-cloud-controller-manager
    spec:
      hostNetwork: true
      serviceAccount: cloud-controller-manager
      priorityClassName: system-cluster-critical
      nodeSelector:
        node-role.kubernetes.io/master: ""
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
          - topologyKey: "kubernetes.io/hostname"
            labelSelector:
              matchLabels:
                app: openstack-cloud-controller-manager
      tolerations:
        - key: CriticalAddonsOnly
          operator: Exists
        - key: node-role.kubernetes.io/master
          operator: Exists
          effect: "NoSchedule"
        - key: node.cloudprovider.kubernetes.io/uninitialized
          operator: Exists
          effect: NoSchedule
        - key: node.kubernetes.io/not-ready
          operator: Exists
          effect: NoSchedule
      containers:
        - name: cloud-controller-manager
          image: quay.io/openshift/origin-openstack-cloud-controller-manager
          imagePullPolicy: "IfNotPresent"
          env:
            - name: CLOUD_CONFIG
              value: /etc/openstack/config/cloud.conf
          command:
          - /bin/bash
          - -c
          - |
            #!/bin/bash
            set -o allexport
            if [[ -f /etc/kubernetes/apiserver-url.env ]]; then
              source /etc/kubernetes/apiserver-url.env
            fi
            exec /usr/bin/openstack-cloud-controller-manager \
            --v=1 \
            --cloud-config=$(CLOUD_CONFIG) \
            --cloud-provider=openstack \
            --use-service-account-credentials=true \
            --configure-cloud-routes=false \
            --bind-address=127.0.0.1 \
            --leader-elect=true \
            --leader-elect-lease-duration=137s \
            --leader-elect-renew-deadline=107s \
            --leader-elect-retry-period=26s \
            --leader-elect-resource-namespace=openshift-cloud-controller-manager
          ports:
          - containerPort: 10258
            name: https
            protocol: TCP
          resources:
            requests:
              cpu: 200m
              memory: 50Mi
          volumeMounts:
            - mountPath: /etc/kubernetes
              name: host-etc-kube
              readOnly: true
            - name: secret-occm
              mountPath: /etc/openstack/secret
              readOnly: true
            - name: config-occm
              mountPath: /etc/openstack/config
              readOnly: true
            - name: trusted-ca
              mountPath: /etc/pki/ca-trust/extracted/pem
              readOnly: true
      volumes:
        - name: host-etc-kube
          hostPath:
            path: /etc/kubernetes
            type: Directory
        - name: secret-occm
          secret:
            secretName: openstack-cloud-credentials
            items:
              - key: clouds.yaml
                path: clouds.yaml
        - name: trusted-ca
          configMap:
            name: ccm-trusted-ca
            items:
              - key: ca-bundle.crt
                path: tls-ca-bundle.pem
        - name: config-occm
          configMap:
            name: openstack-cloud-controller-manager-config
            items:
              - key: cloud.conf
                path: cloud.conf
