From 861810c1d48d4698daf580f16b40bab7399a5e10 Mon Sep 17 00:00:00 2001 From: Alexandru Mahmoud Date: Thu, 7 Oct 2021 18:46:22 -0400 Subject: [PATCH 1/4] Add applyToNginx for extraFileMappings --- galaxy/templates/deployment-nginx.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/galaxy/templates/deployment-nginx.yaml b/galaxy/templates/deployment-nginx.yaml index 73aeae5c..1564fad0 100644 --- a/galaxy/templates/deployment-nginx.yaml +++ b/galaxy/templates/deployment-nginx.yaml @@ -37,6 +37,13 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} volumeMounts: + {{- range $key, $entry := .Values.extraFileMappings -}} + {{- if $entry.applyToNginx }} + - name: {{ include "galaxy.getExtraFilesUniqueName" $key }} + mountPath: {{ $key }} + subPath: {{ include "galaxy.getFilenameFromPath" $key }} + {{- end }} + {{- end }} - name: static-dir mountPath: /tmp/galaxy command: ['/bin/sh', '-c', 'cp -r /galaxy/server/static /tmp/galaxy/static;'] @@ -49,6 +56,13 @@ spec: containerPort: 80 protocol: TCP volumeMounts: + {{- range $key, $entry := .Values.extraFileMappings -}} + {{- if $entry.applyToNginx }} + - name: {{ include "galaxy.getExtraFilesUniqueName" $key }} + mountPath: {{ $key }} + subPath: {{ include "galaxy.getFilenameFromPath" $key }} + {{- end }} + {{- end }} - name: nginx-conf mountPath: /etc/nginx/nginx.conf subPath: nginx.conf @@ -81,6 +95,18 @@ spec: exec: command: ["/usr/sbin/nginx","-s","quit"] volumes: + {{- range $key, $entry := .Values.extraFileMappings -}} + {{- if $entry.applyToNginx }} + - name: {{ include "galaxy.getExtraFilesUniqueName" $key }} + {{- if $entry.useSecret }} + secret: + secretName: {{ printf "%s-%s" (include "galaxy.fullname" $) (include "galaxy.getExtraFilesUniqueName" $key) }} + {{- else }} + configMap: + name: {{ printf "%s-%s" (include "galaxy.fullname" $) (include "galaxy.getExtraFilesUniqueName" $key) }} + {{- end }} + {{- end }} + {{- end }} - name: nginx-conf configMap: name: {{ template "galaxy.fullname" $ }}-nginx-conf From c4e21b3bc1d7950c978738d450592e23318542b2 Mon Sep 17 00:00:00 2001 From: Alexandru Mahmoud Date: Thu, 7 Oct 2021 18:51:23 -0400 Subject: [PATCH 2/4] Add applyToNginx to welcome page --- galaxy/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/galaxy/values.yaml b/galaxy/values.yaml index 7e4b6bbe..650bf1e2 100644 --- a/galaxy/values.yaml +++ b/galaxy/values.yaml @@ -593,6 +593,7 @@ extraFileMappings: applyToJob: false applyToWeb: true applyToWorkflow: false + applyToNginx: true tpl: true content: | From 816884b7fbfdc4a52682ce644bf712d0b63288c7 Mon Sep 17 00:00:00 2001 From: Alexandru Mahmoud Date: Thu, 7 Oct 2021 18:57:50 -0400 Subject: [PATCH 3/4] Update README for extraFileMappings --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c8248391..b0cd05f6 100644 --- a/README.md +++ b/README.md @@ -263,7 +263,10 @@ jobHandlers: ## Extra File Mappings -The `extraFileMappings` field can be used to inject files to arbitrary paths in the `job`, `web`, or `workflow` handlers. The contents of the file can be specified directly in the `values.yml` file with the `content` attribute, or by specifying the path to the file to be injected with the `path` attribute. +The `extraFileMappings` field can be used to inject files to arbitrary paths in the `nginx` deployment, as well as any of the `job`, `web`, or `workflow` handlers. +The contents of the file can be specified directly in the `values.yml` file with the `content` attribute. +The `tpl` flag will determine whether these contents are run through the helm templating engine. +Note: when running with `tpl: true`, brackets (`{{ }}`) not meant for Helm should be escaped. One way of escaping is: `{{ '{{ mynon-helm-content}}' }}` ```yaml extraFileMappings: @@ -271,12 +274,11 @@ extraFileMappings: applyToWeb: true applyToJob: false applyToWorkflow: false + applyToNginx: true + tpl: false content: | ... - /galaxy/server/config/object_store_conf.xml: - applyToWeb: true - path: files/config/object_store_conf.xml ``` **NOTE** for security reasons Helm will not load files from outside the chart so the `path` must be a relative path to location inside the chart directory. This will change when [helm#3276](https://github.com/helm/helm/issues/3276) is resolved. In the interim files can be loaded from external locations by: From ca4b382a47583f508ba2de616b2fe32b9078303d Mon Sep 17 00:00:00 2001 From: Alexandru Mahmoud Date: Thu, 7 Oct 2021 18:59:53 -0400 Subject: [PATCH 4/4] Add spaces to extraFileMappings --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index b0cd05f6..3a8d4ec0 100644 --- a/README.md +++ b/README.md @@ -264,8 +264,11 @@ jobHandlers: ## Extra File Mappings The `extraFileMappings` field can be used to inject files to arbitrary paths in the `nginx` deployment, as well as any of the `job`, `web`, or `workflow` handlers. + The contents of the file can be specified directly in the `values.yml` file with the `content` attribute. + The `tpl` flag will determine whether these contents are run through the helm templating engine. + Note: when running with `tpl: true`, brackets (`{{ }}`) not meant for Helm should be escaped. One way of escaping is: `{{ '{{ mynon-helm-content}}' }}` ```yaml