Simple ingress support (#48)

Co-authored-by: Faisal Memon <[email protected]>
This commit is contained in:
kfox1111
2023-10-30 22:16:17 +00:00
committed by GitHub
co-authored by Faisal Memon
parent b354413f62
commit ed23d8b714
20 changed files with 158 additions and 128 deletions
+34
View File
@@ -80,17 +80,50 @@
{{- $type }}
{{- end }}
{{/* Takes in a dictionary with keys:
* ingress - the standardized ingress object
* Values - Chart values
*/}}
{{ define "spire-lib.ingress-calculated-name" }}
{{- $host := .ingress.host }}
{{- if not (contains $host ".") }}
{{- $host = printf "%s.%s" $host (include "spire-lib.trust-domain" .) }}
{{- end }}
{{- $host }}
{{- end }}
{{/* Takes in a dictionary with keys:
* ingress - the standardized ingress object
* svcName - The service to route to
* port - which port on the service to use
* Values - Chart values
*/}}
{{ define "spire-lib.ingress-spec" }}
{{- $host := include "spire-lib.ingress-calculated-name" . }}
{{- $svcName := .svcName }}
{{- $port := .port }}
{{- with .ingress.className }}
ingressClassName: {{ . | quote }}
{{- end }}
{{- if eq (add (len .ingress.tls) (len .ingress.hosts)) 0 }}
tls:
- hosts:
- {{ $host | quote }}
{{- with .ingress.tlsSecret }}
secretName: {{ . | quote }}
{{- end }}
rules:
- host: {{ $host | quote }}
http:
paths:
- path: "/"
pathType: Prefix
backend:
service:
name: {{ $svcName | quote }}
port:
number: {{ $port }}
{{- else }}
{{- if .ingress.tls }}
tls:
{{- range .ingress.tls }}
@@ -117,6 +150,7 @@ rules:
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- define "spire-lib.kubectl-image" }}
{{- $root := deepCopy . }}