support for other domains

This commit is contained in:
Ariel Sosnovsky committed 2024-03-08 14:35:40 -05:00
1 parent c57b8f6c3f
commit 7520133539
6 files changed
+36 -35

No files matched your search

@@ -11,6 +11,17 @@
# useWildCard: bool = False
# middleware: str = "https-redirect"
#
{{ if .useSecondaryDomain }}
{{ $domin := {{ .global.secondaryDomain }} }}
{{ else }}
{{ $domin := {{ .global.domain }} }}
{{ end }}
{{ if .useDirectPrefix }}
{{ $domin := printf "%s.%s" .prefix $domain }}
{{ else }}
{{ $domin := printf "%s.%s.%s" .prefix .rootSubDomain $domain }}
{{ end }}
{{ if .global.tls.enabled }}
{{ if (.useWildCard | default .global.tls.useWildCard) }}
@@ -18,7 +29,7 @@
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: "tls-{{.prefix}}.{{.global.domain}}"
name: "tls-{{ $domin }}"
namespace: {{ .namespace }}
spec:
refreshInterval: 1h
@@ -26,45 +37,33 @@ spec:
kind: ClusterSecretStore
name: apps-ingresses
target:
name: tls-{{.prefix}}.{{.global.domain}}
name: tls-{{ $domin }}
creationPolicy: Owner
deletionPolicy: Delete
data:
- secretKey: tls.crt
remoteRef:
{{ if hasSuffix ".core" .prefix }}
key: cloudflare-wildcard.core.{{ .global.domain }}
{{ else if hasSuffix ".vh" .prefix }}
key: cloudflare-wildcard.vh.{{ .global.domain }}
{{ else }}
key: cloudflare-wildcard.{{ .global.domain }}
{{ end }}
key: cloudflare-wildcard.{{ $domin }}
property: tls.crt
- secretKey: tls.key
remoteRef:
{{ if hasSuffix ".core" .prefix }}
key: cloudflare-wildcard.core.{{ .global.domain }}
{{ else if hasSuffix ".vh" .prefix }}
key: cloudflare-wildcard.vh.{{ .global.domain }}
{{ else }}
key: cloudflare-wildcard.{{ .global.domain }}
{{ end }}
key: cloudflare-wildcard.{{ $domin }}
property: tls.key
{{ else }}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: "tls-{{.prefix}}.{{.global.domain}}"
name: "tls-{{ $domin }}"
namespace: {{ .namespace }}
spec:
secretName: "tls-{{.prefix}}.{{.global.domain}}"
secretName: "tls-{{ $domin }}"
issuerRef:
kind: ClusterIssuer
name: "{{ .global.tls.issuer }}"
commonName: "{{.prefix}}.{{.global.domain}}"
commonName: "{{ $domin }}"
dnsNames:
- "{{.prefix}}.{{.global.domain}}"
- "{{ $domin }}"
{{ end }}
{{ end }}
@@ -72,7 +71,7 @@ spec:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: "{{.prefix}}.{{.global.domain}}"
name: "{{ $domin }}"
namespace: {{ .namespace }}
annotations:
homelab-ingress/managing-app-namespace: "apps-ingresses"
@@ -93,7 +92,7 @@ metadata:
{{ end }}
spec:
rules:
- host: "{{.prefix}}.{{.global.domain}}"
- host: "{{ $domin }}"
http:
paths:
- backend:
@@ -105,10 +104,13 @@ spec:
pathType: Prefix
{{ if .global.tls.enabled }}
tls:
- secretName: "tls-{{.prefix}}.{{.global.domain}}"
- secretName: "tls-{{ $domin }}"
hosts:
- "{{.prefix}}.{{.global.domain}}"
- "{{ $domin }}"
{{ end }}
{{ else }}
{{ end }}
{{- end -}}
@@ -40,15 +40,15 @@ spec:
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: cloudflare-wildcard{{$prefix}}.{{ $.Values.global.domain }}
name: cloudflare-wildcard{{$prefix}}.{{ $.Values.global.rootSubDomain }}.{{ $.Values.global.domain }}
spec:
secretName: cloudflare-wildcard{{$prefix}}.{{ $.Values.global.domain }}
secretName: cloudflare-wildcard{{$prefix}}.{{ $.Values.global.rootSubDomain }}.{{ $.Values.global.domain }}
issuerRef:
name: cloudflare
kind: Issuer
commonName: '*{{$prefix}}.{{ $.Values.global.domain }}'
commonName: '*{{$prefix}}.{{ $.Values.global.rootSubDomain }}.{{ $.Values.global.domain }}'
dnsNames:
- "*{{$prefix}}.{{ $.Values.global.domain }}"
- "*{{$prefix}}.{{ $.Values.global.rootSubDomain }}.{{ $.Values.global.domain }}"
{{ end }}
{{ end }}
{{ end }}
+2
View File
@@ -1,5 +1,7 @@
global:
domain: "me.local"
secondaryDomain: "me.internal"
rootSubDomain: "home"
tls:
enabled: false
reverseProxy: {}
+1 -6
View File
@@ -91,11 +91,6 @@ services:
namespace: "apps-videohosting"
middleware: "apps-ingresses-chain-authentik"
group: "Video Hosting"
# - prefix: "immich"
# service: "immich-server"
# namespace: "apps-photos"
# middleware: "apps-ingresses-chain-authentik"
# group: "Apps"
# webapp services
{{- $webapps := .Files.Get (printf "apps-values/%s" .Values.apps.webapps.valuesFile) }}
{{- $webapps := tpl $webapps . | fromYaml }}
@@ -110,6 +105,6 @@ services:
{{ else }}
middleware: "apps-ingresses-chain-authentik"
{{ end -}}
group: "Basic Webapps"
group: {{ .ingress.group | default "Basic Webapps" }}
{{ end }}
{{- end }}
+1 -1
View File
@@ -1,6 +1,6 @@
global:
deployment: prod
domain: "home.sosnovsky.ca"
domain: "sosnovsky.ca"
secondaryDomain: "skyg.ca"
tls:
useWildCard: true
+2
View File
@@ -6,6 +6,8 @@ global:
email: "ariel@sosnovsky.ca"
timezone: America/Toronto
domain: "changeme"
rootSubDomain: "home"
secondaryDomain: "changeme"
tls:
enabled: false
issuer: ""