v1 release: Initial release

This commit is contained in:
Waylon S. Walker 2025-02-04 15:19:12 -06:00
commit b3d904805c
11 changed files with 1184 additions and 0 deletions

View file

@ -0,0 +1,49 @@
{{/*
Generate the content for the NGINX configuration.
*/}}
{{- define "nginx.configmap.content" -}}
{{- range .Values.sites }}
server {
listen 80;
server_name {{ .name }}.{{ .host }};
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
proxy_buffering off;
proxy_intercept_errors on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_hide_header x-amz-request-id;
proxy_hide_header x-minio-deployment-id;
location / {
# These rewrites are kept as in your original config.
rewrite ^/$ /{{ $.Values.bucket }}/{{ .name }}/index.html break;
rewrite ^(.*)/$ /$1/index.html break;
# Use the parameterized backend URL.
proxy_pass {{ .minioURL }}/{{ $.Values.bucket }}/{{ .name }}/;
proxy_set_header Host {{ .minioHost }};
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_ssl_server_name on;
proxy_ssl_verify off;
error_page 404 {{ .errorPage }};
add_header Cache-Control "public, max-age={{ $.Values.maxAge }}, stale-while-revalidate={{ $.Values.staleWhileRevalidate }}" always;
}
}
{{- end }}
{{- end }}

View file

@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-reverse-proxy-config
namespace: {{ .Values.namespace }}
data:
default.conf: |-
{{ include "nginx.configmap.content" . | nindent 4 }}

View file

@ -0,0 +1,31 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-reverse-proxy
namespace: {{ .Values.namespace }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: nginx-reverse-proxy
template:
metadata:
labels:
app: nginx-reverse-proxy
annotations:
# Compute a checksum of the rendered ConfigMap template.
# This forces a pod restart when the config changes.
checksum/nginx-config: {{ include "nginx.configmap.content" . | sha256sum }}
spec:
containers:
- name: nginx
image: nginx:stable
ports:
- containerPort: 80
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/conf.d
volumes:
- name: nginx-config
configMap:
name: nginx-reverse-proxy-config

View file

@ -0,0 +1,21 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-reverse-proxy-ingress
namespace: {{ .Values.namespace }}
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
rules:
{{- range .Values.sites }}
- host: {{ .name }}.{{ .host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: nginx-reverse-proxy
port:
number: 80
{{- end }}

View file

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: {{ .Values.namespace }}

View file

@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: nginx-reverse-proxy
namespace: {{ .Values.namespace }}
spec:
selector:
app: nginx-reverse-proxy
ports:
- port: 80
targetPort: 80
protocol: TCP