Files
truecharts/library/common/templates/custom/classes/_appIngressHTTP.tpl
T
Kjeld Schouten-Lebbing 1d51be0e3d 777 on new scripts (+2 squashed commit)
Squashed commit:

[9ae7dd0f] add helm-docs to workflow

[2206f5ba] fix small typo in workflows (+1 squashed commits)

Squashed commits:

[29c2ceb4] Documentation-Cleanup (#181)

* work on readme generation

* document windows setup

* add simple pre-commit install script

* more docs for git setup

* Update pre-commit

* pre-commit automatic fixes

* Increase all patch versions

* Auto Readme and Config doc

* Auto app-readme.md generation

* increase common and common-test versions accordingly (due to cleanup)

* move contribution guidelines to /development in wiki

* fix some end-of-line issues (again)

* fix line 14 of workflows
2021-02-23 18:21:54 +01:00

82 lines
2.8 KiB
Smarty

{{/*
This template serves as a blueprint for all appIngress objects that are created
within the common library.
*/}}
{{- define "common.custom.classes.appIngressHTTP" -}}
{{- $values := .Values.appIngress -}}
{{- if hasKey . "ObjectValues" -}}
{{- with .ObjectValues.appIngress -}}
{{- $values = . -}}
{{- end -}}
{{ end -}}
{{- $IngressName := include "common.names.fullname" . -}}
{{- if hasKey $values "nameSuffix" -}}
{{- $IngressName = printf "%v-%v" $IngressName $values.nameSuffix -}}
{{ end -}}
{{- $svcName := $values.serviceName | default (include "common.names.fullname" .) -}}
{{- $svcPort := $values.servicePort | default $.Values.service.port.port -}}
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
kind: Ingress
metadata:
name: {{ $IngressName }}
labels:
{{- include "common.labels" . | nindent 4 }}
annotations:
{{- if or (eq $values.certType "letsencrypt-prod") (eq $values.certType "letsencrypt-staging") }}
cert-manager.io/cluster-issuer: {{ $values.certType }}
{{- end }}
traefik.ingress.kubernetes.io/router.entrypoints: {{ $values.entrypoint }}
traefik.ingress.kubernetes.io/router.middlewares: traefik-middlewares-chain-public@kubernetescrd
{{- if $values.authForwardURL }}
traefik.ingress.kubernetes.io/router.middlewares: {{ $IngressName }}
{{- end }}
{{- with $values.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if eq (include "common.capabilities.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if $values.IngressClassName }}
IngressClassName: {{ $values.appIngressHTTPClassName }}
{{- end }}
{{- end }}
{{- if $values.certType }}
tls:
{{- if eq $values.certType "selfsigned" -}}{}{{ else }}
- hosts:
{{- range $values.hosts }}
- {{ .host | quote }}
{{- end }}
{{- if eq $values.certType "selfsigned" -}}
{{ else if eq $values.certType "existingcert" }}
secretName: {{ $values.existingcert }}
{{ else if eq $values.certType "wildcard" }}
secretName: wildcardcert
{{ else }}
secretName: {{ $IngressName }}-tls-secret
{{ end }}
{{ end }}
{{- end }}
rules:
{{- range $values.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if eq (include "common.capabilities.ingress.apiVersion" $) "networking.k8s.io/v1" }}
pathType: Prefix
{{- end }}
backend:
{{- if eq (include "common.capabilities.ingress.apiVersion" $) "networking.k8s.io/v1" }}
service:
name: {{ $svcName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $svcName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}