{{- $app := .Values }} {{- $ctx := dict "helm" . }} {{- $ingresses := dict "" $app.ingress "internal" $app.ingressInternal }} {{- range $suffix, $ingress := $ingresses }} {{- if $ingress.enabled }} {{- $_ := set $ctx "extraLabels" $ingress.extraLabels }} {{- $fullname := include "vm.plain.fullname" $ctx }} --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: {{- with $ingress.annotations }} annotations: {{ toYaml . | nindent 4 }} {{- end }} {{- $_ := set $ctx "extraLabels" $app.ingress.extraLabels }} labels: {{ include "vm.labels" $ctx | nindent 4 }} {{- $_ := unset $ctx "extraLabels" }} name: {{ $fullname }}{{ ternary "" (printf "-%s" $suffix) (empty $suffix) }} namespace: {{ include "vm.namespace" $ctx }} spec: {{- with $ingress.ingressClassName }} ingressClassName: {{ . }} {{- end }} {{- with $ingress.tls }} tls: {{ tpl (toYaml .) $ | nindent 4 }} {{- end }} rules: {{- range $host := $ingress.hosts }} {{- $paths := ternary (list $host.path) $host.path (kindIs "string" $host.path) }} - host: {{ tpl $host.name $ | quote }} http: paths: {{- range $path := $paths }} - path: {{ $path }} {{- with $ingress.pathType }} pathType: {{ . }} {{- end }} backend: service: name: {{ $fullname }} port: {{ include "vm.ingress.port" $host | nindent 18 }} {{- end }} {{- end }} {{- end }} {{- end }}