diff --git a/deploy/ranchervm.yaml b/deploy/ranchervm.yaml index 58920f7..447bce5 100644 --- a/deploy/ranchervm.yaml +++ b/deploy/ranchervm.yaml @@ -126,12 +126,15 @@ spec: topologyKey: "kubernetes.io/hostname" containers: - name: vm-controller - image: rancher/vm + image: rancher/vm:v0.1.0 imagePullPolicy: Always args: - -vm - -bridge-iface=ens33 - -v=3 + - -image-novnc=rancher/vm-novnc:v0.1.0 + - -image-tools=rancher/vm-tools:v0.1.0 + - -image-vm=rancher/vm:v0.1.0 serviceAccountName: ranchervm-service-account --- apiVersion: apps/v1beta1 @@ -158,7 +161,7 @@ spec: hostNetwork: true containers: - name: ip-controller - image: rancher/vm + image: rancher/vm:v0.1.0 imagePullPolicy: Always command: [ "sh", "-c"] args: @@ -169,7 +172,7 @@ spec: fieldRef: fieldPath: spec.nodeName - name: arp-scanner - image: rancher/vm + image: rancher/vm:v0.1.0 imagePullPolicy: Always command: [ "bash", "-c"] # This is probably too aggressive for anything bigger than class 3 network @@ -209,7 +212,7 @@ spec: topologyKey: "kubernetes.io/hostname" containers: - name: backend - image: rancher/vm + image: rancher/vm:v0.1.0 imagePullPolicy: Always args: - -backend @@ -251,7 +254,7 @@ spec: topologyKey: "kubernetes.io/hostname" containers: - name: frontend - image: rancher/vm-frontend + image: rancher/vm-frontend:v0.1.0 imagePullPolicy: Always --- apiVersion: v1 diff --git a/image/novnc/Makefile b/image/novnc/Makefile index 3eff8fc..d7507e0 100644 --- a/image/novnc/Makefile +++ b/image/novnc/Makefile @@ -1,5 +1,5 @@ -NAME = rancher/novnc -VERSION = 0.0.1 +NAME = rancher/vm-novnc +VERSION = v0.1.0 .PHONY : all clean build diff --git a/image/ubuntu/README.md b/image/ubuntu/README.md index b1fa957..aabde1c 100644 --- a/image/ubuntu/README.md +++ b/image/ubuntu/README.md @@ -1,3 +1,16 @@ ## Default credentials: - Username: `ubuntu` - Password: `ubuntu` + +## How to build + +``` +curl -LO https://s3-us-west-1.amazonaws.com/ranchervm/iso/ubuntu-16.04.4-server-amd64.iso +qemu-img create -f qcow2 ubuntu-16.04.4-server-amd64.img 50G +qemu-system-x86_64 -enable-kvm -m size=4096 -smp cpus=1 -vnc 0.0.0.0:0 -cdrom ubuntu-16.04.4-server-amd64.iso -drive file=ubuntu-16.04.4-server-amd64.img -netdev bridge,br=br0,id=net0 -device virtio-net-pci,netdev=net0,mac=06:fe:a7:1d:03:c5 +# Perform installation - guided w/LVM, add OpenSSH Server +# Reboot, then turn off password SSH, install python and cloud-init, disable swap, clear history +# Pull any Docker images that should be cached now +qemu-img convert -O qcow2 -c ubuntu-16.04.4-server-amd64.img ubuntu-16.04.4-server-amd64.qcow2 +``` + diff --git a/image/vm-tools/Makefile b/image/vm-tools/Makefile index 9602c8a..6d154da 100644 --- a/image/vm-tools/Makefile +++ b/image/vm-tools/Makefile @@ -1,5 +1,5 @@ NAME = rancher/vm-tools -VERSION = 0.0.3 +VERSION = v0.1.0 BASE_IMAGE=RancherVM-debootstrap-ubuntu-1604.tgz .PHONY : all clean build diff --git a/pkg/common/constants.go b/pkg/common/constants.go index ffd660d..31f12f1 100644 --- a/pkg/common/constants.go +++ b/pkg/common/constants.go @@ -1,5 +1,9 @@ package common +import ( + "flag" +) + const ( HostStateBaseDir = "/var/lib/rancher/vm" @@ -7,10 +11,6 @@ const ( NamespaceVM = "default" NameDelimiter = "-" - ImageVM = "rancher/vm" - ImageVMTools = "rancher/vm-tools" - ImageNoVNC = "rancher/novnc" - RancherOUI = "06:fe" LabelApp = "ranchervm" @@ -19,3 +19,9 @@ const ( LabelRoleNoVNC = "novnc" LabelNodeHostname = "kubernetes.io/hostname" ) + +var ( + ImageVM = flag.String("image-vm", "rancher/vm:latest", "VM Docker Image") + ImageNoVNC = flag.String("image-novnc", "rancher/vm-novnc:latest", "NoVNC Docker Image") + ImageVMTools = flag.String("image-tools", "rancher/vm-tools:latest", "Tools Docker Image") +) diff --git a/pkg/controller/vm/util.go b/pkg/controller/vm/util.go index 04c7f57..52ef2a1 100644 --- a/pkg/controller/vm/util.go +++ b/pkg/controller/vm/util.go @@ -155,7 +155,7 @@ func (ctrl *VirtualMachineController) makeVMPod(vm *v1alpha1.VirtualMachine, ifa InitContainers: []corev1.Container{ corev1.Container{ Name: "debootstrap", - Image: common.ImageVMTools, + Image: *common.ImageVMTools, ImagePullPolicy: corev1.PullAlways, VolumeMounts: []corev1.VolumeMount{ common.MakeVolumeMount("vm-fs", "/vm-tools", "", false), @@ -274,7 +274,7 @@ func makeNovncPod(vm *v1alpha1.VirtualMachine, podName string) *corev1.Pod { Containers: []corev1.Container{ corev1.Container{ Name: common.LabelRoleNoVNC, - Image: common.ImageNoVNC, + Image: *common.ImageNoVNC, ImagePullPolicy: corev1.PullAlways, Command: []string{"novnc"}, Env: []corev1.EnvVar{ diff --git a/pkg/qemu/job.go b/pkg/qemu/job.go index 5e2b047..669ff4e 100644 --- a/pkg/qemu/job.go +++ b/pkg/qemu/job.go @@ -33,7 +33,7 @@ func NewMigrationJob(vm *v1alpha1.VirtualMachine, podName, targetURI string) *ba Containers: []corev1.Container{ corev1.Container{ Name: common.LabelRoleMigrate, - Image: common.ImageVM, + Image: *common.ImageVM, ImagePullPolicy: corev1.PullAlways, Command: []string{"sh", "-c"}, Args: []string{fmt.Sprintf("exec /ranchervm -migrate -sock-path /vm/%s_monitor.sock -target-uri %s -v 5", podName, targetURI)},