{{- $ingress := .Values.ingress -}} {{- if $ingress.enabled -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: {{ .Release.Name }} {{- with $ingress.annotations }} annotations: {{- range $key, $value := . }} {{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }} {{- end }} {{- end }} labels: {{- range $key, $value := $ingress.labels }} {{- printf "%s: %s" $key (tpl $value $ | quote) | nindent 4 }} {{- end }} spec: {{- if $ingress.ingressClassName }} ingressClassName: {{ $ingress.ingressClassName }} {{- end }} {{- if $ingress.tls }} tls: {{- range $ingress.tls }} - hosts: {{- range .hosts }} - {{ tpl . $ | quote }} {{- end }} {{- with .secretName }} secretName: {{ tpl . $ }} {{- end }} {{- end }} {{- end }} rules: {{- range $ingress.rules }} - host: {{ tpl .host $ | quote }} http: paths: {{- range .paths }} - path: {{ tpl .path $ | quote }} pathType: {{ .pathType }} backend: service: name: "{{ .Release.Name }}-{{ .Values.service.name }}" port: name: {{ .Values.service.name }} {{- end }} {{- end }} {{- end -}} {{- end -}}