From cff52b9ff621b49005014ec2ad86f155e1e3cf43 Mon Sep 17 00:00:00 2001 From: okozachenko Date: Mon, 10 Jan 2022 20:13:42 +1100 Subject: [PATCH] Add custom logo Change-Id: Iaa1a023f19e40c96b35757f7e13c2cfbaebc6f22 --- horizon/Chart.yaml | 2 +- horizon/templates/bin/_horizon.sh.tpl | 7 +++++++ horizon/templates/configmap-logo.yaml | 28 +++++++++++++++++++++++++++ horizon/templates/deployment.yaml | 16 +++++++++++++++ horizon/values.yaml | 5 +++++ releasenotes/notes/horizon.yaml | 1 + 6 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 horizon/templates/configmap-logo.yaml diff --git a/horizon/Chart.yaml b/horizon/Chart.yaml index 06a5a9466c..e870ff8280 100644 --- a/horizon/Chart.yaml +++ b/horizon/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Horizon name: horizon -version: 0.2.16 +version: 0.2.17 home: https://docs.openstack.org/horizon/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Horizon/OpenStack_Project_Horizon_vertical.png sources: diff --git a/horizon/templates/bin/_horizon.sh.tpl b/horizon/templates/bin/_horizon.sh.tpl index 8e675529d2..1fedecd8be 100644 --- a/horizon/templates/bin/_horizon.sh.tpl +++ b/horizon/templates/bin/_horizon.sh.tpl @@ -77,6 +77,13 @@ function start () { unset PANEL_DIR fi + # Copy custom logo images + {{- if .Values.manifests.configmap_logo }} + cp /tmp/favicon.ico ${SITE_PACKAGES_ROOT}/openstack_dashboard/static/dashboard/img/favicon.ico + cp /tmp/logo.svg ${SITE_PACKAGES_ROOT}/openstack_dashboard/static/dashboard/img/logo.svg + cp /tmp/logo-splash.svg ${SITE_PACKAGES_ROOT}/openstack_dashboard/static/dashboard/img/logo-splash.svg + {{- end }} + # Compress Horizon's assets. /tmp/manage.py collectstatic --noinput /tmp/manage.py compress --force diff --git a/horizon/templates/configmap-logo.yaml b/horizon/templates/configmap-logo.yaml new file mode 100644 index 0000000000..be2ce87b9a --- /dev/null +++ b/horizon/templates/configmap-logo.yaml @@ -0,0 +1,28 @@ +{{/* +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. +*/}} + +{{- if .Values.manifests.configmap_logo }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: horizon-logo +binaryData: + favicon.ico: {{ .Values.conf.horizon.branding.favicon }} +data: + logo-splash.svg: |- + {{ .Values.conf.horizon.branding.logo_splash | nindent 4 }} + logo.svg: |- + {{ .Values.conf.horizon.branding.logo | nindent 4 }} +{{- end }} diff --git a/horizon/templates/deployment.yaml b/horizon/templates/deployment.yaml index dd20a76f94..7159032fd5 100644 --- a/horizon/templates/deployment.yaml +++ b/horizon/templates/deployment.yaml @@ -143,6 +143,17 @@ spec: subPath: {{ base $localSettingsFile }} readOnly: true {{- end }} + {{- if .Values.manifests.configmap_logo }} + - name: horizon-logo + mountPath: /tmp/logo.svg + subPath: logo.svg + - name: horizon-logo + mountPath: /tmp/logo-splash.svg + subPath: logo-splash.svg + - name: horizon-logo + mountPath: /tmp/favicon.ico + subPath: favicon.ico + {{- end }} {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.secrets.tls.dashboard.dashboard.internal "path" "/etc/openstack-dashboard/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal "path" "/etc/mysql/certs" | include "helm-toolkit.snippets.tls_volume_mount" | indent 12 }} {{ if $mounts_horizon.volumeMounts }}{{ toYaml $mounts_horizon.volumeMounts | indent 12 }}{{ end }} @@ -161,6 +172,11 @@ spec: secret: secretName: horizon-etc defaultMode: 0444 + {{- if .Values.manifests.configmap_logo }} + - name: horizon-logo + configMap: + name: horizon-logo + {{- end }} {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.endpoints.oslo_db.auth.admin.secret.tls.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} {{- dict "enabled" $envAll.Values.manifests.certificates "name" $envAll.Values.secrets.tls.dashboard.dashboard.internal | include "helm-toolkit.snippets.tls_volume" | indent 8 }} {{ if $mounts_horizon.volumes }}{{ toYaml $mounts_horizon.volumes | indent 8 }}{{ end }} diff --git a/horizon/values.yaml b/horizon/values.yaml index a20dca465a..26d8dc3e48 100644 --- a/horizon/values.yaml +++ b/horizon/values.yaml @@ -73,6 +73,10 @@ conf: a2dismod: - status horizon: + branding: + logo: + logo_splash: + favicon: apache: | Listen 0.0.0.0:{{ tuple "dashboard" "internal" "web" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} @@ -1346,6 +1350,7 @@ manifests: certificates: false configmap_bin: true configmap_etc: true + configmap_logo: false deployment: true ingress_api: true job_db_init: true diff --git a/releasenotes/notes/horizon.yaml b/releasenotes/notes/horizon.yaml index 5e8eab4759..b0e233fee9 100644 --- a/releasenotes/notes/horizon.yaml +++ b/releasenotes/notes/horizon.yaml @@ -26,4 +26,5 @@ horizon: - 0.2.14 Add OPENSTACK_ENDPOINT_TYPE value - 0.2.15 Add local_settings.d - 0.2.16 Fix container-infra value + - 0.2.17 Add custom logo ...