Add horizon service definition for k8s
Change-Id: I379620e05ebc82cf26aaf63f84d5c58120cb48a2
This commit is contained in:
parent
3cb41fca6b
commit
e9a60021fb
|
@ -1,10 +1,12 @@
|
||||||
FROM {{ namespace }}/openstack-base:{{ tag }}
|
FROM {{ namespace }}/openstack-base:{{ tag }}
|
||||||
MAINTAINER {{ maintainer }}
|
MAINTAINER {{ maintainer }}
|
||||||
|
|
||||||
|
#netcat is for test whether keystone is alive
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install --no-install-recommends -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
|
&& apt-get install --no-install-recommends -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" \
|
||||||
apache2 \
|
apache2 \
|
||||||
libapache2-mod-wsgi \
|
libapache2-mod-wsgi \
|
||||||
|
netcat \
|
||||||
&& ln -s ../mods-available/headers.load /etc/apache2/mods-enabled/headers.load
|
&& ln -s ../mods-available/headers.load /etc/apache2/mods-enabled/headers.load
|
||||||
|
|
||||||
RUN curl -o horizon-{{ branch }}.tar.gz http://tarballs.openstack.org/horizon/horizon-{{ branch }}.tar.gz \
|
RUN curl -o horizon-{{ branch }}.tar.gz http://tarballs.openstack.org/horizon/horizon-{{ branch }}.tar.gz \
|
||||||
|
@ -18,7 +20,7 @@ RUN mv horizon*/ horizon-{{ branch }}/ \
|
||||||
&& /var/lib/microservices/venv/bin/pip --no-cache-dir install --upgrade -c /horizon-{{ branch }}/requirements.txt /horizon-{{ branch }} \
|
&& /var/lib/microservices/venv/bin/pip --no-cache-dir install --upgrade -c /horizon-{{ branch }}/requirements.txt /horizon-{{ branch }} \
|
||||||
&& useradd --user-group horizon \
|
&& useradd --user-group horizon \
|
||||||
&& ln -s /etc/openstack-dashboard/local_settings /var/lib/microservices/venv/lib/python2.7/site-packages/openstack_dashboard/local/local_settings.py \
|
&& ln -s /etc/openstack-dashboard/local_settings /var/lib/microservices/venv/lib/python2.7/site-packages/openstack_dashboard/local/local_settings.py \
|
||||||
&& cp -r /horizon-source/openstack_dashboard/conf/* /etc/openstack-dashboard/ \
|
&& cp -r /horizon-{{ branch }}/openstack_dashboard/conf/* /etc/openstack-dashboard/ \
|
||||||
&& cp /horizon-{{ branch }}/manage.py /var/lib/microservices/venv/bin/manage.py \
|
&& cp /horizon-{{ branch }}/manage.py /var/lib/microservices/venv/bin/manage.py \
|
||||||
&& /var/lib/microservices/venv/bin/python /var/lib/microservices/venv/bin/manage.py collectstatic --noinput --clear \
|
&& /var/lib/microservices/venv/bin/python /var/lib/microservices/venv/bin/manage.py collectstatic --noinput --clear \
|
||||||
&& chown -R horizon: /etc/openstack-dashboard /home/horizon /var/lib/microservices/venv/lib/python2.7/site-packages/static /horizon-{{ branch }}
|
&& chown -R horizon: /etc/openstack-dashboard /home/horizon /var/lib/microservices/venv/lib/python2.7/site-packages/static /horizon-{{ branch }}
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
/var/lib/microservices/venv/bin/python /var/lib/microservices/venv/bin/manage.py compress --force
|
/var/lib/microservices/venv/bin/python \
|
||||||
|
/var/lib/microservices/venv/bin/manage.py compress --force
|
||||||
|
|
||||||
source /etc/apache2/envvars
|
source /etc/apache2/envvars
|
||||||
|
|
||||||
sed -i "s/Secret_String/${HORIZON_SECRET_KEY}" /etc/openstack-dashboard/local_settings
|
sed -i "s/Secret_String/${HORIZON_SECRET_KEY}" \
|
||||||
sed -i "s/KEYSTONE_ADDRESS/${KEYSTONE_ADDRESS}" /etc/openstack-dashboard/local_settings
|
/etc/openstack-dashboard/local_settings
|
||||||
|
sed -i "s/KEYSTONE_ADDRESS/${KEYSTONE_ADDRESS}" \
|
||||||
|
/etc/openstack-dashboard/local_settings
|
||||||
|
|
||||||
|
#check does keyston is alive
|
||||||
|
nc -z -v -w5 ${KEYSTONE_ADDRESS} 5000
|
||||||
|
if [ $? -ne 0 ];then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
exec /usr/sbin/apache2 -DNO_DETACH
|
exec /usr/sbin/apache2 -DNO_DETACH
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: horizon
|
||||||
|
labels:
|
||||||
|
app: horizon
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: horizon
|
||||||
|
image: {{ namespace }}/horizon:{{ tag }}
|
||||||
|
env:
|
||||||
|
- name: KEYSTONE_ADDRESS
|
||||||
|
value: keystone-service.default.svc.cluster.local
|
||||||
|
imagePullPolicy: Always
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
hostPort: 80
|
|
@ -0,0 +1,23 @@
|
||||||
|
{
|
||||||
|
"kind": "Service",
|
||||||
|
"apiVersion": "v1",
|
||||||
|
"metadata": {
|
||||||
|
"name": "horizon-service"
|
||||||
|
},
|
||||||
|
"spec": {
|
||||||
|
"selector": {
|
||||||
|
"app": "horizon"
|
||||||
|
},
|
||||||
|
"ports": [
|
||||||
|
{
|
||||||
|
"name": "www",
|
||||||
|
"protocol": "TCP",
|
||||||
|
"port": 80,
|
||||||
|
"targetPort": 80,
|
||||||
|
"nodePort": 30080
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "NodePort"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue