deploy-templates/templates/ingress.yaml (47 lines of code) (raw):
{{ if eq .Values.global.platform "kubernetes" }}
{{- if .Values.ingress.enabled }}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ include "headlamp.name" . }}
labels:
{{- include "headlamp.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- if .hosts }}
{{- toYaml .hosts | nindent 8 }}
{{- else }}
- {{ include "portal.url" $ }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- if .Values.ingress.host }}
- host: {{ .Values.ingress.host }}
{{- else}}
- host: {{ include "portal.url" . }}
{{- end}}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "headlamp.name" . }}
port:
number: {{ $svcPort }}
{{- end }}
{{- end }}