apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: openstack-discoverer
    cluster: origin
  name: openstack-discoverer
  namespace: gimbal-discovery
spec:
  selector:
    matchLabels:
      app: openstack-discoverer
      cluster: openstack
  replicas: 1
  template:
    metadata:
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/port: "8080"
      labels:
        app: openstack-discoverer
        cluster: openstack
    spec:
      containers:
        - image: gcr.io/heptio-images/gimbal-discoverer:v0.4.0
          imagePullPolicy: Always
          name: openstack-discoverer
          command: ["/openstack-discoverer"]
          args: ["--backend-name", "$(CLUSTER_NAME)", "--openstack-certificate-authority","/etc/remote-openstack-config/ca.pem"]
          env:
            - name: CLUSTER_NAME
              valueFrom:
                secretKeyRef:
                  name: remote-discover-openstack
                  key: backend-name
            - name: OS_USERNAME
              valueFrom:
                secretKeyRef:
                  name: remote-discover-openstack
                  key: username
            - name: OS_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: remote-discover-openstack
                  key: password
            - name: OS_AUTH_URL
              valueFrom:
                secretKeyRef:
                  name: remote-discover-openstack
                  key: auth-url
            - name: OS_TENANT_NAME
              valueFrom:
                secretKeyRef:
                  name: remote-discover-openstack
                  key: tenant-name
          volumeMounts:
          - name: discover-openstack-config
            readOnly: true
            mountPath: "/etc/remote-openstack-config"
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8000
            initialDelaySeconds: 30
            periodSeconds: 60
      volumes:
        - name: discover-openstack-config
          secret:
            secretName: remote-discover-openstack
            items:
            - key: certificate-authority-data
              path: ca.pem
      dnsPolicy: ClusterFirst
      serviceAccountName: gimbal-discoverer
      terminationGracePeriodSeconds: 30
