Initial libvirt and nova-compute structure

This lays the groundwork for the docker compute container.

The compute node is composed of libvirt container and a nove-compute
container.  We are going to have to sort out how to get k8s to schedule
this pod 1 per node.

Change-Id: I1e06e4b5f5bde83b582edfc1094084a4ee353371
Partial-blueprint: kube-libvirt-container
Partial-blueprint: kube-nova-container
This commit is contained in:
Steven Dake 2014-10-02 23:35:27 -07:00
parent a6310d7692
commit 46cbe821a2
15 changed files with 152 additions and 1 deletions

@ -1,7 +1,7 @@
#!/bin/bash
# If the directories were numbered, a simple find could be used to build ;-)
CONTAINERS=(fedora-rdo-base cinder glance/glance-base glance/glance-api glance/glance-registry heat/heat-base heat/heat-api heat/heat-engine keystone mariadb rabbitmq swift/swift-base swift/swift-account swift/swift-container swift/swift-object swift/swift-proxy-server)
CONTAINERS=(fedora-rdo-base cinder glance/glance-base glance/glance-api glance/glance-registry heat/heat-base heat/heat-api heat/heat-engine keystone mariadb rabbitmq swift/swift-base swift/swift-account swift/swift-container swift/swift-object swift/swift-proxy-server nova-compute/nova-base nova-compute/nova-compute nova-compute/nova-libvirt)
for IMAGE in ${CONTAINERS[@]}; do
pushd .

2
docker/nova-compute/build Executable file

@ -0,0 +1,2 @@
#!/bin/bash
docker build --tag kollaglue/fedora-rdo-nova-compute .

@ -0,0 +1,7 @@
FROM fedora-rdo-base
MAINTAINER Steven Dake <sdake@redhat.com>
RUN yum -y install \
openstack-utils \
openstack-nova-common \
mariadb && yum clean all

@ -0,0 +1,2 @@
#!/bin/bash
docker build --tag kollaglue/fedora-rdo-nova-base .

@ -0,0 +1,2 @@
#!/bin/bash
docker push kollaglue/fedora-rdo-nova-base .

@ -0,0 +1,56 @@
{
"id": "nova",
"desiredState": {
"manifest": {
"version": "v1beta1",
"id": "nova-1",
"containers": [
{
"name": "nova-compute",
"image": "fedora-rdo-nova-compute",
"ports": [
{"containerPort": 9292}
],
"env": [
{
"name": "DB_ROOT_PASSWORD",
"value": "password"
},
{
"name": "HEAT_DB_PASSWORD",
"value": "novadbpassword"
},
{
"name": "KEYSTONE_ADMIN_TOKEN",
"value": "ADMINTOKEN"
}
]
},
{
"name": "nova-libvirt",
"image": "fedora-rdo-nova-libvirt",
"ports": [
{"containerPort": 9292}
],
"env": [
{
"name": "DB_ROOT_PASSWORD",
"value": "password"
},
{
"name": "HEAT_DB_PASSWORD",
"value": "novadbpassword"
},
{
"name": "KEYSTONE_ADMIN_TOKEN",
"value": "ADMINTOKEN"
}
]
}
]
}
},
"labels": {
"name": "nova-compute"
}
}

@ -0,0 +1,22 @@
FROM kollaglue/fedora-rdo-nova-base
MAINTAINER Steven Dake <sdake@redhat.com>
# broken out by operation - we don't need libvirt and
# 200 deps for libguestfs (?)
RUN yum -y install curl
RUN yum -y install iscsi-initiator-utils
RUN yum -y install iptables
RUN yum -y install iptables-ipv6
RUN yum -y install ipmitool
RUN yum -y install libvirt-python
RUN yum -y install python-libguestfs
RUN yum -y install openssh-clients
RUN yum -y install rsync
RUN yum -y install lvm2
RUN yum -y install python-cinderclient
RUN yum -y install genisoimage
RUN yum -y install bridge-utils
RUN yum -y install openstack-nova-compute
ADD ./start.sh /start.sh
CMD ["/start.sh"]

@ -0,0 +1,2 @@
#!/bin/bash
docker build --tag kollaglue/fedora-rdo-nova-compute .

@ -0,0 +1,2 @@
#!/bin/bash
docker push kollaglue/fedora-rdo-nova-compute .

@ -0,0 +1,40 @@
#!/bin/sh
: ${NOVA_DB_USER:=nova}
: ${NOVA_DB_NAME:=nova}
: ${KEYSTONE_AUTH_PROTOCOL:=http}
: ${NOVA_KEYSTONE_USER:=nova}
: ${ADMIN_TENANT_NAME:=admin}
if ! [ "$KEYSTONE_ADMIN_TOKEN" ]; then
echo "*** Missing KEYSTONE_ADMIN_TOKEN" >&2
exit 1
fi
if ! [ "$DB_ROOT_PASSWORD" ]; then
echo "*** Missing DB_ROOT_PASSWORD" >&2
exit 1
fi
if ! [ "$NOVA_DB_PASSWORD" ]; then
NOVA_DB_PASSWORD=$(openssl rand -hex 15)
export NOVA_DB_PASSWORD
fi
sh /opt/nova/config-nova.sh compute
mysql -h ${MARIADBMASTER_PORT_3306_TCP_ADDR} -u root \
-p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${NOVA_DB_NAME};
GRANT ALL PRIVILEGES ON nova* TO
'${NOVA_DB_USER}'@'%' IDENTIFIED BY '${NOVA_DB_PASSWORD}'
EOF
export SERVICE_TOKEN="${KEYSTONE_ADMIN_TOKEN}"
export SERVICE_ENDPOINT="${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONEMASTER_35357_PORT_35357_TCP_ADDR}:35357/v2.0"
/usr/bin/keystone user-create --name ${NOVA_KEYSTONE_USER} --pass ${NOVA_ADMIN_PASSWORD}
/usr/bin/keystone role-create --name ${NOVA_KEYSTONE_USER}
/usr/bin/keystone user-role-add --user ${NOVA_KEYSTONE_USER} --role admin --tenant ${ADMIN_TENANT_NAME}
exec /usr/bin/nova-compute

@ -0,0 +1,8 @@
FROM kollaglue/fedora-rdo-base
MAINTAINER Steven Dake <sdake@redhat.com>
RUN yum -y install libvirt \
libvirt-daemon-kvm && yum clean all
ADD ./start.sh /start.sh
CMD ["/start.sh"]

@ -0,0 +1,2 @@
#!/bin/bash
docker build --tag kollaglue/fedora-rdo-nova-libvirt .

@ -0,0 +1,2 @@
#!/bin/bash
docker push kollaglue/fedora-rdo-nova-libvirt .

@ -0,0 +1,2 @@
#!/bin/sh
# placeholder for libvirt startup script

2
docker/nova-compute/push Executable file

@ -0,0 +1,2 @@
#!/bin/bash
docker push kollaglue/fedora-rdo-nova-compute .