Nova: Move placement API to run behind Apache

This PS moves the placement API to run behind Apache, to match
the recommended deployment method.

Change-Id: Id057ef042cf30300c0cd35265dff6a9c16694c70
This commit is contained in:
portdirect 2017-11-30 13:40:31 -05:00
parent a3f40dcc07
commit 5986506799
5 changed files with 74 additions and 3 deletions

View File

@ -20,12 +20,20 @@ set -ex
COMMAND="${@:-start}"
function start () {
exec nova-placement-api \
--port {{ .Values.network.placement.port }}
cp -a $(type -p nova-placement-api) /var/www/cgi-bin/nova/
if [ -f /etc/apache2/envvars ]; then
# Loading Apache2 ENV variables
source /etc/apache2/envvars
fi
# Start Apache2
exec apache2 -DFOREGROUND
}
function stop () {
kill -TERM 1
apachectl -k graceful-stop
}
$COMMAND

View File

@ -149,6 +149,8 @@ data:
{{- tuple .Values.conf.rootwrap_filters.network "etc/rootwrap.d/_network.filters.tpl" . | include "helm-toolkit.utils.configmap_templater" }}
nova.conf: |+
{{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.nova | indent 4 }}
wsgi-nova-placement.conf: |+
{{- tuple .Values.conf.wsgi_placement "etc/_wsgi-nova-placement.conf.tpl" . | include "helm-toolkit.utils.configmap_templater" }}
ssh-config.sh: |+
{{- tuple .Values.conf.ssh "etc/_ssh-config.tpl" . | include "helm-toolkit.utils.configmap_templater" }}
{{- end }}

View File

@ -62,6 +62,8 @@ spec:
tcpSocket:
port: {{ .Values.network.placement.port }}
volumeMounts:
- name: wsgi-nova
mountPath: /var/www/cgi-bin/nova
- name: nova-bin
mountPath: /tmp/nova-placement-api.sh
subPath: nova-placement-api.sh
@ -78,8 +80,14 @@ spec:
mountPath: /etc/nova/policy.yaml
subPath: policy.yaml
readOnly: true
- name: nova-etc
mountPath: /etc/apache2/conf-enabled/wsgi-nova-placement.conf
subPath: wsgi-nova-placement.conf
readOnly: true
{{- if $mounts_nova_placement.volumeMounts }}{{ toYaml $mounts_nova_placement.volumeMounts | indent 12 }}{{ end }}
volumes:
- name: wsgi-nova
emptyDir: {}
- name: nova-bin
configMap:
name: nova-bin

View File

@ -0,0 +1,50 @@
{{/*
Copyright 2017 The Openstack-Helm Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
Listen 0.0.0.0:{{ .Values.network.placement.port }}
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
CustomLog /dev/stdout combined env=!forwarded
CustomLog /dev/stdout proxy env=forwarded
<VirtualHost *:{{ .Values.network.placement.port }}>
WSGIDaemonProcess placement-api processes=1 threads=4 user=nova group=nova display-name=%{GROUP}
WSGIProcessGroup placement-api
WSGIScriptAlias / /var/www/cgi-bin/nova/nova-placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
<IfVersion >= 2.4>
ErrorLogFormat "%{cu}t %M"
</IfVersion>
ErrorLog /dev/stdout
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded
CustomLog /dev/stdout combined env=!forwarded
CustomLog /dev/stdout proxy env=forwarded
</VirtualHost>
Alias /placement /var/www/cgi-bin/nova/nova-placement-api
<Location /placement>
SetHandler wsgi-script
Options +ExecCGI
WSGIProcessGroup placement-api
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
</Location>

View File

@ -941,6 +941,9 @@ conf:
rootwrap:
override:
append:
wsgi_placement:
override:
append:
rootwrap_filters:
api_metadata:
override: