From 3da0f1eedf8e71869f3b13cb7e9e84921ed4671c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Burzy=C5=84ski?= Date: Thu, 9 Nov 2023 14:00:54 +0100 Subject: [PATCH] add alignWithControllerVersion to allow auto-adjustment of GW settings based on controller version --- charts/ingress/Chart.lock | 8 ++++---- charts/ingress/Chart.yaml | 4 ++-- charts/kong/templates/_helpers.tpl | 9 +++++++-- charts/kong/values.yaml | 6 ++++++ 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/charts/ingress/Chart.lock b/charts/ingress/Chart.lock index 37828408e..b4859bb0b 100644 --- a/charts/ingress/Chart.lock +++ b/charts/ingress/Chart.lock @@ -1,9 +1,9 @@ dependencies: - name: kong - repository: https://charts.konghq.com + repository: file://../kong/ version: 2.31.0 - name: kong - repository: https://charts.konghq.com + repository: file://../kong/ version: 2.31.0 -digest: sha256:2897c91fb6e37c04f99a413dac85f991fed223591b8de327a04795e27b90a617 -generated: "2023-11-06T14:36:11.845865+01:00" +digest: sha256:43b29b6944b4f933dac8cea47c076a151e793df14464d52b4029c9d5689c5c6d +generated: "2023-11-09T13:56:18.166194+01:00" diff --git a/charts/ingress/Chart.yaml b/charts/ingress/Chart.yaml index 38e09d233..62c069b15 100644 --- a/charts/ingress/Chart.yaml +++ b/charts/ingress/Chart.yaml @@ -13,11 +13,11 @@ appVersion: "3.4" dependencies: - name: kong version: ">=2.31.0" - repository: https://charts.konghq.com + repository: file://../kong/ alias: controller condition: controller.enabled - name: kong version: ">=2.31.0" - repository: https://charts.konghq.com + repository: file://../kong/ alias: gateway condition: gateway.enabled diff --git a/charts/kong/templates/_helpers.tpl b/charts/kong/templates/_helpers.tpl index cac8c10b3..64ac4f16b 100644 --- a/charts/kong/templates/_helpers.tpl +++ b/charts/kong/templates/_helpers.tpl @@ -1714,12 +1714,17 @@ extensions/v1beta1 {{- define "kong.router_flavor" -}} {{- if .Values.env.router_flavor -}} +{{- /* If explicitly specified in envs, it always wins. */ -}} .Values.env.router_flavor {{- else -}} - {{- if (and .Values.ingressController.enabled (semverCompare ">= 3.0.0" (include "kong.effectiveVersion" .Values.ingressController.image))) -}} + {{- /* If not set explicitly in envs, try using the most modern router based on Ingress Controller version. */ -}} + {{- if or (and .Values.ingressController.enabled (semverCompare ">= 3.0.0" (include "kong.effectiveVersion" .Values.ingressController.image))) + (and .Values.deployment.kong.alignWithControllerVersion (semverCompare ">= 3.0.0" .Values.deployment.kong.alignWithControllerVersion)) + -}} expressions + {{- /* If no Ingress Controller version is set, use a default router flavor. */ -}} {{- else -}} - traditional_compatible + traditional {{- end -}} {{- end -}} {{- end -}} diff --git a/charts/kong/values.yaml b/charts/kong/values.yaml index 79056f8f0..cc7398203 100644 --- a/charts/kong/values.yaml +++ b/charts/kong/values.yaml @@ -19,6 +19,12 @@ deployment: # Setting this to false with ingressController.enabled=true will create a # controller-only release. enabled: true + + # Make Gateway deployment settings to be aligned with a given Ingress Controller version capabilities + # (e.g. use a most-modern router flavor supported by a given Ingress Controller version). + # If left empty, safe defaults will be used (if not specified explicitly in this chart). + alignWithControllerVersion: "" + ## Minimum number of seconds for which a newly created pod should be ready without any of its container crashing, ## for it to be considered available. # minReadySeconds: 60