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
-
If needed run
make generate
to re-generate auto generated files -
If needed, run
make vendor
to sync all imports in go.mod file and in vendor directory -
To build the project, run
make build
TODO
-
Prepare The Openshift Cluster
Two options:
-
Use Openshift cluster
In order to be able removemachine-controller
container frommachine-api-controllers
deployment, need to removemachine-api-operator
andopenshift-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\
-
Use CRC cluster
Create CRC cluster, using the following instructions:
https://code-ready.github.io/crc/#introducing-codeready-containers_gsg\- Increase the default memory size provided by CRC (at list 20 Gib)
- Use CRC in remote machine, not your private machine, use the following instructions for remote access:
https://www.openshift.com/blog/accessing-codeready-containers-on-a-remote-server/
In the CRC, several operators have been disabled to lower the resource usage,
machine-api-operator
andopenshift-cluster-version
are among those operator, therefore, in order to deploymachine-api-controllers
in the cluster, runmachine-api-operator
locally on your machine, using the instructions under:
https://github.com/openshift/machine-api-operator#dev
-
-
Tear down machine-controller
Deployed machine API plane (
machine-api-controllers
deployment) is (among other controllers) runningmachine-controller
.
In order to run locally built one, simply editmachine-api-controllers
deployment and removemachine-controller
container from it. -
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
-
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
-
Build and run KubeVirt actuator outside of the cluster
$ make build
$ ./bin/machine-controller-manager --kubeconfig $KUBECONFIG --logtostderr -v 5 -alsologtostderr