2023-03-01 21:43:03 +00:00
|
|
|
{{- if .Values.ingress.backend.enabled }}
|
|
|
|
{{- $fullName := include "common.names.fullname" . -}}
|
|
|
|
{{- $ingressName := $fullName -}}
|
|
|
|
{{- $values := .Values.ingress.backend -}}
|
|
|
|
|
|
|
|
{{- if hasKey . "ObjectValues" -}}
|
|
|
|
{{- with .ObjectValues.ingress -}}
|
|
|
|
{{- $values = . -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{ end -}}
|
|
|
|
|
|
|
|
{{- if and (hasKey $values "nameOverride") $values.nameOverride -}}
|
|
|
|
{{- $ingressName = printf "%v-%v" $ingressName $values.nameOverride -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- $primaryService := .Values.backend.service.main -}}
|
|
|
|
{{- $defaultServiceName := "piped-backend" -}}
|
2023-03-03 23:52:18 +00:00
|
|
|
{{- $defaultServicePort := get $primaryService.ports (include "bjw-s.common.lib.service.primaryPort" (dict "values" $primaryService)) -}}
|
|
|
|
apiVersion: networking.k8s.io/v1
|
2023-03-01 21:43:03 +00:00
|
|
|
kind: Ingress
|
|
|
|
metadata:
|
|
|
|
name: {{ $ingressName }}-backend
|
2023-03-03 23:52:18 +00:00
|
|
|
{{- with (merge ($values.labels | default dict) (include "bjw-s.common.lib.metadata.allLabels" $ | fromYaml)) }}
|
2023-03-01 21:43:03 +00:00
|
|
|
labels: {{- toYaml . | nindent 4 }}
|
2023-03-03 23:52:18 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- with (merge ($values.annotations | default dict) (include "bjw-s.common.lib.metadata.globalAnnotations" $ | fromYaml)) }}
|
2023-03-01 21:43:03 +00:00
|
|
|
annotations: {{- toYaml . | nindent 4 }}
|
2023-03-03 23:52:18 +00:00
|
|
|
{{- end }}
|
2023-03-01 21:43:03 +00:00
|
|
|
spec:
|
2023-03-03 23:52:18 +00:00
|
|
|
{{- if $values.ingressClassName }}
|
2023-03-01 21:43:03 +00:00
|
|
|
ingressClassName: {{ $values.ingressClassName }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if $values.tls }}
|
|
|
|
tls:
|
|
|
|
{{- range $values.tls }}
|
|
|
|
- hosts:
|
|
|
|
{{- range .hosts }}
|
|
|
|
- {{ tpl . $ | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .secretName }}
|
|
|
|
secretName: {{ tpl .secretName $ | quote}}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
rules:
|
|
|
|
{{- range $values.hosts }}
|
|
|
|
- host: {{ tpl .host $ | quote }}
|
|
|
|
http:
|
|
|
|
paths:
|
|
|
|
{{- range .paths }}
|
|
|
|
{{- $service := $defaultServiceName -}}
|
|
|
|
{{- $port := $defaultServicePort.port -}}
|
|
|
|
{{- if .service -}}
|
|
|
|
{{- $service = default $service .service.name -}}
|
|
|
|
{{- $port = default $port .service.port -}}
|
|
|
|
{{- end }}
|
|
|
|
- path: {{ tpl .path $ | quote }}
|
|
|
|
pathType: {{ default "Prefix" .pathType }}
|
|
|
|
backend:
|
|
|
|
service:
|
|
|
|
name: {{ $service }}
|
|
|
|
port:
|
|
|
|
number: {{ $port }}
|
|
|
|
{{- end }}
|
2023-03-03 23:52:18 +00:00
|
|
|
{{- end }}
|
2023-03-01 21:43:03 +00:00
|
|
|
{{- end }}
|