74 lines
2.6 KiB
YAML
74 lines
2.6 KiB
YAML
{{- $ingressApiIsStable := eq (include "ingress.isStable" .) "true" -}}
|
|
{{- $service_port := .Values.gateway.service.externalPort -}}
|
|
{{ if .Values.ingress.create }}
|
|
{{ include "authEnabled.check" . }}
|
|
{{ include "check.ingress.defaultBackend" . }}
|
|
apiVersion: {{ template "ingress.apiVersion" . }}
|
|
kind: Ingress
|
|
metadata:
|
|
labels:
|
|
{{ include "helm.labels" . | indent 4 }}
|
|
namespace: {{ .Release.Namespace }}
|
|
name: {{ .Values.ingress.name | default (printf "%s-ingress" .Release.Name) }}
|
|
annotations:
|
|
{{ include "ingressClassAnnotation" . | indent 4 }}
|
|
{{- if and .Values.secrets.apiTlsCrt .Values.secrets.apiTlsKey }}
|
|
nginx.ingress.kubernetes.io/secure-backends: "true"
|
|
nginx.ingress.kubernetes.io/backend-protocol: HTTPS
|
|
{{- end }}
|
|
{{- if .Values.ingress.annotations }}
|
|
{{ toYaml .Values.ingress.annotations | indent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
{{ include "specIngressClassName" . | indent 2 }}
|
|
{{ with .Values.ingress.defaultBackend }}
|
|
{{- if or .service.enabled .resource.enabled }}
|
|
defaultBackend:
|
|
{{- with .service }}
|
|
{{- if .enabled }}
|
|
service:
|
|
name: {{ required "`name` is required in the `ingress.defaultBackend.service`." .name }}
|
|
port:
|
|
{{- if .port.name }}
|
|
name: {{ .port.name }}
|
|
{{- else if .port.number }}
|
|
number: {{ .port.number }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .resource }}
|
|
{{- if .enabled }}
|
|
resource:
|
|
apiGroup: {{ .apiGroup }}
|
|
name: {{ required "`name` is required in the `ingress.defaultBackend.resource`." .name }}
|
|
kind: {{ required "`kind` is required in the `ingress.defaultBackend.resource`." .kind }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.ingress.tls.enabled }}
|
|
tls:
|
|
- hosts:
|
|
- {{ required "ingress.host value is required for TLS configuration" .Values.ingress.host }}
|
|
secretName: {{ required "ingress.tls.secretName is required for TLS configuration" .Values.ingress.tls.secretName }}
|
|
{{- end }}
|
|
rules:
|
|
- http:
|
|
paths:
|
|
- path: /{{ default .Release.Name .Values.ingress.urlPath | trimPrefix "/" | trimSuffix "/" }}/
|
|
pathType: {{ default "ImplementationSpecific" .Values.ingress.pathType }}
|
|
backend:
|
|
{{- if $ingressApiIsStable }}
|
|
service:
|
|
name: gateway
|
|
port:
|
|
number: {{ $service_port }}
|
|
{{- else }}
|
|
serviceName: gateway
|
|
servicePort: {{ $service_port }}
|
|
{{- end }}
|
|
{{- if .Values.ingress.host }}
|
|
host: {{ .Values.ingress.host }}
|
|
{{- end }}
|
|
{{ end }}
|