| {{- if .Values.ingress.enabled -}} |
| {{- $ingressApiIsStable := eq (include "dubbo-admin.ingress.isStable" .) "true" -}} |
| {{- $ingressSupportsIngressClassName := eq (include "dubbo-admin.ingress.supportsIngressClassName" .) "true" -}} |
| {{- $ingressSupportsPathType := eq (include "dubbo-admin.ingress.supportsPathType" .) "true" -}} |
| {{- $fullName := include "dubbo-admin.fullname" . -}} |
| {{- $servicePort := .Values.service.port -}} |
| {{- $ingressPath := .Values.ingress.path -}} |
| {{- $ingressPathType := .Values.ingress.pathType -}} |
| {{- $extraPaths := .Values.ingress.extraPaths -}} |
| apiVersion: {{ include "dubbo-admin.ingress.apiVersion" . }} |
| kind: Ingress |
| metadata: |
| name: {{ $fullName }} |
| namespace: {{ include "dubbo-admin.namespace" . }} |
| labels: |
| {{- include "dubbo-admin.labels" . | nindent 4 }} |
| {{- with .Values.ingress.labels }} |
| {{- toYaml . | nindent 4 }} |
| {{- end }} |
| {{- with .Values.ingress.annotations }} |
| annotations: |
| {{- range $key, $value := . }} |
| {{ $key }}: {{ tpl $value $ | quote }} |
| {{- end }} |
| {{- end }} |
| spec: |
| {{- if and $ingressSupportsIngressClassName .Values.ingress.ingressClassName }} |
| ingressClassName: {{ .Values.ingress.ingressClassName }} |
| {{- end -}} |
| {{- with .Values.ingress.tls }} |
| tls: |
| {{- tpl (toYaml .) $ | nindent 4 }} |
| {{- end }} |
| rules: |
| {{- if .Values.ingress.hosts }} |
| {{- range .Values.ingress.hosts }} |
| - host: {{ tpl . $ }} |
| http: |
| paths: |
| {{- with $extraPaths }} |
| {{- toYaml . | nindent 10 }} |
| {{- end }} |
| - path: {{ $ingressPath }} |
| {{- if $ingressSupportsPathType }} |
| pathType: {{ $ingressPathType }} |
| {{- end }} |
| backend: |
| {{- if $ingressApiIsStable }} |
| service: |
| name: {{ $fullName }} |
| port: |
| number: {{ $servicePort }} |
| {{- else }} |
| serviceName: {{ $fullName }} |
| servicePort: {{ $servicePort }} |
| {{- end }} |
| {{- end }} |
| {{- else }} |
| - http: |
| paths: |
| - backend: |
| {{- if $ingressApiIsStable }} |
| service: |
| name: {{ $fullName }} |
| port: |
| number: {{ $servicePort }} |
| {{- else }} |
| serviceName: {{ $fullName }} |
| servicePort: {{ $servicePort }} |
| {{- end }} |
| {{- with $ingressPath }} |
| path: {{ . }} |
| {{- end }} |
| {{- if $ingressSupportsPathType }} |
| pathType: {{ $ingressPathType }} |
| {{- end }} |
| {{- end -}} |
| {{- end }} |