From de372399a165836a7aed04237d213ed2d2c16aaf Mon Sep 17 00:00:00 2001 From: Larry Rensing Date: Mon, 21 Nov 2016 21:33:07 +0000 Subject: [PATCH] Adding helm chart for maas --- maas/.helmignore | 26 +++++++++++++++++++++++ maas/Chart.yaml | 3 +++ maas/README.md | 29 ++++++++++++++++++++++++++ maas/templates/deployment.yaml | 38 ++++++++++++++++++++++++++++++++++ maas/templates/service.yaml | 18 ++++++++++++++++ maas/tests/test-pxe-client.sh | 31 +++++++++++++++++++++++++++ maas/values.yaml | 14 +++++++++++++ 7 files changed, 159 insertions(+) create mode 100644 maas/.helmignore create mode 100755 maas/Chart.yaml create mode 100644 maas/README.md create mode 100644 maas/templates/deployment.yaml create mode 100644 maas/templates/service.yaml create mode 100755 maas/tests/test-pxe-client.sh create mode 100644 maas/values.yaml diff --git a/maas/.helmignore b/maas/.helmignore new file mode 100644 index 0000000000..2c87a915d0 --- /dev/null +++ b/maas/.helmignore @@ -0,0 +1,26 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj + +secrets/ +patches/ +*.py +Makefile diff --git a/maas/Chart.yaml b/maas/Chart.yaml new file mode 100755 index 0000000000..628076dbb6 --- /dev/null +++ b/maas/Chart.yaml @@ -0,0 +1,3 @@ +description: Chart to run MaaS +name: maas +version: 0.1.0 diff --git a/maas/README.md b/maas/README.md new file mode 100644 index 0000000000..427e5e2886 --- /dev/null +++ b/maas/README.md @@ -0,0 +1,29 @@ +# aic-helm/maas + +This chart installs a working version of MaaS on kubernetes. + + +### Quickstart + +To deploy your MaaS chart: + +``` +helm install maas --namespace=maas +``` + +To verify the helm deployment was successful: +``` +# helm ls +NAME REVISION UPDATED STATUS CHART +opining-ocelot 1 Wed Nov 23 19:48:41 2016 DEPLOYED maas-0.1.0 +``` + +To check that all resources are working as intended: +``` +# kubectl get all --namespace=maas +NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE +svc/maas-region-ui 10.109.228.165 80/TCP,8000/TCP 2m +NAME READY STATUS RESTARTS AGE +po/maas-rack-2449935402-ppn34 1/1 Running 0 2m +po/maas-region-638716514-miczz 1/1 Running 0 2m +``` diff --git a/maas/templates/deployment.yaml b/maas/templates/deployment.yaml new file mode 100644 index 0000000000..f41b4595fe --- /dev/null +++ b/maas/templates/deployment.yaml @@ -0,0 +1,38 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: maas-region +spec: + template: + metadata: + labels: + app: maas-region + spec: + containers: + - name: maas-region + image: {{ .Values.image_maas_region }} + imagePullPolicy: Always + ports: + - containerPort: {{ .Values.maas_region_container_port }} + securityContext: + privileged: true +--- +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: maas-rack +spec: + template: + metadata: + labels: + app: maas-rack-controller + spec: + hostNetwork: true + containers: + - name: maas-rack + image: {{ .Values.image_maas_rack }} + imagePullPolicy: Always + ports: + - containerPort: {{ .Values.maas_rack_container_port }} + securityContext: + privileged: true diff --git a/maas/templates/service.yaml b/maas/templates/service.yaml new file mode 100644 index 0000000000..38727e7be4 --- /dev/null +++ b/maas/templates/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: maas-region-ui + labels: + app: maas-region-ui +spec: + ports: + - port: {{ .Values.service_gui_port }} + targetPort: {{ .Values.service_gui_target_port }} + protocol: TCP + name: gui + - port: {{ .Values.service_proxy_port }} + targetPort: {{ .Values.service_proxy_target_port }} + protocol: TCP + name: proxy + selector: + app: maas-region diff --git a/maas/tests/test-pxe-client.sh b/maas/tests/test-pxe-client.sh new file mode 100755 index 0000000000..34b65e57d4 --- /dev/null +++ b/maas/tests/test-pxe-client.sh @@ -0,0 +1,31 @@ +#!/bin/bash -x + +# this helps create a qemu client (not using kvm acceleration +# so it doesn't conflict with virtualbox users) that can be +# used to test that maas is working + +cat </tmp/maas-net.xml + + + maas + + + +EOF + +virsh net-create /tmp/maas-net.xml + +# purge an existing image if one exists +if [ -e /tmp/maas-node-test.qcow2 ]; then + sudo rm /tmp/maas-node-test.qcow2 + sudo qemu-img create -f qcow2 -o preallocation=metadata /tmp/maas-node-test.qcow2 32G +fi; + +virt-install \ + --name=maas-node-test \ + --connect=qemu:///system --ram=1024 --vcpus=1 --virt-type=qemu\ + --pxe --boot network,hd \ + --os-variant=ubuntutrusty --graphics vnc --noautoconsole --os-type=linux --accelerate \ + --disk=/tmp/maas-node-test.qcow2,bus=virtio,cache=none,sparse=true,size=32 \ + --network=network=maas,model=e1000 \ + --force diff --git a/maas/values.yaml b/maas/values.yaml new file mode 100644 index 0000000000..f7266d4cb0 --- /dev/null +++ b/maas/values.yaml @@ -0,0 +1,14 @@ +# Default values for maas. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +image_maas_region: quay.io/attcomdev/maas-region:1.0.1 +image_maas_rack: quay.io/attcomdev/maas-rack:1.0.1 + +maas_region_container_port: 80 +maas_rack_container_port: 80 + +service_gui_port: 80 +service_gui_target_port: 80 +service_proxy_port: 8000 +service_proxy_target_port: 8000