fix: httpRoute template file
This commit is contained in:
@@ -1,18 +1,8 @@
|
||||
{{- if .Values.httpRoute.enabled -}}
|
||||
{{- $fullName := include "chart.fullname" . -}}
|
||||
{{- $svcPort := .Values.service.port -}}
|
||||
{{- $defaultGatewayName := .Values.gateway.name -}}
|
||||
{{- if not $defaultGatewayName -}}
|
||||
{{- $defaultGatewayName = printf "%s-gateway" $fullName -}}
|
||||
{{- end -}}
|
||||
{{- $defaultGatewayNs := .Release.Namespace -}}
|
||||
{{- if .Values.gateway.enabled -}}
|
||||
{{- $defaultGatewayNs = default .Release.Namespace .Values.gateway.namespace -}}
|
||||
{{- end -}}
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: {{ $fullName }}
|
||||
name: {{ include "chart.fullname" . }}
|
||||
labels:
|
||||
{{- include "chart.labels" . | nindent 4 }}
|
||||
{{- with .Values.httpRoute.annotations }}
|
||||
@@ -23,14 +13,9 @@ spec:
|
||||
parentRefs:
|
||||
{{- if .Values.httpRoute.parentRefs }}
|
||||
{{- range $ref := .Values.httpRoute.parentRefs }}
|
||||
- name: {{ default $defaultGatewayName $ref.name | quote }}
|
||||
{{- $refNs := $ref.namespace | default $defaultGatewayNs -}}
|
||||
namespace: {{ $refNs | quote }}
|
||||
{{- with $ref.sectionName }}
|
||||
sectionName: {{ . | quote }}
|
||||
{{- else }}
|
||||
sectionName: "http"
|
||||
{{- end }}
|
||||
- name: {{ $.Values.gateway.name | default $ref.name | quote }}
|
||||
namespace: {{ $ref.namespace | default (default .Release.Namespace .Values.gateway.namespace) | quote }}
|
||||
sectionName: {{ $ref.sectionName | default "http" | quote }}
|
||||
{{- with $ref.kind }}
|
||||
kind: {{ . | quote }}
|
||||
{{- end }}
|
||||
@@ -40,8 +25,8 @@ spec:
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
# Default parentRef when parentRefs is empty or not set
|
||||
- name: {{ $defaultGatewayName | quote }}
|
||||
namespace: {{ $defaultGatewayNs | quote }}
|
||||
- name: {{ .Values.gateway.name | default (printf "%s-gateway" (include "chart.fullName" .)) | quote }}
|
||||
namespace: {{ default .Release.Namespace .Values.gateway.namespace | quote }}
|
||||
sectionName: "http"
|
||||
{{- end }}
|
||||
{{- with .Values.httpRoute.hostnames }}
|
||||
@@ -59,8 +44,8 @@ spec:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
backendRefs:
|
||||
- name: {{ $fullName }}
|
||||
port: {{ $svcPort }}
|
||||
- name: {{ include "chart.fullname" }}
|
||||
port: {{ $.Values.service.port }}
|
||||
weight: 1
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
Reference in New Issue
Block a user