From 8910f6fea6ad2be5ff5c70a77da875046fbc46e9 Mon Sep 17 00:00:00 2001
From: Remi PLANEL <rplanel@pasteur.fr>
Date: Thu, 7 Dec 2023 17:47:03 +0100
Subject: [PATCH] config nginx as configmap
---
.../templates/configmap-nginx-conf.yaml | 20 +++++++++++++++++++
deploy/df-wiki/templates/deployment.yaml | 14 +++++++++++++
nginx.conf | 2 +-
3 files changed, 35 insertions(+), 1 deletion(-)
create mode 100644 deploy/df-wiki/templates/configmap-nginx-conf.yaml
diff --git a/deploy/df-wiki/templates/configmap-nginx-conf.yaml b/deploy/df-wiki/templates/configmap-nginx-conf.yaml
new file mode 100644
index 00000000..91f9df70
--- /dev/null
+++ b/deploy/df-wiki/templates/configmap-nginx-conf.yaml
@@ -0,0 +1,20 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: nginx-config
+data:
+ default.conf: |
+ server {
+ listen 8080;
+ server_name localhost;
+ location /wiki {
+ alias /etc/nginx/html/;
+ index index.html index.htm;
+ try_files $uri $uri/ $uri/index.html /index.html =404;
+
+ }
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
+ alias /etc/nginx/html/;
+ }
+ }
\ No newline at end of file
diff --git a/deploy/df-wiki/templates/deployment.yaml b/deploy/df-wiki/templates/deployment.yaml
index d6e2fb6e..6ac7bd19 100644
--- a/deploy/df-wiki/templates/deployment.yaml
+++ b/deploy/df-wiki/templates/deployment.yaml
@@ -49,6 +49,13 @@ spec:
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
+ volumeMounts:
+ - mountPath: /tmp
+ name: tmp
+ - name: nginx-config
+ mountPath: /etc/nginx/conf.d/
+
+
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
@@ -61,3 +68,10 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
+ volumes:
+ - emptyDir: {}
+ name: tmp
+ - name: nginx-config
+ configMap:
+ name: nginx-config
+
diff --git a/nginx.conf b/nginx.conf
index a32514e3..daf15e65 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -2,7 +2,7 @@ server_tokens off;
server {
listen 8080;
server_name localhost;
- location /wiki/ {
+ location /wiki {
alias /etc/nginx/html/;
index index.html index.htm;
try_files $uri $uri/ $uri/index.html /index.html;
--
GitLab