Skip to content

Commit

Permalink
Bugfix ingress route settings (#2636)
Browse files Browse the repository at this point in the history
* feat: correct ingress route

Signed-off-by: hlts2 <[email protected]>

* fix: helm template parse error

Signed-off-by: hlts2 <[email protected]>

* fix: bugfix ingress route for filter

Signed-off-by: hlts2 <[email protected]>

* fix: route order

Signed-off-by: hlts2 <[email protected]>

* fix: updatetimestamp route

Signed-off-by: hlts2 <[email protected]>

* fix: route settings

Signed-off-by: hlts2 <[email protected]>

* fix: server reflection path

Signed-off-by: hlts2 <[email protected]>

* fix: server reflection handling

Signed-off-by: hlts2 <[email protected]>

* fix: tweak

Signed-off-by: hlts2 <[email protected]>

* fix: deleted unnecessary variable

Signed-off-by: hlts2 <[email protected]>

---------

Signed-off-by: hlts2 <[email protected]>
Co-authored-by: Yusuke Kato <[email protected]>
  • Loading branch information
hlts2 and kpango authored Sep 24, 2024
1 parent 10cfd82 commit 686c16a
Showing 1 changed file with 162 additions and 31 deletions.
193 changes: 162 additions & 31 deletions charts/vald/templates/gateway/ing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
Expand Down Expand Up @@ -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 }}

0 comments on commit 686c16a

Please sign in to comment.