From 53da5829dd1befece12e7420d9c7b28800bfb3cd Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Fri, 18 Apr 2025 15:18:19 -0400 Subject: [PATCH] latest charts --- .../templates/_helpers/certificate.tpl | 29 +++++++++ .../apps/ingress/templates/clusterissuer.yaml | 63 ++++--------------- charts/apps/ingress/values.yaml | 18 +++++- 3 files changed, 59 insertions(+), 51 deletions(-) create mode 100644 charts/apps/ingress/templates/_helpers/certificate.tpl diff --git a/charts/apps/ingress/templates/_helpers/certificate.tpl b/charts/apps/ingress/templates/_helpers/certificate.tpl new file mode 100644 index 0000000..09be1e2 --- /dev/null +++ b/charts/apps/ingress/templates/_helpers/certificate.tpl @@ -0,0 +1,29 @@ +{{ define "homelab.cert" }} +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: cloudflare-wildcard{{.prefix}}.{{ .root }}.{{ .domain }} +spec: + secretName: cloudflare-wildcard{{.prefix}}.{{ .root }}.{{ .domain }} + issuerRef: + name: cloudflare + kind: Issuer + commonName: '*{{.prefix}}.{{ .root }}.{{ .domain }}' + dnsNames: + - "*{{.prefix}}.{{ .root }}.{{ .domain }}" +{{ end }} +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: cloudflare-wildcard.{{ .domain }} +spec: + secretName: cloudflare-wildcard.{{ .domain }} + issuerRef: + name: cloudflare + kind: Issuer + commonName: '*.{{ .domain }}' + dnsNames: + - "*.{{ .domain }}" +{{ end }} \ No newline at end of file diff --git a/charts/apps/ingress/templates/clusterissuer.yaml b/charts/apps/ingress/templates/clusterissuer.yaml index d384e19..2c1f3df 100644 --- a/charts/apps/ingress/templates/clusterissuer.yaml +++ b/charts/apps/ingress/templates/clusterissuer.yaml @@ -1,16 +1,16 @@ -{{ if .Values.global.tls.enabled }} +{{ if .Values.global.dns.tls.enabled }} --- apiVersion: cert-manager.io/v1 kind: ClusterIssuer metadata: - name: {{ .Values.global.tls.issuer }} + name: {{ .Values.global.dns.tls.issuer }} spec: acme: - server: {{ .Values.global.tls.acmeServer }} - skipTLSVerify: {{ .Values.global.tls.skipTLSVerify }} + server: {{ .Values.global.dns.tls.acmeServer }} + skipTLSVerify: {{ .Values.global.dns.tls.skipTLSVerify }} email: {{ .Values.global.email }} privateKeySecretRef: - name: {{ .Values.global.tls.issuer }} + name: {{ .Values.global.dns.tls.issuer }} solvers: - http01: ingress: @@ -24,8 +24,8 @@ metadata: name: cloudflare spec: acme: - server: {{ .Values.global.tls.acmeServer }} - skipTLSVerify: {{ .Values.global.tls.skipTLSVerify }} + server: {{ .Values.global.dns.tls.acmeServer }} + skipTLSVerify: {{ .Values.global.dns.tls.skipTLSVerify }} email: {{ .Values.global.email }} privateKeySecretRef: name: cloudflare @@ -36,59 +36,22 @@ spec: name: {{ .Values.cloudflare.tokenSecretName }} key: {{ .Values.cloudflare.tokenSecretKey }} {{ range $prefix := .Values.cloudflare.certificateRootDomains }} ---- -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: cloudflare-wildcard{{$prefix}}.{{ $.Values.global.rootSubDomain }}.{{ $.Values.global.domain }} -spec: - secretName: cloudflare-wildcard{{$prefix}}.{{ $.Values.global.rootSubDomain }}.{{ $.Values.global.domain }} - issuerRef: - name: cloudflare - kind: Issuer - commonName: '*{{$prefix}}.{{ $.Values.global.rootSubDomain }}.{{ $.Values.global.domain }}' - dnsNames: - - "*{{$prefix}}.{{ $.Values.global.rootSubDomain }}.{{ $.Values.global.domain }}" +{{include "homelab.cert" (merge .Values.dns.primary (dict "prefix" $prefix))}} +{{include "homelab.cert" (merge .Values.dns.secondary (dict "prefix" $prefix))}} {{ end }} --- apiVersion: cert-manager.io/v1 kind: Certificate metadata: - name: cloudflare-wildcard.{{ $.Values.global.domain }} + name: cloudflare.{{ $.Values.global.dns.primary.domain }} spec: - secretName: cloudflare-wildcard.{{ $.Values.global.domain }} + secretName: cloudflare.{{ $.Values.global.dns.primary.domain }} issuerRef: name: cloudflare kind: Issuer - commonName: '*.{{ $.Values.global.domain }}' + commonName: '{{ $.Values.global.dns.primary.domain }}' dnsNames: - - "*.{{ $.Values.global.domain }}" ---- -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: cloudflare-wildcard.{{ $.Values.global.secondaryDomain }} -spec: - secretName: cloudflare-wildcard.{{ $.Values.global.secondaryDomain }} - issuerRef: - name: cloudflare - kind: Issuer - commonName: '*.{{ $.Values.global.secondaryDomain }}' - dnsNames: - - "*.{{ $.Values.global.secondaryDomain }}" ---- -apiVersion: cert-manager.io/v1 -kind: Certificate -metadata: - name: cloudflare.{{ $.Values.global.domain }} -spec: - secretName: cloudflare.{{ $.Values.global.domain }} - issuerRef: - name: cloudflare - kind: Issuer - commonName: '{{ $.Values.global.domain }}' - dnsNames: - - "{{ $.Values.global.domain }}" + - "{{ $.Values.global.dns.primary.domain }}" --- apiVersion: cert-manager.io/v1 kind: Certificate diff --git a/charts/apps/ingress/values.yaml b/charts/apps/ingress/values.yaml index 4621400..7150301 100644 --- a/charts/apps/ingress/values.yaml +++ b/charts/apps/ingress/values.yaml @@ -6,4 +6,20 @@ cloudflare: - "" - ".core" - ".vh" - - ".wa" \ No newline at end of file + - ".wa" + + +global: + dns: + primary: + domain: "internal" + root: "k3s" + secondary: + domain: "local" + root: "k3s" + tls: + enabled: false + issuer: "" + acmeServer: "https://acme-staging-v02.api.letsencrypt.org/directory" + skipTLSVerify: false + useWildCard: true \ No newline at end of file