Skip to content

Commit

Permalink
polish ingress.yaml
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Lo <[email protected]>
  • Loading branch information
lowc1012 committed Feb 24, 2024
1 parent 94e433b commit aa2d2ed
Show file tree
Hide file tree
Showing 4 changed files with 267 additions and 268 deletions.
149 changes: 149 additions & 0 deletions charts/flyte-core/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -261,3 +261,152 @@ storage:
limits:
maxDownloadMBs: {{ .Values.storage.limits.maxDownloadMBs }}
{{- end }}

{{/* Generate grpcRoutes for ingress */}}
{{- define "ingress.grpcRoutes" -}}
{{- $grpcPort := .Values.configmap.adminServer.server.security.secure | ternary 80 81 -}}
- path: /flyteidl.service.SignalService
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /flyteidl.service.SignalService/*
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /flyteidl.service.AdminService
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /flyteidl.service.AdminService/*
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /flyteidl.service.DataProxyService
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /flyteidl.service.DataProxyService/*
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /flyteidl.service.AuthMetadataService
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /flyteidl.service.AuthMetadataService/*
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /flyteidl.service.IdentityService
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /flyteidl.service.IdentityService/*
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /grpc.health.v1.Health
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
- path: /grpc.health.v1.Health/*
pathType: ImplementationSpecific
backend:
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
service:
name: flyteadmin
port:
number: {{ $grpcPort }}
{{- else }}
serviceName: flyteadmin
servicePort: {{ $grpcPort }}
{{- end }}
{{- end -}}
41 changes: 41 additions & 0 deletions charts/flyte-core/templates/common/ingress-separateGrpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{/* Certain ingress controllers like nginx cannot serve HTTP 1 and GRPC with a single ingress because GRPC can only */}}
{{/* enabled on the ingress object, not on backend services (GRPC annotation is set on the ingress, not on the services). */}}

{{- if and .Values.common.ingress.enabled .Values.common.ingress.separateGrpcIngress }}
{{- $annotations := .Values.common.ingress.annotations | deepCopy -}}
{{- $_ := merge $annotations .Values.common.ingress.separateGrpcIngressAnnotations -}}

{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
apiVersion: networking.k8s.io/v1
{{- else }}
apiVersion: networking.k8s.io/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ template "flyte.name" . }}-grpc
namespace: {{ template "flyte.namespace" . }}
{{- with $annotations }}
annotations:
{{- toYaml . | nindent 4}}
{{- end }}
spec:
ingressClassName: {{ .Values.common.ingress.ingressClassName | quote }}
rules:
- host: {{ tpl (toYaml .Values.common.ingress.host) $ }}
http:
paths:
{{- include "ingress.grpcRoutes" . | nindent 10 -}}
{{- if .Values.common.ingress.albSSLRedirect }}
# - backend:
# serviceName: ssl-redirect
# servicePort: use-annotation
# path: /*
# pathType: ImplementationSpecific
{{- end }}
{{- if .Values.common.ingress.tls.enabled }}
tls:
- secretName: {{ .Values.common.ingress.tls.secretName | default (printf "%s-flyte-tls" .Release.Name) }}
hosts:
- {{ tpl (toYaml .Values.common.ingress.host) $ }}
{{ end }}
{{- end }}
Loading

0 comments on commit aa2d2ed

Please sign in to comment.