From 7428c83996a8c836753c9e6deca47e8f4c495027 Mon Sep 17 00:00:00 2001 From: Ryan Lo Date: Sun, 25 Feb 2024 23:00:12 +0800 Subject: [PATCH] move paths in values.yaml to _helpers.tpl Signed-off-by: Ryan Lo --- charts/flyte-binary/README.md | 12 ------------ charts/flyte-binary/templates/_helpers.tpl | 18 ++++++++++++++++++ .../flyte-binary/templates/ingress/grpc.yaml | 9 +++++---- .../flyte-binary/templates/ingress/http.yaml | 13 +++++++------ charts/flyte-binary/values.yaml | 14 -------------- 5 files changed, 30 insertions(+), 36 deletions(-) diff --git a/charts/flyte-binary/README.md b/charts/flyte-binary/README.md index 8f855666f6..679f115471 100644 --- a/charts/flyte-binary/README.md +++ b/charts/flyte-binary/README.md @@ -129,18 +129,6 @@ Chart for basic single Flyte executable deployment | ingress.grpcExtraPaths.append | list | `[]` | | | ingress.grpcExtraPaths.prepend | list | `[]` | | | ingress.grpcIngressClassName | string | `""` | | -| ingress.grpcPaths[0] | string | `"/flyteidl.service.AdminService"` | | -| ingress.grpcPaths[10] | string | `"/flyteidl.service.SignalService"` | | -| ingress.grpcPaths[11] | string | `"/flyteidl.service.SignalService/*"` | | -| ingress.grpcPaths[1] | string | `"/flyteidl.service.AdminService/*"` | | -| ingress.grpcPaths[2] | string | `"/flyteidl.service.DataProxyService"` | | -| ingress.grpcPaths[3] | string | `"/flyteidl.service.DataProxyService/*"` | | -| ingress.grpcPaths[4] | string | `"/flyteidl.service.AuthMetadataService"` | | -| ingress.grpcPaths[5] | string | `"/flyteidl.service.AuthMetadataService/*"` | | -| ingress.grpcPaths[6] | string | `"/flyteidl.service.IdentityService"` | | -| ingress.grpcPaths[7] | string | `"/flyteidl.service.IdentityService/*"` | | -| ingress.grpcPaths[8] | string | `"/grpc.health.v1.Health"` | | -| ingress.grpcPaths[9] | string | `"/grpc.health.v1.Health/*"` | | | ingress.grpcTls | list | `[]` | | | ingress.host | string | `""` | | | ingress.httpAnnotations | object | `{}` | | diff --git a/charts/flyte-binary/templates/_helpers.tpl b/charts/flyte-binary/templates/_helpers.tpl index 92e8fa4636..85184a45db 100644 --- a/charts/flyte-binary/templates/_helpers.tpl +++ b/charts/flyte-binary/templates/_helpers.tpl @@ -176,6 +176,24 @@ Get the Flyte service GRPC port. {{- default 8089 .Values.service.ports.grpc -}} {{- end -}} +{{/* +Get the Flyte service GRPC paths. +*/}} +{{- define "flyte-binary.ingress.grpcPaths" -}} +- /flyteidl.service.AdminService +- /flyteidl.service.AdminService/* +- /flyteidl.service.AuthMetadataService +- /flyteidl.service.AuthMetadataService/ +- /flyteidl.service.DataProxyService +- /flyteidl.service.DataProxyService/* +- /flyteidl.service.IdentityService +- /flyteidl.service.IdentityService/* +- /flyteidl.service.SignalService +- /flyteidl.service.SignalService/* +- /grpc.health.v1.Health +- /grpc.health.v1.Health/* +{{- end -}} + {{/* Get the Flyte agent service GRPC port. */}} diff --git a/charts/flyte-binary/templates/ingress/grpc.yaml b/charts/flyte-binary/templates/ingress/grpc.yaml index e41a5cc95c..bd43185e50 100644 --- a/charts/flyte-binary/templates/ingress/grpc.yaml +++ b/charts/flyte-binary/templates/ingress/grpc.yaml @@ -1,4 +1,5 @@ {{- if and .Values.ingress.create .Values.ingress.separateGrpcIngress }} +{{- $paths := (include "flyte-binary.ingress.grpcPaths" .) | fromYamlArray }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: @@ -38,8 +39,8 @@ spec: {{- if .Values.ingress.grpcExtraPaths.prepend }} {{- tpl ( .Values.ingress.grpcExtraPaths.prepend | toYaml ) . | nindent 6 }} {{- end }} - {{- range .Values.ingress.grpcPaths }} - - path: {{ . }} + {{- range $path := $paths }} + - path: {{ $path }} {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} pathType: ImplementationSpecific {{- end }} @@ -50,8 +51,8 @@ spec: port: number: {{ include "flyte-binary.service.grpc.port" $ }} {{- else }} - serviceName: {{ include "flyte-binary.service.grpc.name" $ }} - servicePort: {{ include "flyte-binary.service.grpc.port" $ }} + serviceName: {{ include "flyte-binary.service.grpc.name" $ }} + servicePort: {{ include "flyte-binary.service.grpc.port" $ }} {{- end }} {{- end }} {{- if .Values.ingress.grpcExtraPaths.append }} diff --git a/charts/flyte-binary/templates/ingress/http.yaml b/charts/flyte-binary/templates/ingress/http.yaml index e74da34d01..c880350334 100644 --- a/charts/flyte-binary/templates/ingress/http.yaml +++ b/charts/flyte-binary/templates/ingress/http.yaml @@ -175,8 +175,13 @@ spec: path: /oauth2/* pathType: ImplementationSpecific {{- if not .Values.ingress.separateGrpcIngress }} - {{- range .Values.ingress.grpcPaths }} - - backend: + {{- $paths := (include "flyte-binary.ingress.grpcPaths" .) | fromYamlArray }} + {{- range $path := $paths }} + - path: {{ $path }} + {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} + pathType: ImplementationSpecific + {{- end }} + backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: name: {{ include "flyte-binary.service.http.name" $ }} @@ -186,10 +191,6 @@ spec: serviceName: {{ include "flyte-binary.service.http.name" $ }} servicePort: {{ include "flyte-binary.service.grpc.port" $ }} {{- end }} - path: {{ . }} - {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} - pathType: ImplementationSpecific - {{- end }} {{- end }} {{- end }} {{- if .Values.ingress.httpExtraPaths.append }} diff --git a/charts/flyte-binary/values.yaml b/charts/flyte-binary/values.yaml index 4de691d559..2935c98db9 100644 --- a/charts/flyte-binary/values.yaml +++ b/charts/flyte-binary/values.yaml @@ -349,20 +349,6 @@ ingress: httpTls: [] # grpcTls Add TLS configuration to grpc ingress resource. Overrides `tls` grpcTls: [] - # grpcPaths Add default paths to grpc ingress rule - grpcPaths: - - /flyteidl.service.AdminService - - /flyteidl.service.AdminService/* - - /flyteidl.service.DataProxyService - - /flyteidl.service.DataProxyService/* - - /flyteidl.service.AuthMetadataService - - /flyteidl.service.AuthMetadataService/* - - /flyteidl.service.IdentityService - - /flyteidl.service.IdentityService/* - - /grpc.health.v1.Health - - /grpc.health.v1.Health/* - - /flyteidl.service.SignalService - - /flyteidl.service.SignalService/* # httpExtraPaths Add extra paths to http ingress rule httpExtraPaths: prepend: []