Skip to content

Commit

Permalink
feat: version check for Kong Gateway with KIC >=3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
programmer04 committed Oct 19, 2023
1 parent 5a20e6e commit 2e1fce6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions charts/ingress/templates/validate-prerequisites.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- /*
This file contains checks of prerequisites to render a fully correct chart that will install a fully functioning application.
In case of failure, it will cause the whole chart to fail with a descriptive message.
*/}}

{{ $kicVersion := (include "kong.effectiveVersion" .Values.controller.ingressController.image) -}}
{{ $kongGatewayVersion := (include "kong.effectiveVersion" .Values.gateway.image) -}}
{{- if (and (semverCompare ">= 3.0.0" $kicVersion ) (semverCompare "< 3.4.1" $kongGatewayVersion )) -}}
{{- fail (printf "Kong Gateway in version: %s is not supported by Kong Kubernetes Ingress Controller in version: %s (>=3.0.0), the lowest supported version is 3.4.1"
$kongGatewayVersion $kicVersion) -}}
{{- end -}}
3 changes: 3 additions & 0 deletions charts/kong/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### Improvements

* Prevent installing PodDisruptionBudget for `replicaCount: 1` or `autoscaling.minReplicas: 1`.
[#896](https://github.com/Kong/charts/pull/896)
* Check version of Kong Gateway to ensure compatible one when KIC is in version >= 3.0.0.
[#900](https://github.com/Kong/charts/pull/900)

## 2.29.0

Expand Down
11 changes: 11 additions & 0 deletions charts/kong/templates/validate-prerequisites.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- /*
This file contains checks of prerequisites to render a fully correct chart that will install a fully functioning application.
In case of failure, it will cause the whole chart to fail with a descriptive message.
*/}}

{{ $kicVersion := (include "kong.effectiveVersion" .Values.ingressController.image) -}}
{{ $kongGatewayVersion := (include "kong.effectiveVersion" .Values.image) -}}
{{- if (and (semverCompare ">= 3.0.0" $kicVersion ) (semverCompare "< 3.4.1" $kongGatewayVersion )) -}}
{{- fail (printf "Kong Gateway in version: %s is not supported by Kong Kubernetes Ingress Controller in version: %s (>=3.0.0), the lowest supported version is 3.4.1"
$kongGatewayVersion $kicVersion) -}}
{{- end -}}
5 changes: 5 additions & 0 deletions scripts/test-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ TEST_ENV_NAME="${TEST_ENV_NAME:-kong-charts-tests}"
KUBECTL="kubectl --context kind-${TEST_ENV_NAME}"
KUBERNETES_VERSION="$($KUBECTL version -o json | jq -r '.serverVersion.gitVersion')"

# TODO: Remove this one when Kong Gateway will updated from 3.4.
KONG_GATEWAY_EFFECTIVE_VERSION="3.4.1"

CONTROLLER_PREFIX=""
ADDITIONAL_FLAGS=()

Expand All @@ -51,6 +54,7 @@ set -x
helm install --create-namespace --namespace "${RELEASE_NAMESPACE}" "${RELEASE_NAME}" \
--set ${CONTROLLER_PREFIX}ingressController.env.anonymous_reports="false" \
--set deployment.test.enabled=true ${ADDITIONAL_FLAGS[*]} \
--set ${CONTROLLER_PREFIX}image.effectiveSemver="${KONG_GATEWAY_EFFECTIVE_VERSION}" \
"charts/${CHART_NAME}"
set +x
# ------------------------------------------------------------------------------
Expand All @@ -72,6 +76,7 @@ helm upgrade --namespace "${RELEASE_NAMESPACE}" "${RELEASE_NAME}" \
--set deployment.test.enabled=true ${ADDITIONAL_FLAGS[*]} \
--set ${CONTROLLER_PREFIX}ingressController.env.anonymous_reports="false" \
--set ${CONTROLLER_PREFIX}ingressController.image.effectiveSemver="${EFFECTIVE_TAG}" \
--set ${CONTROLLER_PREFIX}image.effectiveSemver="${KONG_GATEWAY_EFFECTIVE_VERSION}" \
"charts/${CHART_NAME}"
set +x
# ------------------------------------------------------------------------------
Expand Down

0 comments on commit 2e1fce6

Please sign in to comment.