Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue #28 Add KubeVirt add-on #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions add-ons/kubevirt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Deploying KubeVirt on OpenShift

* This addon provides an easy way to install [KubeVirt](https://kubevirt.io/) on [Minishift](https://github.com/minishift/minishift).
* Prerequisites:

* [Installed and running](https://docs.openshift.org/latest/minishift/getting-started/installing.html) Minishift
* [Installed](https://docs.openshift.org/latest/minishift/command-ref/minishift_oc-env.html) OpenShift CLI

## Start Minishift

* The deployment works with Minishift default resources - 2 CPUs and 2 GB RAM. Nevertheless we prefer to allocate more memory (as much as you'd need to run your VMs) available to KubeVirt. Start Minishift using following command to provide more RAM.

```shell
$ minishift start --memory=8GB
```

## Add-on installation

* Clone this repository onto your local machine and then install the add-on via:

```shell
$ minishift addons install <path_to_directory_containing_this_readme>
```

## Start KubeVirt

* Deploy all KubeVirt components.

```shell
$ minishift addons apply kubevirt
```

## Variables

*KUBEVIRT_VERSION* is mandatory and must be set to one of the [KubeVirt available releases](https://github.com/kubevirt/kubevirt/releases), by default it's set to *v0.7.0-alpha.2*.

> **NOTE**: Due to issues on KubeVirt (e.g. [kubevirt/kubevirt#1196](https://github.com/kubevirt/kubevirt/issues/1196)) *KUBEVIRT_VERSION* is set to *v0.7.0-alpha.2* and it's not recommended to use a newer one until the issues are fixed.
15 changes: 15 additions & 0 deletions add-ons/kubevirt/kubevirt.addon
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Name: kubevirt
# Description: Installs KubeVirt. For more information visit https://kubevirt.io
# Required-Vars: KUBEVIRT_VERSION
# Var-Defaults: KUBEVIRT_VERSION=v0.7.0-alpha.2
# OpenShift-Version: >=3.9.0

echo Deploying KubeVirt...

oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:kubevirt-privileged
oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:kubevirt-controller
oc adm policy add-scc-to-user privileged system:serviceaccount:kube-system:kubevirt-infra
oc apply -f https://github.com/kubevirt/kubevirt/releases/download/#{KUBEVIRT_VERSION}/kubevirt.yaml
oc adm policy add-cluster-role-to-user kubevirt.io:edit developer

echo Deployment applied, KubeVirt is starting up!
39 changes: 39 additions & 0 deletions test/integration/features/kubevirt.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@kubevirt
Feature: KubeVirt add-on
KubeVirt addon starts KubeVirt

@minishift-only
Scenario: User install kubevirt add-on
Given stdout of command "minishift addons list" does not contain "kubevirt"
When executing "minishift addons install ../../add-ons/kubevirt" succeeds
Then stdout should contain "Addon 'kubevirt' installed"

Scenario: Minishift starts
Given Minishift has state "Does Not Exist"
When executing "minishift start --memory 4GB" succeeds
Then Minishift should have state "Running"

Scenario: Applying the add-on
When executing "minishift addons apply kubevirt" succeeds
Then stdout should contain "Deployment applied, KubeVirt is starting up!"

Scenario: KubeVirt is ready
Given Minishift has state "Running"
When executing "minishift openshift service list" succeeds
Then stdout should contain "virt-api"

Scenario: DaemonSet virt-handler is ready
Given user waits "60" seconds
When executing "oc get ds -n kube-system --as system:admin" succeeds
Then stdout should match "virt-handler(\s+1){5}"

Scenario: ReplicaSet virt-api and virt-controller are ready
Given user waits "60" seconds
When executing "oc get rs -n kube-system --as system:admin" succeeds
Then stdout should match "virt-api-\w{10}(\s+2){3}"
And stdout should match "virt-controller-\w{10}(\s+2){3}"

Scenario: Deleting Minishift
Given Minishift has state "Running"
When executing "minishift delete --force" succeeds
Then Minishift should have state "Does Not Exist"