Allow more generic overrides for horizon

With this patch we allow for a more easy way of overriding some
of the values that may be used in other distros while maintainting
the default values if those values are not overriden.

The following values are introduced to be overriden:
conf:
  software:
    apache2:
      conf_dir:
      site_dir:
      mods_dir:
      binary:
      start_flags:
      a2enmod:
      a2dismod:

On which:
 * conf_dir: directory where to drop the config files
 * site_dir: directory where to drop the enabled virtualhosts
 * mods_dir: directory where to drop any mod configuration
 * binary: the binary to use for launching apache
 * start_flags: any flags that will be passed to the apache binary call
 * a2enmod: mods to enable
 * a2dismod: mods to disable

Notice that if there is no overrides given, it should not affect anything
and the templates will not be changed as the default values are set to what
they used to be as to not disrupt existing deployments.

Change-Id: If0fb9ab03aacfcd7087e753698880505571d0233
This commit is contained in:
Itxaka 2019-03-21 12:36:49 +01:00
parent cf21988ad0
commit 38fb90d528
No known key found for this signature in database
GPG Key ID: 0FFB0E56C3539E24
3 changed files with 26 additions and 6 deletions

View File

@ -27,8 +27,17 @@ function start () {
# wsgi/horizon-http needs open files here, including secret_key_store
chown -R horizon ${SITE_PACKAGES_ROOT}/openstack_dashboard/local/
a2enmod rewrite
a2dismod status
{{- if .Values.conf.software.apache2.a2enmod }}
{{- range .Values.conf.software.apache2.a2enmod }}
a2enmod {{ . }}
{{- end }}
{{- end }}
{{- if .Values.conf.software.apache2.a2dismod }}
{{- range .Values.conf.software.apache2.a2dismod }}
a2dismod {{ . }}
{{- end }}
{{- end }}
if [ -f /etc/apache2/envvars ]; then
# Loading Apache2 ENV variables
@ -53,11 +62,11 @@ function start () {
/tmp/manage.py compress --force
rm -rf /tmp/_tmp_.secret_key_store.lock /tmp/.secret_key_store
exec apache2 -DFOREGROUND
exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }}
}
function stop () {
apachectl -k graceful-stop
{{ .Values.conf.software.apache2.binary }} -k graceful-stop
}
$COMMAND

View File

@ -101,12 +101,12 @@ spec:
subPath: manage.py
readOnly: true
- name: horizon-etc
mountPath: /etc/apache2/sites-enabled/000-default.conf
mountPath: {{ .Values.conf.software.apache2.site_dir }}/000-default.conf
subPath: horizon.conf
readOnly: true
{{- if .Values.conf.horizon.security }}
- name: horizon-etc
mountPath: /etc/apache2/conf-available/security.conf
mountPath: {{ .Values.conf.software.apache2.conf_dir }}/security.conf
subPath: security.conf
readOnly: true
{{- end }}

View File

@ -57,6 +57,17 @@ network:
port: 31000
conf:
software:
apache2:
binary: apache2
start_parameters: -DFOREGROUND
site_dir: /etc/apache2/sites-enable
conf_dir: /etc/apache2/conf-enabled
mods_dir: /etc/apache2/mods-available
a2enmod:
- rewrite
a2dismod:
- status
horizon:
apache: |
Listen 0.0.0.0:{{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}