From a24d6d00f252dfcf53a2651072ddc8db072e0df5 Mon Sep 17 00:00:00 2001 From: Larry Rensing Date: Mon, 21 Nov 2016 21:33:07 +0000 Subject: [PATCH 1/5] Adding helm chart for maas --- maas/.helmignore | 26 ++++++++++++++++++++++++ maas/Chart.yaml | 3 +++ maas/README.md | 5 +++++ maas/templates/deployment.yaml | 37 ++++++++++++++++++++++++++++++++++ maas/templates/service.yaml | 18 +++++++++++++++++ maas/tests/test-pxe-client.sh | 31 ++++++++++++++++++++++++++++ maas/values.yaml | 14 +++++++++++++ 7 files changed, 134 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..3a9ba2ba92 --- /dev/null +++ b/maas/README.md @@ -0,0 +1,5 @@ +# aic-helm/maas + +This chart installs a working version of MaaS on kubernetes. + + diff --git a/maas/templates/deployment.yaml b/maas/templates/deployment.yaml new file mode 100644 index 0000000000..585a2e70e4 --- /dev/null +++ b/maas/templates/deployment.yaml @@ -0,0 +1,37 @@ +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: + 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 From de372399a165836a7aed04237d213ed2d2c16aaf Mon Sep 17 00:00:00 2001 From: Larry Rensing Date: Mon, 21 Nov 2016 21:33:07 +0000 Subject: [PATCH 2/5] 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 From 9adb0f96703fdbe34ad6e1180179fbfd9a11b388 Mon Sep 17 00:00:00 2001 From: pprokop Date: Tue, 29 Nov 2016 08:33:08 +0100 Subject: [PATCH 3/5] Refactoring init-containers --- keystone/templates/_helpers.tpl | 3 +++ keystone/templates/db-sync.yaml | 4 ++-- keystone/templates/deployment.yaml | 8 ++------ keystone/templates/init.yaml | 7 +++++-- keystone/values.yaml | 19 +++++++++++++++++++ 5 files changed, 31 insertions(+), 10 deletions(-) create mode 100644 keystone/templates/_helpers.tpl diff --git a/keystone/templates/_helpers.tpl b/keystone/templates/_helpers.tpl new file mode 100644 index 0000000000..d2f33bc897 --- /dev/null +++ b/keystone/templates/_helpers.tpl @@ -0,0 +1,3 @@ +{{- define "joinListWithColon" -}} +{{ range $k, $v := . }}{{ if $k }},{{ end }}{{ $v }}{{ end }} +{{- end -}} diff --git a/keystone/templates/db-sync.yaml b/keystone/templates/db-sync.yaml index a270d68a4e..ce4ee2ce8c 100644 --- a/keystone/templates/db-sync.yaml +++ b/keystone/templates/db-sync.yaml @@ -17,11 +17,11 @@ spec: }, { "name": "DEPENDENCY_SERVICE", - "value": "mariadb" + "value": "{{ include "joinListWithColon" .Values.dependencies.db_sync.service }}" }, { "name": "DEPENDENCY_JOBS", - "value": "mariadb-seed,keystone-init" + "value": "{{ include "joinListWithColon" .Values.dependencies.db_sync.jobs }}" }, { "name": "COMMAND", diff --git a/keystone/templates/deployment.yaml b/keystone/templates/deployment.yaml index 8c124df54d..f4945cb20b 100644 --- a/keystone/templates/deployment.yaml +++ b/keystone/templates/deployment.yaml @@ -20,15 +20,11 @@ spec: }, { "name": "DEPENDENCY_SERVICE", - "value": "mariadb,rabbitmq" + "value": "{{ include "joinListWithColon" .Values.dependencies.api.service }}" }, { "name": "DEPENDENCY_JOBS", - "value": "mariadb-seed" - }, - { - "name": "DEPENDENCY_CONFIG", - "value": "/etc/apache2/conf-enabled/wsgi-keystone.conf" + "value": "{{ include "joinListWithColon" .Values.dependencies.api.jobs }}" }, { "name": "COMMAND", diff --git a/keystone/templates/init.yaml b/keystone/templates/init.yaml index 5fc9b4776f..9a6b55fa3e 100644 --- a/keystone/templates/init.yaml +++ b/keystone/templates/init.yaml @@ -17,11 +17,11 @@ spec: }, { "name": "DEPENDENCY_SERVICE", - "value": "mariadb" + "value": "{{ include "joinListWithColon" .Values.dependencies.init.service }}" }, { "name": "DEPENDENCY_JOBS", - "value": "mariadb-seed" + "value": "{{ include "joinListWithColon" .Values.dependencies.init.jobs }}" }, { "name": "COMMAND", @@ -36,6 +36,9 @@ spec: - name: keystone-init image: {{ .Values.images.init }} imagePullPolicy: Always + command: + - bash + - /tmp/init.sh volumeMounts: - name: initsh mountPath: /tmp/init.sh diff --git a/keystone/values.yaml b/keystone/values.yaml index 27dac08811..173b2291a5 100644 --- a/keystone/values.yaml +++ b/keystone/values.yaml @@ -39,3 +39,22 @@ database: misc: workers: 8 debug: false + +dependencies: + api: + jobs: + - mariadb-seed + - keystone-init + service: + - mariadb + db_sync: + jobs: + - keystone-init + - mariadb-seed + service: + - mariadb + init: + jobs: + - mariadb-seed + service: + - mariadb From c34c5005bdb3fa859b334fd1518b4d24de0a754a Mon Sep 17 00:00:00 2001 From: pprokop Date: Tue, 29 Nov 2016 12:51:56 +0100 Subject: [PATCH 4/5] Changes due to Daniel's review --- keystone/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keystone/values.yaml b/keystone/values.yaml index 173b2291a5..7a704cc470 100644 --- a/keystone/values.yaml +++ b/keystone/values.yaml @@ -44,7 +44,7 @@ dependencies: api: jobs: - mariadb-seed - - keystone-init + - keystone-db-sync service: - mariadb db_sync: From ba37e1cabe079bdaada44e5782cfc14bbc27e6a2 Mon Sep 17 00:00:00 2001 From: DTadrzak Date: Tue, 6 Dec 2016 17:21:39 +0100 Subject: [PATCH 5/5] Adding support for glance serivce. Signed-off-by: DTadrzak --- glance/Chart.yaml | 3 + glance/requirements.yaml | 19 ++++ glance/templates/_helpers.tpl | 5 + glance/templates/api.yaml | 80 +++++++++++++++ .../templates/ceph.client.glance.keyring.yaml | 9 ++ glance/templates/ceph.conf.yaml | 18 ++++ glance/templates/db-sync.sh.yaml | 10 ++ glance/templates/db-sync.yaml | 55 +++++++++++ glance/templates/glance-api.conf.yaml | 47 +++++++++ glance/templates/glance-registry.conf.yaml | 34 +++++++ glance/templates/init.sh.yaml | 12 +++ glance/templates/init.yaml | 52 ++++++++++ glance/templates/post.sh.yaml | 14 +++ glance/templates/post.yaml | 49 +++++++++ glance/templates/registry.yaml | 57 +++++++++++ glance/templates/service-api.yaml | 9 ++ glance/templates/service-registry.yaml | 9 ++ glance/templates/start.sh.yaml | 12 +++ glance/values.yaml | 99 +++++++++++++++++++ 19 files changed, 593 insertions(+) create mode 100644 glance/Chart.yaml create mode 100644 glance/requirements.yaml create mode 100644 glance/templates/_helpers.tpl create mode 100644 glance/templates/api.yaml create mode 100644 glance/templates/ceph.client.glance.keyring.yaml create mode 100644 glance/templates/ceph.conf.yaml create mode 100644 glance/templates/db-sync.sh.yaml create mode 100644 glance/templates/db-sync.yaml create mode 100644 glance/templates/glance-api.conf.yaml create mode 100644 glance/templates/glance-registry.conf.yaml create mode 100644 glance/templates/init.sh.yaml create mode 100644 glance/templates/init.yaml create mode 100644 glance/templates/post.sh.yaml create mode 100644 glance/templates/post.yaml create mode 100644 glance/templates/registry.yaml create mode 100644 glance/templates/service-api.yaml create mode 100644 glance/templates/service-registry.yaml create mode 100644 glance/templates/start.sh.yaml create mode 100644 glance/values.yaml diff --git a/glance/Chart.yaml b/glance/Chart.yaml new file mode 100644 index 0000000000..016ef755de --- /dev/null +++ b/glance/Chart.yaml @@ -0,0 +1,3 @@ +description: A Helm chart for glance +name: glance +version: 0.1.0 diff --git a/glance/requirements.yaml b/glance/requirements.yaml new file mode 100644 index 0000000000..6fc22a5704 --- /dev/null +++ b/glance/requirements.yaml @@ -0,0 +1,19 @@ +dependencies: + - name: common + repository: http://localhost:8879/charts + version: 0.1.0 + - name: mariadb + repository: http://localhost:8879/charts + version: 0.1.0 + - name: rabbitmq + repository: http://localhost:8879/charts + version: 0.1.0 + - name: memcached + repository: http://localhost:8879/charts + version: 0.1.0 + - name: keystone + repository: http://localhost:8879/charts + version: 0.1.0 + - name: keystone + repository: http://localhost:8879/charts + version: 0.1.0 \ No newline at end of file diff --git a/glance/templates/_helpers.tpl b/glance/templates/_helpers.tpl new file mode 100644 index 0000000000..fafa1447a6 --- /dev/null +++ b/glance/templates/_helpers.tpl @@ -0,0 +1,5 @@ +{{- define "joinListWithColon" -}} +{{ range $k, $v := . }}{{ if $k }},{{ end }}{{ $v }}{{ end }} +{{- end -}} + +{{ define "keystone_auth" }}auth: "{'auth_url':'{{ .Values.keystone.auth_url }}', 'username':'{{ .Values.keystone.admin_user }}','password':'{{ .Values.keystone.admin_password }}','project_name':'{{ .Values.keystone.admin_project_name }}','domain_name':'default'}"{{end}} diff --git a/glance/templates/api.yaml b/glance/templates/api.yaml new file mode 100644 index 0000000000..979df7cd41 --- /dev/null +++ b/glance/templates/api.yaml @@ -0,0 +1,80 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: glance-api +spec: + replicas: {{ .Values.replicas }} + template: + metadata: + labels: + app: glance-api + annotations: + pod.beta.kubernetes.io/init-containers: '[ + { + "name": "init", + "image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0", + "env": [ + { + "name": "NAMESPACE", + "value": "{{ .Release.Namespace }}" + }, + { + "name": "DEPENDENCY_SERVICE", + "value": "{{ include "joinListWithColon" .Values.dependencies.api.service }}" + }, + { + "name": "DEPENDENCY_JOBS", + "value": "{{ include "joinListWithColon" .Values.dependencies.api.jobs }}" + }, + { + "name": "COMMAND", + "value": "echo done" + } + ] + } + ]' + spec: + nodeSelector: + {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} + containers: + - name: glance-api + image: {{ .Values.images.api }} + imagePullPolicy: Always + command: + - bash + - /tmp/start.sh + ports: + - containerPort: {{ .Values.network.port.api }} + readinessProbe: + tcpSocket: + port: {{ .Values.network.port.api }} + volumeMounts: + - name: glanceapiconf + mountPath: /etc/glance/glance-api.conf + subPath: glance-api.conf + - name: startsh + mountPath: /tmp/start.sh + subPath: start.sh + - name: etcglance + mountPath: /etc/glance + - name: cephconf + mountPath: /etc/ceph/ceph.conf + subPath: ceph.conf + - name: cephclientglancekeyring + mountPath: /etc/ceph/ceph.client.{{ .Values.ceph.glance_user }}.keyring + subPath: ceph.client.{{ .Values.ceph.glance_user }}.keyring + volumes: + - name: glanceapiconf + configMap: + name: glance-glanceapiconf + - name: startsh + configMap: + name: glance-startsh + - name: cephconf + configMap: + name: glance-cephconf + - name: cephclientglancekeyring + configMap: + name: glance-cephclientglancekeyring + - name: etcglance + emptyDir: {} diff --git a/glance/templates/ceph.client.glance.keyring.yaml b/glance/templates/ceph.client.glance.keyring.yaml new file mode 100644 index 0000000000..27eeac7ed2 --- /dev/null +++ b/glance/templates/ceph.client.glance.keyring.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: glance-cephclientglancekeyring +data: + ceph.client.{{ .Values.ceph.glance_user }}.keyring: |+ + [client.{{ .Values.ceph.glance_user }}] + key = {{ .Values.ceph.glance_keyring }} + diff --git a/glance/templates/ceph.conf.yaml b/glance/templates/ceph.conf.yaml new file mode 100644 index 0000000000..28982f320e --- /dev/null +++ b/glance/templates/ceph.conf.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: glance-cephconf +data: + ceph.conf: |+ + [global] + rgw_thread_pool_size = 1024 + rgw_num_rados_handles = 100 + [mon] + {{ range .Values.ceph.monitors }} + [mon.{{ . }}] + host = {{ . }} + mon_addr = {{ . }} + {{ end }} + [client] + rbd_cache_enabled = true + rbd_cache_writethrough_until_flush = true diff --git a/glance/templates/db-sync.sh.yaml b/glance/templates/db-sync.sh.yaml new file mode 100644 index 0000000000..78a95b4cd4 --- /dev/null +++ b/glance/templates/db-sync.sh.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: glance-dbsyncsh +data: + db-sync.sh: |+ + #!/bin/bash + set -ex + + glance-manage db_sync diff --git a/glance/templates/db-sync.yaml b/glance/templates/db-sync.yaml new file mode 100644 index 0000000000..37e0685eea --- /dev/null +++ b/glance/templates/db-sync.yaml @@ -0,0 +1,55 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: glance-db-sync +spec: + template: + metadata: + annotations: + pod.beta.kubernetes.io/init-containers: '[ + { + "name": "init", + "image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0", + "env": [ + { + "name": "NAMESPACE", + "value": "{{ .Release.Namespace }}" + }, + { + "name": "DEPENDENCY_SERVICE", + "value": "{{ include "joinListWithColon" .Values.dependencies.db_sync.service }}" + }, + { + "name": "DEPENDENCY_JOBS", + "value": "{{ include "joinListWithColon" .Values.dependencies.db_sync.jobs }}" + }, + { + "name": "COMMAND", + "value": "echo done" + } + ] + } + ]' + spec: + restartPolicy: OnFailure + containers: + - name: glance-db-sync + image: {{ .Values.images.db_sync }} + imagePullPolicy: Always + command: + - bash + - /tmp/db-sync.sh + volumeMounts: + - name: glanceapiconf + mountPath: /etc/glance/glance-api.conf + subPath: glance-api.conf + - name: dbsyncsh + mountPath: /tmp/db-sync.sh + subPath: db-sync.sh + volumes: + - name: glanceapiconf + configMap: + name: glance-glanceapiconf + - name: dbsyncsh + configMap: + name: glance-dbsyncsh diff --git a/glance/templates/glance-api.conf.yaml b/glance/templates/glance-api.conf.yaml new file mode 100644 index 0000000000..b7e45d36e7 --- /dev/null +++ b/glance/templates/glance-api.conf.yaml @@ -0,0 +1,47 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: glance-glanceapiconf +data: + glance-api.conf: |+ + [DEFAULT] + debug = {{ .Values.misc.debug }} + use_syslog = False + use_stderr = True + + bind_port = {{ .Values.network.port.api }} + + workers = {{ .Values.misc.workers }} + registry_host = glance-registry + + # Enable Copy-on-Write + show_image_direct_url = True + + [database] + connection = mysql+pymysql://{{ .Values.database.glance_user }}:{{ .Values.database.glance_password }}@{{ .Values.database.address }}/{{ .Values.database.glance_database_name }} + max_retries = -1 + + [keystone_authtoken] + auth_uri = {{ .Values.keystone.auth_uri }} + auth_url = {{ .Values.keystone.auth_url }} + auth_type = password + project_domain_id = default + user_domain_id = default + project_name = service + username = {{ .Values.keystone.glance_user }} + password = {{ .Values.keystone.glance_password }} + + [paste_deploy] + flavor = keystone + + [oslo_messaging_notifications] + driver = noop + + [glance_store] + filesystem_store_datadir = /var/lib/glance/images/ + stores = file, http, rbd + default_store = rbd + rbd_store_pool = {{ .Values.ceph.glance_pool }} + rbd_store_user = {{ .Values.ceph.glance_user }} + rbd_store_ceph_conf = /etc/ceph/ceph.conf + rbd_store_chunk_size = 8 diff --git a/glance/templates/glance-registry.conf.yaml b/glance/templates/glance-registry.conf.yaml new file mode 100644 index 0000000000..81629caa46 --- /dev/null +++ b/glance/templates/glance-registry.conf.yaml @@ -0,0 +1,34 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: glance-glanceregistryconf +data: + glance-registry.conf: |+ + [DEFAULT] + debug = {{ .Values.misc.debug }} + use_syslog = False + use_stderr = True + + bind_port = {{ .Values.network.port.registry }} + + workers = {{ .Values.misc.workers }} + + [database] + connection = mysql+pymysql://{{ .Values.database.glance_user }}:{{ .Values.database.glance_password }}@{{ .Values.database.address }}/{{ .Values.database.glance_database_name }} + max_retries = -1 + + [keystone_authtoken] + auth_uri = {{ .Values.keystone.auth_uri }} + auth_url = {{ .Values.keystone.auth_url }} + auth_type = password + project_domain_id = default + user_domain_id = default + project_name = service + username = {{ .Values.keystone.glance_user }} + password = {{ .Values.keystone.glance_password }} + + [paste_deploy] + flavor = keystone + + [oslo_messaging_notifications] + driver = noop diff --git a/glance/templates/init.sh.yaml b/glance/templates/init.sh.yaml new file mode 100644 index 0000000000..8605f7c544 --- /dev/null +++ b/glance/templates/init.sh.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: glance-initsh +data: + init.sh: |+ + #!/bin/bash + set -ex + export HOME=/tmp + + ansible localhost -vvv -m mysql_db -a "login_host='{{ .Values.database.address }}' login_port='{{ .Values.database.port }}' login_user='{{ .Values.database.root_user }}' login_password='{{ .Values.database.root_password }}' name='{{ .Values.database.glance_database_name }}'" + ansible localhost -vvv -m mysql_user -a "login_host='{{ .Values.database.address }}' login_port='{{ .Values.database.port }}' login_user='{{ .Values.database.root_user }}' login_password='{{ .Values.database.root_password }}' name='{{ .Values.database.glance_user }}' password='{{ .Values.database.glance_password }}' host='%' priv='{{ .Values.database.glance_database_name }}.*:ALL' append_privs='yes'" diff --git a/glance/templates/init.yaml b/glance/templates/init.yaml new file mode 100644 index 0000000000..d789bdb842 --- /dev/null +++ b/glance/templates/init.yaml @@ -0,0 +1,52 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: glance-init +spec: + template: + metadata: + annotations: + pod.beta.kubernetes.io/init-containers: '[ + { + "name": "init", + "image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0", + "env": [ + { + "name": "NAMESPACE", + "value": "{{ .Release.Namespace }}" + }, + { + "name": "DEPENDENCY_SERVICE", + "value": "{{ include "joinListWithColon" .Values.dependencies.init.service }}" + }, + { + "name": "DEPENDENCY_JOBS", + "value": "{{ include "joinListWithColon" .Values.dependencies.init.jobs }}" + }, + { + "name": "COMMAND", + "value": "echo done" + } + ] + } + ]' + spec: + restartPolicy: OnFailure + containers: + - name: glance-init + image: {{ .Values.images.init }} + imagePullPolicy: Always + env: + - name: ANSIBLE_LIBRARY + value: /usr/share/ansible/ + command: + - bash + - /tmp/init.sh + volumeMounts: + - name: initsh + mountPath: /tmp/init.sh + subPath: init.sh + volumes: + - name: initsh + configMap: + name: glance-initsh diff --git a/glance/templates/post.sh.yaml b/glance/templates/post.sh.yaml new file mode 100644 index 0000000000..bd7b82219d --- /dev/null +++ b/glance/templates/post.sh.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: glance-postsh +data: + post.sh: |+ + #!/bin/bash + set -ex + export HOME=/tmp + + ansible localhost -vvv -m kolla_keystone_service -a "service_name=glance service_type=image description='Openstack Image' endpoint_region={{ .Values.keystone.glance_region_name }} url='http://glance-api:{{ .Values.network.port.api }}' interface=admin region_name={{ .Values.keystone.admin_region_name }} auth='{{ include "keystone_auth" . }}'" -e "{ 'openstack_glance_auth': {{ include "keystone_auth" . }} }" + ansible localhost -vvv -m kolla_keystone_service -a "service_name=glance service_type=image description='Openstack Image' endpoint_region={{ .Values.keystone.glance_region_name }} url='http://glance-api:{{ .Values.network.port.api }}' interface=internal region_name={{ .Values.keystone.admin_region_name }} auth='{{ include "keystone_auth" . }}'" -e "{ 'openstack_glance_auth': {{ include "keystone_auth" . }} }" + ansible localhost -vvv -m kolla_keystone_service -a "service_name=glance service_type=image description='Openstack Image' endpoint_region={{ .Values.keystone.glance_region_name }} url='http://glance-api:{{ .Values.network.port.api }}' interface=public region_name={{ .Values.keystone.admin_region_name }} auth='{{ include "keystone_auth" . }}' " -e "{ 'openstack_glance_auth': {{ include "keystone_auth" . }} }" + ansible localhost -vvv -m kolla_keystone_user -a "project=service user={{ .Values.keystone.glance_user }} password={{ .Values.keystone.glance_password }} role=admin region_name={{ .Values.keystone.admin_region_name }} auth='{{ include "keystone_auth" . }}'" -e "{'openstack_glance_auth': {{ include "keystone_auth" .}}}" diff --git a/glance/templates/post.yaml b/glance/templates/post.yaml new file mode 100644 index 0000000000..a7a333902a --- /dev/null +++ b/glance/templates/post.yaml @@ -0,0 +1,49 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: glance-post +spec: + template: + metadata: + annotations: + pod.beta.kubernetes.io/init-containers: '[ + { + "name": "init", + "image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0", + "env": [ + { + "name": "NAMESPACE", + "value": "{{ .Release.Namespace }}" + }, + { + "name": "DEPENDENCY_SERVICE", + "value": "{{ include "joinListWithColon" .Values.dependencies.post.service }}" + }, + { + "name": "DEPENDENCY_JOBS", + "value": "{{ include "joinListWithColon" .Values.dependencies.post.jobs }}" + }, + { + "name": "COMMAND", + "value": "echo done" + } + ] + } + ]' + spec: + restartPolicy: OnFailure + containers: + - name: glance-post + image: {{ .Values.images.post }} + imagePullPolicy: Always + command: + - bash + - /tmp/post.sh + volumeMounts: + - name: postsh + mountPath: /tmp/post.sh + subPath: post.sh + volumes: + - name: postsh + configMap: + name: glance-postsh diff --git a/glance/templates/registry.yaml b/glance/templates/registry.yaml new file mode 100644 index 0000000000..b176aa0900 --- /dev/null +++ b/glance/templates/registry.yaml @@ -0,0 +1,57 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: glance-registry +spec: + replicas: {{ .Values.replicas }} + template: + metadata: + labels: + app: glance-registry + annotations: + pod.beta.kubernetes.io/init-containers: '[ + { + "name": "init", + "image": "quay.io/stackanetes/kubernetes-entrypoint:v0.1.0", + "env": [ + { + "name": "NAMESPACE", + "value": "{{ .Release.Namespace }}" + }, + { + "name": "DEPENDENCY_SERVICE", + "value": "{{ include "joinListWithColon" .Values.dependencies.registry.service }}" + }, + { + "name": "DEPENDENCY_JOBS", + "value": "{{ include "joinListWithColon" .Values.dependencies.registry.jobs }}" + }, + { + "name": "COMMAND", + "value": "echo done" + } + ] + } + ]' + spec: + nodeSelector: + {{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }} + containers: + - name: glance-registry + image: {{ .Values.images.registry }} + imagePullPolicy: Always + command: + - glance-registr + ports: + - containerPort: {{ .Values.network.port.registry }} + readinessProbe: + tcpSocket: + port: {{ .Values.network.port.registry }} + volumeMounts: + - name: glanceregistryconf + mountPath: /etc/glance/glance-registry.conf + subPath: glance-registry.conf + volumes: + - name: glanceregistryconf + configMap: + name: glance-glanceregistryconf diff --git a/glance/templates/service-api.yaml b/glance/templates/service-api.yaml new file mode 100644 index 0000000000..7520120a22 --- /dev/null +++ b/glance/templates/service-api.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Service +metadata: + name: glance-api +spec: + ports: + - port: {{ .Values.network.port.api }} + selector: + app: glance-api diff --git a/glance/templates/service-registry.yaml b/glance/templates/service-registry.yaml new file mode 100644 index 0000000000..f8802cd3a0 --- /dev/null +++ b/glance/templates/service-registry.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: Service +metadata: + name: glance-registry +spec: + ports: + - port: {{ .Values.network.port.registry }} + selector: + app: glance-registry diff --git a/glance/templates/start.sh.yaml b/glance/templates/start.sh.yaml new file mode 100644 index 0000000000..e9b3d40ec9 --- /dev/null +++ b/glance/templates/start.sh.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: glance-startsh +data: + start.sh: |+ + #!/bin/bash + set -ex + + cp `find / -not -path "/etc/*" -name glance-api-paste.ini` /etc/glance/ + + glance-api diff --git a/glance/values.yaml b/glance/values.yaml new file mode 100644 index 0000000000..cc01d1983d --- /dev/null +++ b/glance/values.yaml @@ -0,0 +1,99 @@ +# Default values for keystone. +# This is a YAML-formatted file. +# Declare name/value pairs to be passed into your templates. +# name: value + +replicas: 1 + +labels: + node_selector_key: openstack-control-plane + node_selector_value: enabled + +images: + db_sync: quay.io/stackanetes/stackanetes-glance-api:newton + api: quay.io/stackanetes/stackanetes-glance-api:newton + init: quay.io/stackanetes/stackanetes-kolla-toolbox:newton + registry: quay.io/stackanetes/stackanetes-glance-registry:newton + post: quay.io/stackanetes/stackanetes-kolla-toolbox:newton + +keystone: + auth_uri: "http://keystone-api:5000" + auth_url: "http://keystone-api:35357" + admin_user: "admin" + admin_password: "password" + admin_project_name: "admin" + admin_region_name: "RegionOne" + + glance_user: "glance" + glance_password: "password" + glance_region_name: "RegionOne" + +network: + port: + api: 9292 + registry: 9191 + ip_address: "{{ .IP }}" + +database: + address: mariadb + port: 3306 + root_user: root + root_password: password + glance_database_name: glance + glance_password: password + glance_user: glance + +ceph: + enabled: true + monitors: [] + glance_user: "glance" + glance_pool: "images" + glance_keyring: "" + +misc: + workers: 8 + debug: false + +dependencies: + api: + jobs: + - glance-init + - glance-db-sync + - keystone-db-sync + service: + - keystone-api + - mariadb + registry: + jobs: + - glance-init + - glance-db-sync + - keystone-db-sync + service: + - keystone-api + - mariadb + - glance-api + db_sync: + jobs: + - keystone-init + - keystone-db-sync + - glance-init + - mariadb-seed + service: + - mariadb + init: + jobs: + - mariadb-seed + service: + - mariadb + post: + jobs: + - glance-init + - glance-db-sync + - keystone-db-sync + - keystone-init + - mariadb-init + service: + - mariadb + - keystone-api + - glance-api + - glance-registry \ No newline at end of file