Skip to content
This repository was archived by the owner on Jul 24, 2019. It is now read-only.

Commit 2a321ff

Browse files
authored
Merge pull request #91 from alanmeadows/nova_chart
OpenStack Nova Helm Chart Initial Commit
2 parents bab88b8 + fc963e3 commit 2a321ff

27 files changed

Lines changed: 1375 additions & 4 deletions

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
.PHONY: ceph bootstrap mariadb keystone memcached rabbitmq common openstack neutron cinder heat maas all clean
1+
.PHONY: ceph bootstrap mariadb keystone memcached rabbitmq common openstack neutron nova cinder heat maas all clean
22

33
B64_DIRS := common/secrets
44
B64_EXCLUDE := $(wildcard common/secrets/*.b64)
55

6-
CHARTS := ceph mariadb rabbitmq memcached keystone glance horizon neutron cinder heat maas openstack
6+
CHARTS := ceph mariadb rabbitmq memcached keystone glance horizon neutron nova cinder heat maas openstack
77
COMMON_TPL := common/templates/_globals.tpl
88

9-
all: common ceph bootstrap mariadb rabbitmq memcached keystone glance horizon neutron cinder heat maas openstack
10-
9+
all: common ceph bootstrap mariadb rabbitmq memcached keystone glance horizon neutron nova cinder heat maas openstack
1110

1211
common: build-common
1312

@@ -30,6 +29,8 @@ glance: build-glance
3029

3130
neutron: build-neutron
3231

32+
nova: build-nova
33+
3334
heat: build-heat
3435

3536
maas: build-maas

nova/Chart.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
description: A Helm chart for nova
2+
name: nova
3+
version: 0.1.0

nova/requirements.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
dependencies:
2+
- name: common
3+
repository: http://localhost:8879/charts
4+
version: 0.1.0

nova/templates/bin/_db-sync.sh.tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
nova-manage db sync
5+
nova-manage api_db sync
6+
nova-manage db online_data_migrations

nova/templates/bin/_init.sh.tpl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
echo "Hello World"
4+
5+
set -ex
6+
export HOME=/tmp
7+
8+
ansible localhost -vvv -m mysql_db -a "login_host='{{ include "keystone_db_host" . }}' \
9+
login_port='{{ .Values.database.port }}' \
10+
login_user='{{ .Values.database.root_user }}' \
11+
login_password='{{ .Values.database.root_password }}' \
12+
name='{{ .Values.database.nova_database_name }}'"
13+
14+
ansible localhost -vvv -m mysql_user -a "login_host='{{ include "keystone_db_host" . }}' \
15+
login_port='{{ .Values.database.port }}' \
16+
login_user='{{ .Values.database.root_user }}' \
17+
login_password='{{ .Values.database.root_password }}' \
18+
name='{{ .Values.database.nova_user }}' \
19+
password='{{ .Values.database.nova_password }}' \
20+
host='%' \
21+
priv='{{ .Values.database.nova_database_name }}.*:ALL' append_privs='yes'"
22+
23+
ansible localhost -vvv -m mysql_db -a "login_host='{{ include "keystone_db_host" . }}' \
24+
login_port='{{ .Values.database.port }}' \
25+
login_user='{{ .Values.database.root_user }}' \
26+
login_password='{{ .Values.database.root_password }}' \
27+
name='{{ .Values.database.nova_api_database_name }}'"
28+
29+
ansible localhost -vvv -m mysql_user -a "login_host='{{ include "keystone_db_host" . }}' \
30+
login_port='{{ .Values.database.port }}' \
31+
login_user='{{ .Values.database.root_user }}' \
32+
login_password='{{ .Values.database.root_password }}' \
33+
name='{{ .Values.database.nova_user }}' \
34+
password='{{ .Values.database.nova_password }}' \
35+
host='%' \
36+
priv='{{ .Values.database.nova_api_database_name }}.*:ALL' append_privs='yes'"

nova/templates/bin/_libvirt.sh.tpl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
if [[ -f /var/run/libvirtd.pid ]]; then
5+
test -d /proc/$(< /var/run/libvirtd.pid) && \
6+
( echo "Libvirtd daemon is running" && exit 10 )
7+
fi
8+
9+
rm -f /var/run/libvirtd.pid
10+
11+
if [[ -c /dev/kvm ]]; then
12+
chmod 660 /dev/kvm
13+
chown root:kvm /dev/kvm
14+
fi
15+
16+
17+
sleep 30
18+
19+
{{- if .Values.ceph.enabled }}
20+
cat > /tmp/secret.xml <<EOF
21+
<secret ephemeral='no' private='no'>
22+
<uuid>{{ .Values.ceph.secret_uuid }}</uuid>
23+
<usage type='ceph'>
24+
<name>client.{{ .Values.ceph.cinder_user }} secret</name>
25+
</usage>
26+
</secret>
27+
EOF
28+
29+
virsh secret-define --file /tmp/secret.xml
30+
virsh secret-set-value --secret {{ .Values.ceph.secret_uuid }} --base64 {{ .Values.ceph.cinder_keyring }}
31+
rm /tmp/secret.xml
32+
{{- end }}
33+
34+
35+
exec libvirtd -v --listen

nova/templates/bin/_post.sh.tpl

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
set -ex
3+
export HOME=/tmp
4+
5+
ansible localhost -vvv -m kolla_keystone_service -a "service_name=nova \
6+
service_type=compute \
7+
description='Openstack Compute' \
8+
endpoint_region={{ .Values.keystone.nova_region_name }} \
9+
url='{{ include "endpoint_nova_api_internal" . }}' \
10+
interface=admin \
11+
region_name={{ .Values.keystone.admin_region_name }} \
12+
auth='{{ include "keystone_auth" .}}'" \
13+
-e "{'openstack_nova_auth':{{ include "keystone_auth" .}}}"
14+
15+
ansible localhost -vvv -m kolla_keystone_service -a "service_name=nova \
16+
service_type=compute \
17+
description='Openstack Compute' \
18+
endpoint_region={{ .Values.keystone.nova_region_name }} \
19+
url='{{ include "endpoint_nova_api_internal" . }}' \
20+
interface=internal \
21+
region_name={{ .Values.keystone.admin_region_name }} \
22+
auth='{{ include "keystone_auth" .}}'" \
23+
-e "{'openstack_nova_auth':{{ include "keystone_auth" .}}}"
24+
25+
ansible localhost -vvv -m kolla_keystone_service -a "service_name=nova \
26+
service_type=compute \
27+
description='Openstack Compute' \
28+
endpoint_region={{ .Values.keystone.nova_region_name }} \
29+
url='{{ include "endpoint_nova_api_internal" . }}' \
30+
interface=public \
31+
region_name={{ .Values.keystone.admin_region_name }} \
32+
auth='{{ include "keystone_auth" .}}'" \
33+
-e "{'openstack_nova_auth':{{ include "keystone_auth" .}}}"
34+
35+
ansible localhost -vvv -m kolla_keystone_user -a "project=service \
36+
user={{ .Values.keystone.nova_user }} \
37+
password={{ .Values.keystone.nova_password }} \
38+
role=admin \
39+
region_name={{ .Values.keystone.nova_region_name }} \
40+
auth='{{ include "keystone_auth" .}}'" \
41+
-e "{'openstack_nova_auth':{{ include "keystone_auth" .}}}"
42+
43+
cat <<EOF>/tmp/openrc
44+
export OS_USERNAME={{.Values.keystone.admin_user}}
45+
export OS_PASSWORD={{.Values.keystone.admin_password}}
46+
export OS_PROJECT_DOMAIN_NAME={{.Values.keystone.domain_name}}
47+
export OS_USER_DOMAIN_NAME={{.Values.keystone.domain_name}}
48+
export OS_PROJECT_NAME={{.Values.keystone.admin_project_name}}
49+
export OS_AUTH_URL={{include "endpoint_keystone_internal" .}}
50+
export OS_AUTH_STRATEGY=keystone
51+
export OS_REGION_NAME={{.Values.keystone.admin_region_name}}
52+
export OS_INSECURE=1
53+
EOF
54+
55+
. /tmp/openrc
56+
env
57+
openstack --debug role create _member_ --or-show
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
#
5+
# start nova-api-osapi service
6+
#
7+
# this helper script ensures our osapi service does not try to call iptables which requires privileged or NET_ADMIN privileges
8+
# by stubbing in a fake iptables scripts
9+
10+
echo <<EOF>/tmp/iptables
11+
#!/bin/sh
12+
# nova-api-metadata trys to run some iptables commands
13+
# This enables the api-only container to run without NET_ADMIN privileges
14+
true
15+
EOF
16+
17+
# make it executable and copy it over whatever iptables may be underneath in this image
18+
chmod +x /tmp/iptables
19+
cp -p /tmp/iptables /sbin/iptables
20+
cp -p /tmp/iptables /sbin/iptables-restore
21+
cp -p /tmp/iptables /sbin/iptables-save
22+
23+
exec nova-api --config-file /etc/nova/nova.conf

nova/templates/configmap-bin.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: nova-bin
5+
data:
6+
db-sync.sh: |
7+
{{ tuple "bin/_db-sync.sh.tpl" . | include "template" | indent 4 }}
8+
init.sh: |
9+
{{ tuple "bin/_init.sh.tpl" . | include "template" | indent 4 }}
10+
start-osapi.sh: |
11+
{{ tuple "bin/_start-osapi.sh.tpl" . | include "template" | indent 4 }}
12+
post.sh: |
13+
{{ tuple "bin/_post.sh.tpl" . | include "template" | indent 4 }}
14+
libvirt.sh: |
15+
{{ tuple "bin/_libvirt.sh.tpl" . | include "template" | indent 4 }}

nova/templates/configmap-etc.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: nova-etc
5+
data:
6+
nova.conf: |+
7+
{{ tuple "etc/_nova.conf.tpl" . | include "template" | indent 4 }}
8+
ceph.client.cinder.keyring.yaml: |+
9+
{{ tuple "etc/_ceph.client.cinder.keyring.yaml.tpl" . | include "template" | indent 4 }}
10+
resolv.conf: |+
11+
{{ tuple "etc/_resolv.conf.tpl" . | include "template" | indent 4 }}
12+
libvirtd.conf: |+
13+
{{ tuple "etc/_libvirtd.conf.tpl" . | include "template" | indent 4 }}

0 commit comments

Comments
 (0)