rancher-partner-charts/charts/fairwinds/polaris/5.12.1/templates/ingress.yaml

54 lines
1.6 KiB
YAML

{{- if .Values.dashboard.ingress.enabled -}}
{{ $serviceName := printf "%s-dashboard" (include "polaris.fullname" .) -}}
{{- if not (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") }}
apiVersion: networking.k8s.io/v1beta1
{{- else }}
apiVersion: networking.k8s.io/v1
{{- end }}
kind: Ingress
metadata:
annotations:
{{- range $key, $value := .Values.dashboard.ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "polaris.name" . }}
helm.sh/chart: {{ include "polaris.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
name: polaris
spec:
{{- if and (.Values.dashboard.ingress.ingressClassName) (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") }}
ingressClassName: {{ .Values.dashboard.ingress.ingressClassName }}
{{- end }}
{{- if .Values.dashboard.ingress.defaultBackendEnabled }}
defaultBackend:
service:
name: {{ $serviceName }}
port:
number: 80
{{- end }}
rules:
{{- range .Values.dashboard.ingress.hosts }}
- host: {{ . }}
http:
paths:
{{- if not ($.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") }}
- backend:
serviceName: {{ $serviceName }}
servicePort: 80
{{- else }}
- backend:
service:
name: {{ $serviceName }}
port:
number: 80
path: /
pathType: Prefix
{{- end }}
{{- end -}}
{{- if .Values.dashboard.ingress.tls }}
tls:
{{ toYaml .Values.dashboard.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}