128 lines
3.1 KiB
YAML
128 lines
3.1 KiB
YAML
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: "sec-domain-static-files"
|
|
data:
|
|
{{ range $staticFile := .Values.staticFiles.secondaryDomain }}
|
|
{{$staticFile.path}}: |
|
|
{{ $staticFile.content | nindent 6 }}
|
|
{{ end }}
|
|
|
|
---
|
|
kind: Deployment
|
|
apiVersion: apps/v1
|
|
metadata:
|
|
name: "sec-domain-host"
|
|
labels:
|
|
app: "static-files"
|
|
domain: "{{$.Values.global.secondaryDomain}}"
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: "static-files"
|
|
domain: "{{$.Values.global.secondaryDomain}}"
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
{{ range $staticFile := .Values.staticFiles.secondaryDomain }}
|
|
"checksum/{{$staticFile.path}}": "{{ $staticFile.content | sha256sum }}"
|
|
{{ end }}
|
|
labels:
|
|
app: "static-files"
|
|
domain: "{{$.Values.global.secondaryDomain}}"
|
|
spec:
|
|
volumes:
|
|
- name: static-files
|
|
configMap:
|
|
name: "sec-domain-static-files"
|
|
containers:
|
|
- name: api
|
|
image: caddy:2.7-alpine
|
|
command:
|
|
- caddy
|
|
- file-server
|
|
- --root
|
|
- /files
|
|
- --listen
|
|
- '0.0.0.0:80'
|
|
volumeMounts:
|
|
- mountPath: /files
|
|
name: static-files
|
|
resources:
|
|
limits:
|
|
memory: 1Gi
|
|
ports:
|
|
- containerPort: 80
|
|
---
|
|
kind: Service
|
|
apiVersion: v1
|
|
metadata:
|
|
name: "sec-domain-static-files"
|
|
labels:
|
|
app: "static-files"
|
|
domain: "{{$.Values.global.secondaryDomain}}"
|
|
spec:
|
|
selector:
|
|
app: "static-files"
|
|
domain: "{{$.Values.global.secondaryDomain}}"
|
|
type: ClusterIP
|
|
ports:
|
|
- name: http
|
|
port: 80
|
|
targetPort: 80
|
|
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: Ingress
|
|
metadata:
|
|
name: "sec-domain-static-files"
|
|
annotations:
|
|
homelab-ingress/managing-app-namespace: "apps-ingresses"
|
|
spec:
|
|
rules:
|
|
- host: "{{ $.Values.global.secondaryDomain }}"
|
|
http:
|
|
paths:
|
|
- path: "/"
|
|
pathType: Exact
|
|
backend:
|
|
service:
|
|
name: "sec-domain-static-files"
|
|
port:
|
|
number: 80
|
|
{{ range $staticFile := .Values.staticFiles.secondaryDomain }}
|
|
- backend:
|
|
service:
|
|
name: "sec-domain-static-files"
|
|
port:
|
|
number: 80
|
|
path: "/{{$staticFile.path}}"
|
|
pathType: Exact
|
|
{{ end }}
|
|
{{ if $.Values.global.tls.enabled }}
|
|
tls:
|
|
- secretName: "tls-{{ $.Values.global.secondaryDomain }}"
|
|
hosts:
|
|
- "{{ $.Values.global.secondaryDomain }}"
|
|
{{ end }}
|
|
|
|
|
|
{{ if $.Values.global.tls.enabled }}
|
|
---
|
|
apiVersion: cert-manager.io/v1
|
|
kind: Certificate
|
|
metadata:
|
|
name: "tls-{{ $.Values.global.secondaryDomain }}"
|
|
spec:
|
|
secretName: "tls-{{ $.Values.global.secondaryDomain }}"
|
|
issuerRef:
|
|
kind: ClusterIssuer
|
|
name: "{{ $.Values.global.tls.issuer }}"
|
|
commonName: "{{ $.Values.global.secondaryDomain }}"
|
|
dnsNames:
|
|
- "{{ $.Values.global.secondaryDomain }}"
|
|
{{ end }}
|