{{- if and (.Values.ingress.enabled) (not .Values.appMesh.enabled) -}} {{- $fullName := include "application.fullname" . -}} {{- $servicePort := .Values.service.port -}} {{- $ingressPath := .Values.ingress.path -}} {{- $defaultIngressPath := printf "/%s/*" $fullName -}} {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1beta1 {{- else -}} apiVersion: extensions/v1beta1 {{- end }} kind: Ingress metadata: name: {{ $fullName }} labels: app: {{ template "application.name" . }} chart: {{ template "application.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} {{- with .Values.ingress.annotations }} annotations: {{ toYaml . | indent 4 }} {{- end }} spec: {{- if .Values.ingress.tls }} tls: {{- range .Values.ingress.tls }} - hosts: {{- range .hosts }} - {{ . }} {{- end }} secretName: {{ .secretName }} {{- end }} {{- end }} rules: {{- if .Values.ingress.cnameHost }} - host: {{ printf "%s.%s" $fullName .Values.ingress.cnameHost }} http: paths: - path: {{ $ingressPath }} backend: serviceName: {{ $fullName }} servicePort: {{ .Values.service.port | default 80 }} {{- else if .Values.ingress.hosts }} {{- range .Values.ingress.hosts }} - host: {{ . }} http: paths: - path: {{ $ingressPath | default $defaultIngressPath }} backend: serviceName: {{ $fullName }} servicePort: {{ .Values.service.port | default 80 }} {{- end }} {{- else }} - http: paths: - path: {{ $ingressPath | default $defaultIngressPath }} backend: serviceName: {{ $fullName }} servicePort: {{ .Values.service.port | default 80 }} {{- end }} {{- end }}