Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 2492 k8s nginx cfg #2493

Merged
merged 3 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions helm/config/nginx-custom.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
## This file contains custom configuration for nginx
## See https://nginx.org/en/docs/http/request_processing.html
## It will override any existing, matching config in /etc/nginx/nginx.conf
##
server {
listen 80 default_server;
listen [::]:80;
server_name _;

location {{ include "metacatui.clean.root" . }}/ {
root /usr/share/nginx/html;
index index.html index.htm;

# See https://nceas.github.io/metacatui/install/apache
#
#
# 1. Serve index.html instead of a 404 error in the MetacatUI directory.
# Equivalent to Apache directive: FallbackResource /metacatui/index.html
#
try_files $uri $uri/ {{ include "metacatui.clean.root" . }}/index.html;

# 2. Allow encoded slashes in URLs so encoded identifiers can be sent in MetacatUI URLs.
# Equivalent to Apache directive: AllowEncodedSlashes On
# (Apache allows encoded slashes to be used, and automatically decodes them)
# ** No config required; This is how NGINX behaves by default **
}
}
11 changes: 11 additions & 0 deletions helm/templates/config-js-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.appConfig.enabled }}
# Load only the "config/config.js" file into a ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-metacatui-config-js
labels:
{{- include "metacatui.labels" . | nindent 4 }}
data:
{{- (tpl (.Files.Glob "config/config.js").AsConfig . ) | nindent 2 }}
{{- end }}
6 changes: 2 additions & 4 deletions helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{{- if .Values.appConfig.enabled }}
# Load all files in the "config" directory into a ConfigMap
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-metacatui-config-js
name: {{ .Release.Name }}-metacatui-config-all
labels:
{{- include "metacatui.labels" . | nindent 4 }}
data:
{{- (tpl (.Files.Glob "config/config.js").AsConfig . ) | nindent 2 }}
{{- end }}
{{- (tpl (.Files.Glob "config/*").AsConfig . ) | nindent 2 }}
15 changes: 12 additions & 3 deletions helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ spec:
{{- include "metacatui.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- $configfiles := (.Files.Glob "config/*").AsConfig }}
checksum/config: {{ printf "%s" $configfiles | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "metacatui.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
Expand Down Expand Up @@ -136,11 +138,18 @@ spec:
- name: {{ .Release.Name }}-mcui-config-js
mountPath: {{ include "metacatui.root.mountpath" . }}/config/config.js
subPath: config.js
- name: {{ .Release.Name }}-mcui-config-all
mountPath: /etc/nginx/conf.d/default.conf
subPath: nginx-custom.conf
volumes:
- name: {{ .Release.Name }}-mcui-config-js
configMap:
name: {{ .Release.Name }}-metacatui-config-js
defaultMode: 0644
- name: {{ .Release.Name }}-mcui-config-all
configMap:
name: {{ .Release.Name }}-metacatui-config-all
defaultMode: 0644
- name: {{ .Release.Name }}-mcui-source-files
{{- if eq $source "pvc" }}
persistentVolumeClaim:
Expand Down
Loading