Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Provides Kubernetes custom resource definition for persisent VM and golang binding for building clients and controllers for this CRD

License

Notifications You must be signed in to change notification settings

kubevirt-incubator/persistentvm-addon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Persistent Virtual Machine KubeVirt add-on

This add-on provides the functionality to store VM configuration in the Kubernetes cluster. It is designed to provide common grounds for building high-level Virtual Machine management tools on top of the Kubevirt and provide controller and API for controlling the persistent VM.

This addon is designed to work in tandem with the Kubevirt.

The functionality present in this add-on is implemented as a Kubernetes Custom resource definition (CRD). Because of this approach, API heavy lifting is done by Kubernetes and does not have to be re-implemented.

Moreover, this add-on is also designed to provide golang language binding for building custom resource client. These bindings are autogenerated, therefore developers are not supposed to modify them.

And finally this addon provides the custom controller for handling the changes of state of persistent VM resource.

Get started

Before you can do anything with this add-on, you have to get a local copy. To use the codes further as a library, use the golang tool.

go get github.com/kubevirt-incubator/virt-persistentvm-crd

With this method, you get functioning codes stored in your local GOPATH.

If this is not desired, just clone the repository wherever you desire.

Install

Installation is simple. Just run

kubectl create -f manifests/persistentvm-resource.yaml

give it few seconds and you are ready to go.

To verify everything went OK get existing CRD from the Kubernetes cluster.

kubectl get crd

If persistentvirtualmachines.kubevirt.io is present, you are good to go.

Legacy

Besides the direct kubernetes installation. In case you are using the original Kubevirt vagrant deployment present in its GitHub repository. Use the following command.

make vagrant-deploy

This deploys the Kubevirt to the virtual machine running the Kubernetes with the Kubevirt.

Usage of PVMs

Once the new PVM CRD has been added, you can start using it. You can:

Create new PVM

Before you can register any new PVM in Kubernetes cluster, you have to define it first. New VM definition is done the same way as any other Kubernetes object, with the YAML file.

apiVersion: kubevirt.io/v1alpha1
kind: PersistentVirtualMachine
metadata:
  name: testvm
spec:
  domain:
    devices:
      consoles:
      - type: neuralink
    memory:
      unit: MB
      value: 64
    os:
      type:
        os: AwesomeBrainOS
    type: qemu

Once you have the specification ready, registering to Kubernetes cluster is as simple as

kubectl create -f my-pvm-example.yaml

Legacy

If you are using the original Kubevirt vagrant environment, you can use this command

cluster/kubectl.sh --core create -f example.yaml

List PVMs

To get the list of existing PVMs in your Kubernetes cluster use the command

kubectl get pvms

Legacy

For the original Kubevirt vagrant environment use

cluster/kubectl.sh --core get pvms

Delete PVM

To delete existing PVM from you Kubernetes cluster use the command

kubectl delete pvm <your-PVM-name>

or if you have a YAML specification of the PVM, use

kubectl delete -f your-PVM-name.yaml

Legacy

For the original Kubevirt vagrant environment use

cluster/kubectl.sh --core delete -f example.yaml

Use as a library

To use the generated bindings in your own code, just import the package in the go file and start using it.

import pvmcrd github.com/kubevirt-incubator/virt-persistentvm-crd/...

//TODO: Add proper example

About

Provides Kubernetes custom resource definition for persisent VM and golang binding for building clients and controllers for this CRD

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •