elmiko / cluster-api-provider-kubevirt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenShift cluster-api-provider-kubevirt

This repository hosts an implementation of a provider for KubeVirt for the OpenShift machine-api.

This provider runs as a machine-controller deployed by the machine-api-operator

Build the code

  1. If needed run make generate to re-generate auto generated files

  2. If needed, run make vendor to sync all imports in go.mod file and in vendor directory

  3. To build the project, run make build

Create and deploy image

TODO

Test locally built KubeVirt actuator

  1. Prepare The Openshift Cluster

    Two options:

    1. Use Openshift cluster
      In order to be able remove machine-controller container from machine-api-controllers deployment, need to remove machine-api-operator and openshift-cluster-version pods from the cluster, by decresing their replicacount in the deployments to zero:

      oc scale --replicas 0 -n openshift-cluster-version deployments/cluster-version-operator\
      oc scale --replicas 0 -n openshift-machine-api deployments/machine-api-operator\
    2. Use CRC cluster

      Create CRC cluster, using the following instructions:
      https://code-ready.github.io/crc/#introducing-codeready-containers_gsg\

      In the CRC, several operators have been disabled to lower the resource usage, machine-api-operator and openshift-cluster-version are among those operator, therefore, in order to deploy machine-api-controllers in the cluster, run machine-api-operator locally on your machine, using the instructions under:
      https://github.com/openshift/machine-api-operator#dev

  2. Tear down machine-controller

    Deployed machine API plane (machine-api-controllers deployment) is (among other controllers) running machine-controller.
    In order to run locally built one, simply edit machine-api-controllers deployment and remove machine-controller container from it.

  3. Deploy secret with the infra-cluster kubeconfig

    KubeVirt actuator assumes existence of a secret created from kubeconfig file.
    If needed, generate the secret using the following command:

    oc -n openshift-machine-api create secret generic infracluster-kubeconfig-config --from-file=kubeconfig=$KUBECONFIG
  4. Create PVC template

    KubeVirt actuator assumes existence of a pvc template.
    If needed, generate it using the following command:

    oc create -f examples/pvc-from-url-rhcos.yaml
  5. Build and run KubeVirt actuator outside of the cluster

    $ make build
    $ ./bin/machine-controller-manager --kubeconfig $KUBECONFIG --logtostderr -v 5 -alsologtostderr

About

License:Apache License 2.0


Languages

Language:Go 91.5%Language:Shell 5.7%Language:Makefile 2.4%Language:Dockerfile 0.4%