Skip to content

Commit

Permalink
Flyte-core add support for ingressClassName in ingress (#4805)
Browse files Browse the repository at this point in the history
* Add support for ingressClassName in ingress

 - ingressClassName field was added in k8s 1.18, and effectively
   replaces the unofficially supported annotation `ingress.class`

   https://kubernetes.io/docs/concepts/services-networking/ingress/#deprecated-annotation

Signed-off-by: ddl-ebrown <[email protected]>

* Flyte-core don't render empty ingress annotations

 - It's possible to have no annotations set for the ingress, which ends
   up rendering an annotations:

   This can make some validators unhappy, so rewrite the rendering to
   only emit annotations: when the collection is not empty

Signed-off-by: ddl-ebrown <[email protected]>

---------

Signed-off-by: ddl-ebrown <[email protected]>
  • Loading branch information
ddl-ebrown authored Feb 9, 2024
1 parent 227c6a1 commit 0bc0a89
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 21 deletions.
3 changes: 2 additions & 1 deletion charts/flyte-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ helm install gateway bitnami/contour -n flyte
| cluster_resource_manager.service_account_name | string | `"flyteadmin"` | Service account name to run with |
| cluster_resource_manager.templates | list | `[{"key":"aa_namespace","value":"apiVersion: v1\nkind: Namespace\nmetadata:\n name: {{ namespace }}\nspec:\n finalizers:\n - kubernetes\n"},{"key":"ab_project_resource_quota","value":"apiVersion: v1\nkind: ResourceQuota\nmetadata:\n name: project-quota\n namespace: {{ namespace }}\nspec:\n hard:\n limits.cpu: {{ projectQuotaCpu }}\n limits.memory: {{ projectQuotaMemory }}\n"}]` | Resource templates that should be applied |
| cluster_resource_manager.templates[0] | object | `{"key":"aa_namespace","value":"apiVersion: v1\nkind: Namespace\nmetadata:\n name: {{ namespace }}\nspec:\n finalizers:\n - kubernetes\n"}` | Template for namespaces resources |
| common | object | `{"databaseSecret":{"name":"","secretManifest":{}},"flyteNamespaceTemplate":{"enabled":false},"ingress":{"albSSLRedirect":false,"annotations":{"nginx.ingress.kubernetes.io/app-root":"/console"},"enabled":true,"separateGrpcIngress":false,"separateGrpcIngressAnnotations":{"nginx.ingress.kubernetes.io/backend-protocol":"GRPC"},"tls":{"enabled":false},"webpackHMR":false}}` | ---------------------------------------------- COMMON SETTINGS |
| common | object | `{"databaseSecret":{"name":"","secretManifest":{}},"flyteNamespaceTemplate":{"enabled":false},"ingress":{"albSSLRedirect":false,"annotations":{"nginx.ingress.kubernetes.io/app-root":"/console"},"enabled":true,"ingressClassName":null,"separateGrpcIngress":false,"separateGrpcIngressAnnotations":{"nginx.ingress.kubernetes.io/backend-protocol":"GRPC"},"tls":{"enabled":false},"webpackHMR":false}}` | ---------------------------------------------- COMMON SETTINGS |
| common.databaseSecret.name | string | `""` | Specify name of K8s Secret which contains Database password. Leave it empty if you don't need this Secret |
| common.databaseSecret.secretManifest | object | `{}` | Specify your Secret (with sensitive data) or pseudo-manifest (without sensitive data). See https://github.com/godaddy/kubernetes-external-secrets |
| common.flyteNamespaceTemplate.enabled | bool | `false` | - Enable or disable creating Flyte namespace in template. Enable when using helm as template-engine only. Disable when using `helm install ...`. |
| common.ingress.albSSLRedirect | bool | `false` | - albSSLRedirect adds a special route for ssl redirect. Only useful in combination with the AWS LoadBalancer Controller. |
| common.ingress.annotations | object | `{"nginx.ingress.kubernetes.io/app-root":"/console"}` | - Ingress annotations applied to both HTTP and GRPC ingresses. |
| common.ingress.enabled | bool | `true` | - Enable or disable creating Ingress for Flyte. Relevant to disable when using e.g. Istio as ingress controller. |
| common.ingress.ingressClassName | string | `nil` | - Sets the ingressClassName |
| common.ingress.separateGrpcIngress | bool | `false` | - separateGrpcIngress puts GRPC routes into a separate ingress if true. Required for certain ingress controllers like nginx. |
| common.ingress.separateGrpcIngressAnnotations | object | `{"nginx.ingress.kubernetes.io/backend-protocol":"GRPC"}` | - Extra Ingress annotations applied only to the GRPC ingress. Only makes sense if `separateGrpcIngress` is enabled. |
| common.ingress.tls | object | `{"enabled":false}` | - Ingress hostname host: |
Expand Down
12 changes: 6 additions & 6 deletions charts/flyte-core/templates/common/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ metadata:
annotations: {{ tpl (toYaml .) $ | nindent 4}}
{{- end }}
spec:
ingressClassName: {{ .Values.common.ingress.ingressClassName | quote }}
rules:
- http:
paths:
Expand Down Expand Up @@ -477,14 +478,13 @@ kind: Ingress
metadata:
name: {{ template "flyte.name" . }}-grpc
namespace: {{ template "flyte.namespace" . }}
annotations:
{{- with .Values.common.ingress.annotations }}
{{- tpl (toYaml .) $ | nindent 4}}
{{- end }}
{{- with .Values.common.ingress.separateGrpcIngressAnnotations }}
{{- toYaml . | nindent 4}}
{{- $annotations := .Values.common.ingress.annotations | deepCopy -}}
{{- $_ := merge $annotations .Values.common.ingress.separateGrpcIngressAnnotations -}}
{{- with $annotations }}
annotations: {{ tpl (toYaml .) $ | nindent 4}}
{{- end }}
spec:
ingressClassName: {{ .Values.common.ingress.ingressClassName | quote }}
rules:
- host: {{ tpl (toYaml .Values.common.ingress.host) $ }}
http:
Expand Down
2 changes: 2 additions & 0 deletions charts/flyte-core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ common:
# -- Specify your Secret (with sensitive data) or pseudo-manifest (without sensitive data). See https://github.com/godaddy/kubernetes-external-secrets
secretManifest: {}
ingress:
# --- Sets the ingressClassName
ingressClassName:
# --- Enable or disable creating Ingress for Flyte. Relevant to disable when using e.g. Istio as ingress controller.
enabled: true
# --- Enable or disable HMR route to flyteconsole. This is useful only for frontend development.
Expand Down
6 changes: 4 additions & 2 deletions deployment/eks/flyte_aws_scheduler_helm_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1394,6 +1394,7 @@ metadata:
kubernetes.io/ingress.class: alb
nginx.ingress.kubernetes.io/app-root: /console
spec:
ingressClassName:
rules:
- http:
paths:
Expand Down Expand Up @@ -1549,9 +1550,10 @@ kind: Ingress
metadata:
name: flyte-core-grpc
namespace: flyte
annotations:
annotations:
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig":
{ "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
alb.ingress.kubernetes.io/backend-protocol-version: GRPC
alb.ingress.kubernetes.io/certificate-arn: '<CERTIFICATE_ARN>'
alb.ingress.kubernetes.io/group.name: flyte
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
Expand All @@ -1560,9 +1562,9 @@ metadata:
alb.ingress.kubernetes.io/target-type: ip
kubernetes.io/ingress.class: alb
nginx.ingress.kubernetes.io/app-root: /console
alb.ingress.kubernetes.io/backend-protocol-version: GRPC
nginx.ingress.kubernetes.io/backend-protocol: GRPC
spec:
ingressClassName:
rules:
- host: null
http:
Expand Down
6 changes: 4 additions & 2 deletions deployment/eks/flyte_helm_controlplane_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ metadata:
kubernetes.io/ingress.class: alb
nginx.ingress.kubernetes.io/app-root: /console
spec:
ingressClassName:
rules:
- http:
paths:
Expand Down Expand Up @@ -1175,9 +1176,10 @@ kind: Ingress
metadata:
name: flyte-core-grpc
namespace: flyte
annotations:
annotations:
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig":
{ "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
alb.ingress.kubernetes.io/backend-protocol-version: GRPC
alb.ingress.kubernetes.io/certificate-arn: '<CERTIFICATE_ARN>'
alb.ingress.kubernetes.io/group.name: flyte
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
Expand All @@ -1186,9 +1188,9 @@ metadata:
alb.ingress.kubernetes.io/target-type: ip
kubernetes.io/ingress.class: alb
nginx.ingress.kubernetes.io/app-root: /console
alb.ingress.kubernetes.io/backend-protocol-version: GRPC
nginx.ingress.kubernetes.io/backend-protocol: GRPC
spec:
ingressClassName:
rules:
- host: null
http:
Expand Down
6 changes: 4 additions & 2 deletions deployment/eks/flyte_helm_dataplane_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ metadata:
kubernetes.io/ingress.class: alb
nginx.ingress.kubernetes.io/app-root: /console
spec:
ingressClassName:
rules:
- http:
paths:
Expand Down Expand Up @@ -748,9 +749,10 @@ kind: Ingress
metadata:
name: flyte-core-grpc
namespace: flyte
annotations:
annotations:
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig":
{ "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
alb.ingress.kubernetes.io/backend-protocol-version: GRPC
alb.ingress.kubernetes.io/certificate-arn: '<CERTIFICATE_ARN>'
alb.ingress.kubernetes.io/group.name: flyte
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
Expand All @@ -759,9 +761,9 @@ metadata:
alb.ingress.kubernetes.io/target-type: ip
kubernetes.io/ingress.class: alb
nginx.ingress.kubernetes.io/app-root: /console
alb.ingress.kubernetes.io/backend-protocol-version: GRPC
nginx.ingress.kubernetes.io/backend-protocol: GRPC
spec:
ingressClassName:
rules:
- host: null
http:
Expand Down
6 changes: 4 additions & 2 deletions deployment/eks/flyte_helm_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1513,6 +1513,7 @@ metadata:
kubernetes.io/ingress.class: alb
nginx.ingress.kubernetes.io/app-root: /console
spec:
ingressClassName:
rules:
- http:
paths:
Expand Down Expand Up @@ -1668,9 +1669,10 @@ kind: Ingress
metadata:
name: flyte-core-grpc
namespace: flyte
annotations:
annotations:
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig":
{ "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
alb.ingress.kubernetes.io/backend-protocol-version: GRPC
alb.ingress.kubernetes.io/certificate-arn: '<CERTIFICATE_ARN>'
alb.ingress.kubernetes.io/group.name: flyte
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]'
Expand All @@ -1679,9 +1681,9 @@ metadata:
alb.ingress.kubernetes.io/target-type: ip
kubernetes.io/ingress.class: alb
nginx.ingress.kubernetes.io/app-root: /console
alb.ingress.kubernetes.io/backend-protocol-version: GRPC
nginx.ingress.kubernetes.io/backend-protocol: GRPC
spec:
ingressClassName:
rules:
- host: null
http:
Expand Down
6 changes: 4 additions & 2 deletions deployment/gcp/flyte_helm_controlplane_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ metadata:
nginx.ingress.kubernetes.io/app-root: /console
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
ingressClassName:
rules:
- http:
paths:
Expand Down Expand Up @@ -1182,13 +1183,14 @@ kind: Ingress
metadata:
name: flyte-core-grpc
namespace: flyte
annotations:
annotations:
cert-manager.io/issuer: letsencrypt-production
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/app-root: /console
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/backend-protocol: GRPC
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
ingressClassName:
rules:
- host: '<HOSTNAME>'
http:
Expand Down
6 changes: 4 additions & 2 deletions deployment/gcp/flyte_helm_dataplane_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,7 @@ metadata:
nginx.ingress.kubernetes.io/app-root: /console
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
ingressClassName:
rules:
- http:
paths:
Expand Down Expand Up @@ -747,13 +748,14 @@ kind: Ingress
metadata:
name: flyte-core-grpc
namespace: flyte
annotations:
annotations:
cert-manager.io/issuer: letsencrypt-production
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/app-root: /console
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/backend-protocol: GRPC
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
ingressClassName:
rules:
- host: '<HOSTNAME>'
http:
Expand Down
6 changes: 4 additions & 2 deletions deployment/gcp/flyte_helm_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,7 @@ metadata:
nginx.ingress.kubernetes.io/app-root: /console
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
ingressClassName:
rules:
- http:
paths:
Expand Down Expand Up @@ -1682,13 +1683,14 @@ kind: Ingress
metadata:
name: flyte-core-grpc
namespace: flyte
annotations:
annotations:
cert-manager.io/issuer: letsencrypt-production
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/app-root: /console
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/backend-protocol: GRPC
nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
ingressClassName:
rules:
- host: '<HOSTNAME>'
http:
Expand Down
1 change: 1 addition & 0 deletions deployment/sandbox/flyte_helm_generated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7538,6 +7538,7 @@ metadata:
annotations:
nginx.ingress.kubernetes.io/app-root: /console
spec:
ingressClassName:
rules:
- http:
paths:
Expand Down

0 comments on commit 0bc0a89

Please sign in to comment.