|
| 1 | +{{/* |
| 2 | +Parse the LINSTOR endpoint so nginx can set `proxy_ssl_name` correctly. |
| 3 | +The endpoint is expected to be an https:// URL like |
| 4 | + https://linstor-controller.cozy-linstor.svc:3371 |
| 5 | +*/}} |
| 6 | +{{- $endpoint := trimPrefix "https://" (trimPrefix "http://" .Values.linstor.endpoint) -}} |
| 7 | +{{- $endpointHost := (splitList ":" $endpoint) | first -}} |
| 8 | +apiVersion: v1 |
| 9 | +kind: ConfigMap |
| 10 | +metadata: |
| 11 | + name: linstor-gui-nginx |
| 12 | + labels: |
| 13 | + {{- include "linstor-gui.labels" . | nindent 4 }} |
| 14 | +data: |
| 15 | + nginx.conf: | |
| 16 | + worker_processes auto; |
| 17 | + pid /tmp/nginx.pid; |
| 18 | +
|
| 19 | + events { |
| 20 | + worker_connections 1024; |
| 21 | + } |
| 22 | +
|
| 23 | + http { |
| 24 | + include /etc/nginx/mime.types; |
| 25 | + default_type application/octet-stream; |
| 26 | + server_tokens off; |
| 27 | +
|
| 28 | + client_body_temp_path /tmp/client_body; |
| 29 | + proxy_temp_path /tmp/proxy; |
| 30 | + fastcgi_temp_path /tmp/fastcgi; |
| 31 | + uwsgi_temp_path /tmp/uwsgi; |
| 32 | + scgi_temp_path /tmp/scgi; |
| 33 | +
|
| 34 | + sendfile on; |
| 35 | + keepalive_timeout 65; |
| 36 | +
|
| 37 | + server { |
| 38 | + listen 3373; |
| 39 | + server_name _; |
| 40 | +
|
| 41 | + root /usr/share/nginx/html; |
| 42 | + index index.html; |
| 43 | +
|
| 44 | + # Static UI assets |
| 45 | + location / { |
| 46 | + try_files $uri $uri/ /index.html; |
| 47 | + } |
| 48 | +
|
| 49 | + # Proxy LINSTOR REST API over mTLS to the controller |
| 50 | + location /v1 { |
| 51 | + proxy_pass {{ .Values.linstor.endpoint }}; |
| 52 | + proxy_set_header Host $host; |
| 53 | + proxy_set_header X-Real-IP $remote_addr; |
| 54 | + proxy_ssl_certificate /etc/linstor/client/tls.crt; |
| 55 | + proxy_ssl_certificate_key /etc/linstor/client/tls.key; |
| 56 | + proxy_ssl_trusted_certificate /etc/linstor/client/ca.crt; |
| 57 | + proxy_ssl_verify on; |
| 58 | + proxy_ssl_verify_depth 2; |
| 59 | + proxy_ssl_server_name on; |
| 60 | + proxy_ssl_name {{ $endpointHost }}; |
| 61 | + } |
| 62 | +
|
| 63 | + location /metrics { |
| 64 | + proxy_pass {{ .Values.linstor.endpoint }}; |
| 65 | + proxy_set_header Host $host; |
| 66 | + proxy_set_header X-Real-IP $remote_addr; |
| 67 | + proxy_ssl_certificate /etc/linstor/client/tls.crt; |
| 68 | + proxy_ssl_certificate_key /etc/linstor/client/tls.key; |
| 69 | + proxy_ssl_trusted_certificate /etc/linstor/client/ca.crt; |
| 70 | + proxy_ssl_verify on; |
| 71 | + proxy_ssl_verify_depth 2; |
| 72 | + proxy_ssl_server_name on; |
| 73 | + proxy_ssl_name {{ $endpointHost }}; |
| 74 | + } |
| 75 | +
|
| 76 | + location = /healthz { |
| 77 | + access_log off; |
| 78 | + return 200 'ok'; |
| 79 | + add_header Content-Type text/plain; |
| 80 | + } |
| 81 | + } |
| 82 | + } |
0 commit comments