apiVersion: v1
kind: Namespace
metadata:
  labels:
    controller-tools.k8s.io: "1.0"
  name: ovirt-cluster-provider-system
---
apiVersion: v1
kind: Service
metadata:
  labels:
    control-plane: controller-manager
    controller-tools.k8s.io: "1.0"
  name: ovirt-cluster-provider-controller-manager-service
  namespace: ovirt-cluster-provider-system
spec:
  ports:
  - port: 443
  selector:
    control-plane: controller-manager
    controller-tools.k8s.io: "1.0"
---
apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    control-plane: controller-manager
    controller-tools.k8s.io: "1.0"
  name: cloud-selector
  namespace: ovirt-cluster-provider-system
data:
  OS_CLOUD: >
    url: https://ovirt-engine-fqdn/ovirt-engine/api
    username: admin@internal
    password: 123
    cafile: /dev/null
    insecure: true
    # Data Center
    datacenter: Default
    # Cluster
    cluster: Default
    # Default Template ?
    template: coreos-7-x86_64
    # Default cpus
    cpus: 4
    # Default Memory
    memory: 16Gb
    # qcow url of the image to import?
    qcow_url:

---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: clusterapi-controllers
  namespace: ovirt-cluster-provider-system
  labels:
    control-plane: controller-manager
    controller-tools.k8s.io: "1.0"
spec:
  replicas: 1
  template:
    metadata:
      labels:
        control-plane: controller-manager
        controller-tools.k8s.io: "1.0"
    spec:
      tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
      - key: CriticalAddonsOnly
        operator: Exists
      - effect: NoExecute
        key: node.alpha.kubernetes.io/notReady
        operator: Exists
      - effect: NoExecute
        key: node.alpha.kubernetes.io/unreachable
        operator: Exists
      containers:
      - name: ovirt-machine-controller
        image: quay.io/rgolangh/ovirt-cluster-api-controller:latest
        volumeMounts:
        - name: config
          mountPath: /etc/kubernetes
        - name: sshkeys
          mountPath: /etc/sshkeys
        - name: cloud-config
          mountPath: /etc/ovirt
        - name: kubeadm
          mountPath: /usr/bin/kubeadm
        resources:
          requests:
            cpu: 100m
            memory: 20Mi
          limits:
            cpu: 100m
            memory: 30Mi
        env:
          - name: USER
            value: root
          - name: OS_CLOUD
            valueFrom:
              configMapKeyRef:
                name: cloud-selector
                key: OS_CLOUD
      volumes:
      - name: config
        hostPath:
          path: /etc/kubernetes
      - name: sshkeys
        secret:
          secretName: machine-controller-sshkeys
          defaultMode: 256
      - name: cloud-config
        secret:
          secretName: cloud-config
      - name: kubeadm
        hostPath:
          path: /usr/bin/kubeadm

