Skip to content

Commit

Permalink
add validations
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo committed Nov 9, 2023
1 parent 10ec715 commit 488dfd3
Showing 1 changed file with 47 additions and 3 deletions.
50 changes: 47 additions & 3 deletions charts/ingress/templates/validation.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,51 @@
{{- /* Validate 'expressions' router flavor is not used with KIC < 3.0 */}}
{{- /* Validate 'expressions' router flavor is not used with KIC < 2.10 as it's not supported */}}
{{- if and .Values.controller.ingressController.enabled
(eq .Values.gateway.env.router_flavor "expressions")
(semverCompare "< 3.0" (include "kong.effectiveVersion" .Values.controller.ingressController.image))
(semverCompare "< 2.10" (include "kong.effectiveVersion" .Values.controller.ingressController.image))
-}}
{{- fail (printf "expressions router flavor is not supported with ingress controller %s" .Values.controller.ingressController.image.tag ) -}}
{{- fail (printf `
⚠️ Warning!
"kong/ingress" chart in version 0.10.0 has introduced "gateway.env.router_flavor" value defaulting to "expressions".
"expressions" router flavor is not supported with Kong Ingress Controller %q that you're using.
✅ How to fix it (alternatives)
1. Upgrade to Kong Ingress Controller 3.0 to use this feature.
2. If you want to keep using your Kong Ingress Controller version, set "gateway.env.router_flavor" to "traditional" to
backoff to the previous router flavor in your values.yaml:
gateway:
env:
router_flavor: "traditional"` .Values.controller.ingressController.image.tag ) -}}
{{- end -}}

{{- /* Validate that when 'expressions' router flavor is used with KIC < 3.0, feature flag must be set. */ -}}
{{- if and (.Values.controller.ingressController.enabled)
(eq .Values.gateway.env.router_flavor "expressions")
(not (contains "ExpressionRoutes=true" (default "" .Values.controller.ingressController.env.feature_gates)))
(semverCompare "< 3.0" (include "kong.effectiveVersion" .Values.controller.ingressController.image)) -}}
{{- fail (printf `
⚠️ Warning!
"kong/ingress" chart in version 0.10.0 has introduced "gateway.env.router_flavor" value defaulting to "expressions".
You're using Kong Ingress Controller version %q which supports this feature only when feature flag "ExpressionRoutes=true" is set.
✅ How to fix it (alternatives)
1. Upgrade to Kong Ingress Controller 3.0 to use this feature.
2. Set "controller.ingressController.env.feature_gates" to "ExpressionRoutes=true" to enable this feature in your values.yaml:
controller:
ingressController:
env:
feature_gates: "ExpressionRoutes=true"
2. Set "gateway.env.router_flavor" to "traditional" to use the previous router flavor in your values.yaml:
gateway:
env:
router_flavor: "traditional"` .Values.controller.ingressController.image.tag) -}}
{{- end -}}

0 comments on commit 488dfd3

Please sign in to comment.