From 38fb90d52824f9d23c99aab91e23097cd9b657d9 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Thu, 21 Mar 2019 12:36:49 +0100 Subject: [PATCH] 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 --- horizon/templates/bin/_horizon.sh.tpl | 17 +++++++++++++---- horizon/templates/deployment.yaml | 4 ++-- horizon/values.yaml | 11 +++++++++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/horizon/templates/bin/_horizon.sh.tpl b/horizon/templates/bin/_horizon.sh.tpl index dec000f3e2..4dbfc0eede 100644 --- a/horizon/templates/bin/_horizon.sh.tpl +++ b/horizon/templates/bin/_horizon.sh.tpl @@ -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 diff --git a/horizon/templates/deployment.yaml b/horizon/templates/deployment.yaml index d0531c4fa6..3baf1e294c 100644 --- a/horizon/templates/deployment.yaml +++ b/horizon/templates/deployment.yaml @@ -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 }} diff --git a/horizon/values.yaml b/horizon/values.yaml index 31ace979ca..e4f8c28320 100644 --- a/horizon/values.yaml +++ b/horizon/values.yaml @@ -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" }}