123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- {{- $name := .Chart.Name }}
- {{- range $index, $val := .Values.items }}
- {{- if eq $val.type "ingress" }}
- {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
- apiVersion: networking.k8s.io/v1
- {{- else }}
- apiVersion: networking.k8s.io/v1beta1
- {{- end }}
- kind: Ingress
- metadata:
- {{- if $val.type }}
- name: {{ $val.name | default (print $name "-" $val.type "-" $index) }}
- {{- else }}
- name: {{ $val.name | default (print $name "-ingress-" $index) }}
- {{- end }}
- labels:
- app: {{ $name }}
- tier: {{ $val.name | default (print $name "-ingress") }}
- {{- if or $val.annotations }}
- annotations:
- {{- if $val.annotations }}
- {{- toYaml $val.annotations | nindent 4 }}
- {{- end }}
- {{- else }}
- annotations:
- kubernetes.io/ingress.class: "nginx"
- nginx.ingress.kubernetes.io/proxy-body-size: 50m
- {{- end }}
- spec:
- {{- if and $val.tls $val.tls.enabled }}
- tls:
- - secretName: {{ $val.tls.name | default (print $name "-secret-tls") }}
- {{- end }}
- rules:
- {{- range $val.rules }}
- - host: {{ .host | quote }}
- http:
- paths:
- {{- range .http.paths }}
- - path: {{ .path | default "/" }}
- {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
- pathType: {{ .pathType | default (print "ImplementationSpecific") }}
- {{- end }}
- backend:
- {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
- service:
- name: {{ .backend.serviceName | default (print $name "-service" )}}
- port:
- number: {{ .backend.servicePort }}
- {{- else }}
- serviceName: {{ .backend.serviceName | default (print $name "-service") }}
- servicePort: {{ .backend.servicePort | default (print "3000") }}
- {{- end }}
- {{- end }}
- {{- end }}
- {{ print "---" }}
- {{- end }}{{- end }}
- {{- range $index, $val := .Values.items }}
- {{- if not (empty $val.containers) }}
- {{- range $Index, $Containers := $val.containers }}
- {{- if and $Containers.url (semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion) }}
- apiVersion: networking.k8s.io/v1
- kind: Ingress
- metadata:
- name: {{ $val.name | default (print $name "-ingress-" $index "-" $Index) }}
- labels:
- app: {{ $name }}
- tier: {{ $val.name | default (print $name "-ingress") }}
- annotations:
- kubernetes.io/ingress.class: "nginx"
- nginx.ingress.kubernetes.io/proxy-body-size: 50m
- spec:
- {{- if and $val.tls $val.tls.enabled }}
- tls:
- - secretName: {{ $val.tls.name | default (print $name "-secret-tls") }}
- {{- end }}
- rules:
- {{- range $indexPorts, $Ports := $Containers.ports }}
- - host: {{ $Containers.url | quote }}
- http:
- paths:
- - backend:
- {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
- service:
- name: {{ $val.name | default (print $name "-service-" $index "-" $Index) }}
- port:
- number: {{ printf "3%v%v%v" $index $Index $indexPorts }}
- {{- else }}
- serviceName: {{ $val.name | default (print $name "-service-" $index "-" $Index) }}
- servicePort: {{ printf "3%v%v%v" $index $Index $indexPorts }}
- {{- end }}
- path: {{ $Ports.path | default (print "/") }}
- {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
- pathType: ImplementationSpecific
- {{- end }}
- {{- end }}
- {{ print "---" }}
- {{- end }}{{- end }}{{- end }}{{- end }}
|