From 315c09ccbd82afef8aa245a57529d9f009162125 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 10 Aug 2023 12:17:25 +0200 Subject: [PATCH] Add taiga-gateway --- .../taiga/taiga-gateway-configmap.yaml | 81 +++++++++++++++++++ .../taiga/taiga-gateway-deployment.yaml | 43 ++++++++++ 2 files changed, 124 insertions(+) create mode 100644 src/main/resources/taiga/taiga-gateway-configmap.yaml create mode 100644 src/main/resources/taiga/taiga-gateway-deployment.yaml diff --git a/src/main/resources/taiga/taiga-gateway-configmap.yaml b/src/main/resources/taiga/taiga-gateway-configmap.yaml new file mode 100644 index 0000000..7ae184d --- /dev/null +++ b/src/main/resources/taiga/taiga-gateway-configmap.yaml @@ -0,0 +1,81 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: taiga-gateway-configmap +data: + default.conf: | + server { + listen 80 default_server; + + client_max_body_size 100M; + charset utf-8; + + # Frontend + location / { + proxy_pass http://taiga-front/; + proxy_pass_header Server; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Scheme $scheme; + } + + # Api + location /api { + proxy_pass http://taiga-back:8000/api; + proxy_pass_header Server; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Scheme $scheme; + } + + # Admin + location /admin { + proxy_pass http://taiga-back:8000/admin; + proxy_pass_header Server; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Scheme $scheme; + } + + # Static + location /static { + root /taiga; + } + + # Media + location /_protected { + internal; + alias /taiga/media/; + add_header Content-disposition "attachment"; + } + + # Unprotected section + location /media/exports { + alias /taiga/media/exports/; + add_header Content-disposition "attachment"; + } + + location /media { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Scheme $scheme; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://taiga-protected:8003/; + proxy_redirect off; + } + + # Events + location /events { + proxy_pass http://taiga-events:8888/events; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_connect_timeout 7d; + proxy_send_timeout 7d; + proxy_read_timeout 7d; + } + } \ No newline at end of file diff --git a/src/main/resources/taiga/taiga-gateway-deployment.yaml b/src/main/resources/taiga/taiga-gateway-deployment.yaml new file mode 100644 index 0000000..72a4e41 --- /dev/null +++ b/src/main/resources/taiga/taiga-gateway-deployment.yaml @@ -0,0 +1,43 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: taiga-gateway-deployment + labels: + app.kubernetes.part-of: c4k-taiga +spec: + replicas: 1 + selector: + matchLabels: + app: taiga + template: + metadata: + labels: + app: taiga + spec: + restartPolicy: Always + containers: + - name: taiga-gateway + image: nginx:1.19-alpine + imagePullPolicy: IfNotPresent + ports: + - containerPort: 80 # ToDo: Check container ports everywhere + volumeMounts: + - mountPath: /etc/nginx/conf.d + name: taiga-configmap-volume + - name: taiga-static + mountPath: /taiga/static + readOnly: false + - name: taiga-media + mountPath: /taiga/media + readOnly: false + + volumes: # ToDo: Are the volumes implemented correctly? + - name: taiga-configmap-volume + configMap: + name: taiga-gateway-configmap # ToDo: implement gateway configmap + - name: taiga-static + persistentVolumeClaim: + claimName: taiga-static + - name: taiga-media + persistentVolumeClaim: + claimName: taiga-media