v1.0.0 release: Initial release
This commit is contained in:
commit
9ec5e3d112
11 changed files with 1184 additions and 0 deletions
6
helm-chart/Chart.yaml
Normal file
6
helm-chart/Chart.yaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
apiVersion: v2
|
||||
name: k8s-pages
|
||||
description: A Helm chart for an NGINX reverse proxy with configurable sites hosted from minio object storage
|
||||
type: application
|
||||
version: 1.0.0
|
||||
appVersion: "1.0"
|
||||
49
helm-chart/templates/_helpers.tpl
Normal file
49
helm-chart/templates/_helpers.tpl
Normal 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 }}
|
||||
8
helm-chart/templates/configmap.yaml
Normal file
8
helm-chart/templates/configmap.yaml
Normal 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 }}
|
||||
31
helm-chart/templates/deployment.yaml
Normal file
31
helm-chart/templates/deployment.yaml
Normal 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
|
||||
21
helm-chart/templates/ingress.yaml
Normal file
21
helm-chart/templates/ingress.yaml
Normal 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 }}
|
||||
4
helm-chart/templates/namespace.yaml
Normal file
4
helm-chart/templates/namespace.yaml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: {{ .Values.namespace }}
|
||||
12
helm-chart/templates/service.yaml
Normal file
12
helm-chart/templates/service.yaml
Normal 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
|
||||
17
helm-chart/values.yaml
Normal file
17
helm-chart/values.yaml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# The namespace where all resources will be created.
|
||||
namespace: k8s-pages
|
||||
# Number of replicas for the deployment.
|
||||
replicaCount: 1
|
||||
# List of sites to configure.
|
||||
bucket: "k8s-pages"
|
||||
sites:
|
||||
- name: pages
|
||||
host: example.com
|
||||
# URL to which the proxy_pass should direct traffic. (Include protocol and path)
|
||||
minioURL: "minio.minio.svc.cluster.local:9000"
|
||||
# The host header to set when proxying.
|
||||
minioHost: "minio.example.com"
|
||||
# Error Page
|
||||
errorPage: "/404.html"
|
||||
maxAge: 31536000
|
||||
staleWhileRevalidate: 86400
|
||||
Loading…
Add table
Add a link
Reference in a new issue