rancher-partner-charts/charts/kasten/k10/templates/ingress.yaml

47 lines
1.6 KiB
YAML

{{- $ingressApiIsStable := eq (include "ingress.isStable" .) "true" -}}
{{- $service_port := .Values.service.externalPort -}}
{{ if .Values.ingress.create }}
{{ include "authEnabled.check" . }}
apiVersion: {{ template "ingress.apiVersion" . }}
kind: Ingress
metadata:
labels:
{{ include "helm.labels" . | indent 4 }}
namespace: {{ .Release.Namespace }}
name: {{ .Release.Name }}-ingress
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:
{{- 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 }}