charts/dial-core/templates/ingress.yaml (63 lines of code) (raw):

{{- if .Values.ingress.enabled }} {{- $ingressPath := .Values.ingress.path -}} {{- $pathType := .Values.ingress.pathType -}} {{- $serviceName := .Values.ingress.serviceName | default ( include "dialCore.names.fullname" . ) -}} {{- $servicePort := .Values.ingress.servicePort | default .Values.service.ports.http -}} {{- $extraPaths := .Values.ingress.extraPaths -}} kind: Ingress apiVersion: networking.k8s.io/v1 metadata: name: {{ template "dialCore.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{ include "dialCore.labels.standard" . | nindent 4 }} {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} {{- if .Values.labels }} {{- include "common.tplvalues.render" ( dict "value" .Values.labels "context" $ ) | nindent 4 }} {{- end }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.ingress.annotations "context" $ ) | nindent 4 }} spec: {{- if .Values.ingress.ingressClassName }} ingressClassName: {{ .Values.ingress.ingressClassName }} {{- end }} {{- if .Values.ingress.tls }} tls: {{- include "common.tplvalues.render" (dict "value" .Values.ingress.tls "context" $) | nindent 4 }} {{- end }} rules: {{- range .Values.ingress.hosts }} - host: {{ tpl . $ }} http: paths: {{- if $extraPaths }} {{- toYaml $extraPaths | nindent 10 }} {{- end }} - path: {{ $ingressPath }} pathType: {{ $pathType }} backend: service: name: {{ $serviceName }} port: {{- if typeIs "string" $servicePort }} name: {{ $servicePort }} {{- else if or (typeIs "int" $servicePort) (typeIs "float64" $servicePort) }} number: {{ $servicePort | int }} {{- end }} {{- end }} {{- range .Values.ingress.extraRules }} - host: {{ .name | quote }} http: paths: - path: {{ default "/" .path }} pathType: {{ default "Prefix" .pathType }} backend: service: name: {{ .serviceName }} port: {{- if typeIs "string" .servicePort }} name: {{ .servicePort }} {{- else if or (typeIs "int" .servicePort) (typeIs "float64" .servicePort) }} number: {{ .servicePort | int }} {{- end }} {{- end }} {{- end }}