Merge branch 'master' of github.com:att-comdev/aic-helm

This commit is contained in:
Alan Meadows 2016-12-08 10:20:00 -08:00
commit f51648ccd5
32 changed files with 786 additions and 7 deletions

3
glance/Chart.yaml Normal file
View File

@ -0,0 +1,3 @@
description: A Helm chart for glance
name: glance
version: 0.1.0

19
glance/requirements.yaml Normal file
View File

@ -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

View File

@ -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}}

80
glance/templates/api.yaml Normal file
View File

@ -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: {}

View File

@ -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 }}

View File

@ -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

View File

@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: glance-dbsyncsh
data:
db-sync.sh: |+
#!/bin/bash
set -ex
glance-manage db_sync

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'"

View File

@ -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

View File

@ -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" .}}}"

View File

@ -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

View File

@ -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

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: glance-api
spec:
ports:
- port: {{ .Values.network.port.api }}
selector:
app: glance-api

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: glance-registry
spec:
ports:
- port: {{ .Values.network.port.registry }}
selector:
app: glance-registry

View File

@ -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

99
glance/values.yaml Normal file
View File

@ -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

View File

@ -0,0 +1,3 @@
{{- define "joinListWithColon" -}}
{{ range $k, $v := . }}{{ if $k }},{{ end }}{{ $v }}{{ end }}
{{- end -}}

View File

@ -24,11 +24,11 @@ spec:
},
{
"name": "DEPENDENCY_SERVICE",
"value": "mariadb,rabbitmq"
"value": "{{ include "joinListWithColon" .Values.dependencies.api.service }}"
},
{
"name": "DEPENDENCY_JOBS",
"value": "mariadb-seed,keystone-db-sync"
"value": "{{ include "joinListWithColon" .Values.dependencies.api.jobs }}"
},
{
"name": "COMMAND",

View File

@ -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",

View File

@ -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",
@ -37,7 +37,7 @@ spec:
image: {{ .Values.images.init }}
imagePullPolicy: Always
command:
- bash
- bash
- /tmp/init.sh
volumeMounts:
- name: keystone-bin

View File

@ -47,3 +47,22 @@ database:
misc:
workers: 8
debug: false
dependencies:
api:
jobs:
- mariadb-seed
- keystone-db-sync
service:
- mariadb
db_sync:
jobs:
- keystone-init
- mariadb-seed
service:
- mariadb
init:
jobs:
- mariadb-seed
service:
- mariadb

26
maas/.helmignore Normal file
View File

@ -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

3
maas/Chart.yaml Executable file
View File

@ -0,0 +1,3 @@
description: Chart to run MaaS
name: maas
version: 0.1.0

28
maas/README.md Normal file
View File

@ -0,0 +1,28 @@
# 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 <nodes> 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
```

View File

@ -0,0 +1,19 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: maas-rack
spec:
template:
metadata:
labels:
app: maas-rack-controller
spec:
nodeSelector:
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
hostNetwork: true
containers:
- name: maas-rack
image: {{ .Values.images.maas_rack }}
imagePullPolicy: Always
securityContext:
privileged: true

View File

@ -0,0 +1,20 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: maas-region
spec:
template:
metadata:
labels:
app: maas-region
spec:
nodeSelector:
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
containers:
- name: maas-region
image: {{ .Values.images.maas_region }}
imagePullPolicy: Always
ports:
- containerPort: {{ .Values.network.port.region_container }}
securityContext:
privileged: true

View File

@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
name: maas-region-ui
labels:
app: maas-region-ui
spec:
ports:
- port: {{ .Values.network.port.service_gui }}
targetPort: {{ .Values.network.port.service_gui_target }}
protocol: TCP
name: gui
- port: {{ .Values.network.port.service_proxy }}
targetPort: {{ .Values.network.port.service_proxy_target }}
protocol: TCP
name: proxy
selector:
app: maas-region

31
maas/tests/test-pxe-client.sh Executable file
View File

@ -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 <<EOF>/tmp/maas-net.xml
<!-- Network Management VLAN -->
<network>
<name>maas</name>
<bridge name="maas"/>
<forward mode="bridge"/>
</network>
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

19
maas/values.yaml Normal file
View File

@ -0,0 +1,19 @@
# Default values for maas.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
images:
maas_region: quay.io/attcomdev/maas-region:1.0.1
maas_rack: quay.io/attcomdev/maas-rack:1.0.1
labels:
node_selector_key: openstack-control-plane
node_selector_value: enabled
network:
port:
region_container: 80
service_gui: 80
service_gui_target: 80
service_proxy: 8000
service_proxy_target: 8000