From 686c16a480851dde847b9d8f5588c2d908fc7db4 Mon Sep 17 00:00:00 2001 From: Hiroto Funakoshi Date: Tue, 24 Sep 2024 16:36:03 +0900 Subject: [PATCH] Bugfix ingress route settings (#2636) * feat: correct ingress route Signed-off-by: hlts2 * fix: helm template parse error Signed-off-by: hlts2 * fix: bugfix ingress route for filter Signed-off-by: hlts2 * fix: route order Signed-off-by: hlts2 * fix: updatetimestamp route Signed-off-by: hlts2 * fix: route settings Signed-off-by: hlts2 * fix: server reflection path Signed-off-by: hlts2 * fix: server reflection handling Signed-off-by: hlts2 * fix: tweak Signed-off-by: hlts2 * fix: deleted unnecessary variable Signed-off-by: hlts2 --------- Signed-off-by: hlts2 Co-authored-by: Yusuke Kato --- charts/vald/templates/gateway/ing.yaml | 193 +++++++++++++++++++++---- 1 file changed, 162 insertions(+), 31 deletions(-) diff --git a/charts/vald/templates/gateway/ing.yaml b/charts/vald/templates/gateway/ing.yaml index f417c04f8b..659b478eb9 100644 --- a/charts/vald/templates/gateway/ing.yaml +++ b/charts/vald/templates/gateway/ing.yaml @@ -13,14 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. # -{{- $filter := .Values.gateway.filter -}} -{{- $filterIngEnabled := and $filter.enabled $filter.ingress.enabled -}} -{{- $mirror := .Values.gateway.mirror -}} -{{- $mirrorIngEnabled := and $mirror.enabled $mirror.ingress.enabled -}} -{{- $lb := .Values.gateway.lb -}} -{{- $lbIngEnabled := and $lb.enabled $lb.ingress.enabled -}} -{{- $gateway := "" -}} -{{- $gatewayName := "" -}} +{{- $reflectionEnabled := .Values.defaults.server_config.servers.grpc.server.grpc.enable_reflection -}} +{{- $filter := .Values.gateway.filter -}} +{{- $filterIngEnabled := and $filter.enabled $filter.ingress.enabled -}} +{{- $filterReflectionEnabled := and $filterIngEnabled (default $reflectionEnabled $filter.server_config.servers.grpc.enable_reflection) -}} +{{- $mirror := .Values.gateway.mirror -}} +{{- $mirrorIngEnabled := and $mirror.enabled $mirror.ingress.enabled -}} +{{- $lb := .Values.gateway.lb -}} +{{- $lbIngEnabled := and $lb.enabled $lb.ingress.enabled -}} +{{- $lbReflectionEnabled := and $lbIngEnabled (default $reflectionEnabled $lb.server_config.servers.grpc.enable_reflection) -}} +{{- $gateway := "" -}} +{{- $gatewayName := "" -}} {{- if or $filterIngEnabled $mirrorIngEnabled $lbIngEnabled }} {{- if $filterIngEnabled }} {{- $gateway = $filter -}} @@ -62,125 +65,253 @@ spec: - host: {{ $gateway.ingress.host }} http: paths: - {{- if and $mirrorIngEnabled $filterIngEnabled $lb.enabled }} - - path: "/vald.v1.Search" + {{- if and $mirrorIngEnabled $filterIngEnabled $lb.enabled }} + - path: "/vald.v1.Search/" backend: service: name: {{ $filter.name }} {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} pathType: {{ $filter.ingress.pathType }} - - path: "/vald.v1.Insert" + - path: "/vald.v1.Insert/" backend: service: name: {{ $filter.name }} {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} pathType: {{ $filter.ingress.pathType }} - - path: "/vald.v1.Update" + # NOTE: Change backend service to mirror after UpdateTimestamp is implemented in mirror. + - path: "/vald.v1.Update/UpdateTimestamp" + backend: + service: + name: {{ $lb.name }} + {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} + pathType: {{ $lb.ingress.pathType }} + - path: "/vald.v1.Update/" backend: service: name: {{ $filter.name }} {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} pathType: {{ $filter.ingress.pathType }} - - path: "/vald.v1.Upsert" + - path: "/vald.v1.Upsert/" backend: service: name: {{ $filter.name }} {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} pathType: {{ $filter.ingress.pathType }} - - path: "/vald.v1.Index" + - path: "/vald.v1.Remove/" + backend: + service: + name: {{ $mirror.name }} + {{- include "vald.ingressPort" (dict "Values" $mirror.ingress) | nindent 12 }} + pathType: {{ $mirror.ingress.pathType }} + - path: "/vald.v1.Object/Exists" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - path: "/vald.v1.Object.Exists" + - path: "/vald.v1.Object/GetTimestamp" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - path: "/vald.v1.Object.GetTimestamp" + - path: "/vald.v1.Object/" + backend: + service: + name: {{ $filter.name }} + {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} + pathType: {{ $filter.ingress.pathType }} + - path: "/vald.v1.Index/" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - path: "/vald.v1.Object" + # NOTE: Change backend service to mirror after Flush is implemented in mirror. + - path: "/vald.v1.Flush/" backend: service: - name: {{ $filter.name }} + name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} - pathType: {{ $filter.ingress.pathType }} - - backend: + pathType: {{ $lb.ingress.pathType }} + - path: "/mirror.v1.Mirror/Register" + backend: service: name: {{ $mirror.name }} {{- include "vald.ingressPort" (dict "Values" $mirror.ingress) | nindent 12 }} pathType: {{ $mirror.ingress.pathType }} + - path: "/vald.v1.Filter/" + backend: + service: + name: {{ $filter.name }} + {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} + pathType: {{ $filter.ingress.pathType }} {{- else if and $filterIngEnabled $lb.enabled }} - - path: "/vald.v1.Index" + - path: "/vald.v1.Search/" + backend: + service: + name: {{ $filter.name }} + {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} + pathType: {{ $filter.ingress.pathType }} + - path: "/vald.v1.Insert/" + backend: + service: + name: {{ $filter.name }} + {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} + pathType: {{ $filter.ingress.pathType }} + - path: "/vald.v1.Update/" + backend: + service: + name: {{ $filter.name }} + {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} + pathType: {{ $filter.ingress.pathType }} + - path: "/vald.v1.Upsert/" + backend: + service: + name: {{ $filter.name }} + {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} + pathType: {{ $filter.ingress.pathType }} + - path: "/vald.v1.Remove/" + backend: + service: + name: {{ $lb.name }} + {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} + pathType: {{ $lb.ingress.pathType }} + - path: "/vald.v1.Index/" + backend: + service: + name: {{ $lb.name }} + {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} + pathType: {{ $lb.ingress.pathType }} + - path: "/vald.v1.Object/Exists" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - path: "/vald.v1.Object.Exists" + - path: "/vald.v1.Object/GetTimestamp" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - path: "/vald.v1.Object.GetTimestamp" + - path: "/vald.v1.Object/" + backend: + service: + name: {{ $filter.name }} + {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} + pathType: {{ $filter.ingress.pathType }} + - path: "/vald.v1.Flush/" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - backend: + - path: "/vald.v1.Filter/" + backend: service: name: {{ $filter.name }} {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} pathType: {{ $filter.ingress.pathType }} {{- else if and $mirrorIngEnabled $lb.enabled }} - - path: "/vald.v1.Search" + - path: "/vald.v1.Search/" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - path: "/vald.v1.Index" + - path: "/vald.v1.Insert/" + backend: + service: + name: {{ $mirror.name }} + {{- include "vald.ingressPort" (dict "Values" $mirror.ingress) | nindent 12 }} + pathType: {{ $mirror.ingress.pathType }} + # NOTE: Change backend service to mirror after UpdateTimestamp is implemented in mirror. + - path: "/vald.v1.Update/UpdateTimestamp" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - path: "/vald.v1.Object.Exists" + - path: "/vald.v1.Update/" + backend: + service: + name: {{ $mirror.name }} + {{- include "vald.ingressPort" (dict "Values" $mirror.ingress) | nindent 12 }} + pathType: {{ $mirror.ingress.pathType }} + - path: "/vald.v1.Upsert/" + backend: + service: + name: {{ $mirror.name }} + {{- include "vald.ingressPort" (dict "Values" $mirror.ingress) | nindent 12 }} + pathType: {{ $mirror.ingress.pathType }} + - path: "/vald.v1.Remove/" + backend: + service: + name: {{ $mirror.name }} + {{- include "vald.ingressPort" (dict "Values" $mirror.ingress) | nindent 12 }} + pathType: {{ $mirror.ingress.pathType }} + - path: "/vald.v1.Object/" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - path: "/vald.v1.Object.GetTimestamp" + - path: "/vald.v1.Index/" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - path: "/vald.v1.Object" + # NOTE: Change backend service to mirror after Flush is implemented in mirror. + - path: "/vald.v1.Flush/" backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} - - backend: + - path: "/mirror.v1.Mirror/Register" + backend: service: name: {{ $mirror.name }} {{- include "vald.ingressPort" (dict "Values" $mirror.ingress) | nindent 12 }} pathType: {{ $mirror.ingress.pathType }} {{- else if $lbIngEnabled }} - - backend: + - path: "/" + backend: + service: + name: {{ $lb.name }} + {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} + pathType: {{ $lb.ingress.pathType }} + {{- end }} + {{- if or $filterReflectionEnabled $lbReflectionEnabled }} + - path: "/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo" + {{- if $filterReflectionEnabled }} + backend: + service: + name: {{ $filter.name }} + {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} + pathType: {{ $filter.ingress.pathType }} + {{- else }} + backend: + service: + name: {{ $lb.name }} + {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} + pathType: {{ $lb.ingress.pathType }} + {{- end }} + - path: "/grpc.reflection.v1.ServerReflection/ServerReflectionInfo" + {{- if $filterReflectionEnabled }} + backend: + service: + name: {{ $filter.name }} + {{- include "vald.ingressPort" (dict "Values" $filter.ingress) | nindent 12 }} + pathType: {{ $filter.ingress.pathType }} + {{- else }} + backend: service: name: {{ $lb.name }} {{- include "vald.ingressPort" (dict "Values" $lb.ingress) | nindent 12 }} pathType: {{ $lb.ingress.pathType }} + {{- end }} {{- end }} {{- end }}