Kubevirt Web UI Operator
The kubernetes operator for managing Kubevirt Web UI deployment.
Leverages the operator-sdk.
Kubevirt-web-ui image repository on quay.io: quay.io/repository/kubevirt/kubevirt-web-ui
How to Run
Depending on your OpenShift cluster installation, please choose from the two variants bellow.
If Cluster Console
(in openshift-console
project) is deployed (as by default), optional parameters can be automatically retrieved from its ConfigMap (follow Variant 1).
Otherwise they need to be explicitely provided (Variant 2).
Variant 1: The openshift-console Is Installed
To ease deployment, parameters of the cluster deployment can be automatically retrieved from the openshift-console
ConfigMap, if present.
To do so, the operator's service account will be granted to access the openshift-console
namespace.
oc new-project kubevirt-web-ui
oc apply -f deploy/service_account.yaml
oc adm policy add-scc-to-user anyuid -z kubevirt-web-ui-operator # use the "anyuid" string as it is
oc apply -f deploy/role.yaml
oc apply -f deploy/role_extra_for_console.yaml
oc apply -f deploy/role_binding.yaml
oc apply -f deploy/role_binding_extra_for_console.yaml
oc apply -f deploy/crds/kubevirt_v1alpha1_kwebui_crd.yaml
oc apply -f deploy/operator.yaml
Variant 2: The openshift-console Is Not Installed
In deploy/crds/kubevirt_v1alpha1_kwebui_cr.yaml
, add following under spec
section based on your actual OpenShift cluster deployment:
Then execute:
oc new-project kubevirt-web-ui
oc apply -f deploy/service_account.yaml
oc adm policy add-scc-to-user anyuid -z kubevirt-web-ui-operator
oc apply -f deploy/role.yaml
oc apply -f deploy/role_binding.yaml
oc apply -f deploy/crds/kubevirt_v1alpha1_kwebui_crd.yaml
oc apply -f deploy/operator.yaml
Kubevirt Web UI Version to Install
To actually deploy the Kubevirt Web UI, choose it's version by editting spec.version
in deploy/crds/kubevirt_v1alpha1_kwebui_cr.yaml
.
Example:
spec:
version: "1.4.0-4"
The image repository can be farther tweaked by using the spec.registry_url
and spec.registry_namespace
parameters.
To undeploy the Web UI, set spec.version
to empty string (""
).
By providing non-empty value here, the Web UI deployment is upgraded/downgraded.
Please note, the version
needs to match Web UI's docker image tag in the specified repository (seed default quay repo).
Fire Web UI Deployment
Actual Kubevirt Web UI deployment is managed via KWebUI
custom resource
Once spec.version
in the CR is set:
oc apply -f deploy/crds/kubevirt_v1alpha1_kwebui_cr.yaml
Other parameters:
- registry_url: "quay.io"
- registry_namespace: "kubevirt"
- openshift_master_default_subdomain
- public_master_hostname
Status
Processing status can be observed within the KWebUI
custom resource's status
section:
status.phase
- contains one of the string constants for automatization
status.message
- human readable details
In case of errors, watch operator's pod logs, sort of:
oc logs kubevirt-web-ui-operator-85ffcdd9d5-8lt9g
How to Build
See operator-sdk for the tooling installation instructions.
The operator is built using:
operator-sdk build quay.io/[YOUR_REPO]/kubevirt-web-ui-operator
Note About Internals
To achieve full parity with the Kubevirt RPM installation, the operator reuses the kubevirt-ansible playbook.
This decision has several consequences, namely
- requirement for the
oc
and ansible-playbook
binaries within the docker image (increases size of the image significantly)
- requirement for the
anyuid
SCC for the service account as the ansible requires actual user to run under (in particular, container's root
is recycled)
The project is intentionally not based on the ansible operator-sdk as there is still plan to remove the ansible code completely once the (de)provision logic can live in a single project only.
Copy of the ansible playbook is stored under build/kubevirt-web-ui-ansible
directory.
This playbook is extracted from the kubevirt-ansible project.
Please run following command to update it in this project:
$ ./update.ansible.sh [RELEASE]
By design, the kubevirt-web-ui-ansible
uses the oc
client to perform particular installation steps.
To make it work, kubeconfig is recomposed by the operator based on in-cluster-config secrets.
Authors