mirror of
https://github.com/TeamPiped/Piped-Kubernetes.git
synced 2024-08-14 23:57:15 +00:00
76 lines
2.5 KiB
YAML
76 lines
2.5 KiB
YAML
---
|
|
{{- 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" -}}
|
|
{{- $defaultServicePort := get $primaryService.ports (include "common.classes.service.ports.primary" (dict "values" $primaryService)) -}}
|
|
{{- $isStable := include "common.capabilities.ingress.isStable" . }}
|
|
---
|
|
apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }}
|
|
kind: Ingress
|
|
metadata:
|
|
name: {{ $ingressName }}-backend
|
|
{{- with (merge ($values.labels | default dict) (include "common.labels" $ | fromYaml)) }}
|
|
labels: {{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
{{- with (merge ($values.annotations | default dict) (include "common.annotations" $ | fromYaml)) }}
|
|
annotations: {{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- if and $isStable $values.ingressClassName }}
|
|
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 }}
|
|
{{- if $isStable }}
|
|
pathType: {{ default "Prefix" .pathType }}
|
|
{{- end }}
|
|
backend:
|
|
{{- if $isStable }}
|
|
service:
|
|
name: {{ $service }}
|
|
port:
|
|
number: {{ $port }}
|
|
{{- else }}
|
|
serviceName: {{ $service }}
|
|
servicePort: {{ $port }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }} |