diff --git a/charts/consul/templates/_helpers.tpl b/charts/consul/templates/_helpers.tpl index a38f37463a..72684994df 100644 --- a/charts/consul/templates/_helpers.tpl +++ b/charts/consul/templates/_helpers.tpl @@ -682,4 +682,17 @@ Usage: {{ template "consul.versionInfo" }} {{- $sanitizedVersion = $versionInfo }} {{- end -}} {{- printf "%s" $sanitizedVersion | quote }} +{{- end -}} + +{{/* +Validate that the depraced stanze for .Values.apiGateway is not set. +Cleanup server.extraConfig entries to avoid conflicting entries: + - server.enableAgentDebug: + - `enable_debug` should not exist in extraConfig +Usage: {{ template "consul.validateExtraConfig" . }} +*/}} +{{- define "consul.validate_deprecated_apigateway_not_set" -}} + {{- if .Values.apiGateway}} + {{fail "[DEPRECATED and REMOVED] .Values.apiGateway is no longer supported as of Consul 1.19.0. Use connectInject.apiGateway instead."}} + {{- end -}} {{- end -}} \ No newline at end of file diff --git a/charts/consul/templates/gateway-resources-job.yaml b/charts/consul/templates/gateway-resources-job.yaml index fa74bb8bb3..0c001430d2 100644 --- a/charts/consul/templates/gateway-resources-job.yaml +++ b/charts/consul/templates/gateway-resources-job.yaml @@ -1,3 +1,4 @@ +{{ template "consul.validate_deprecated_apigateway_not_set" . }} {{- if .Values.connectInject.enabled }} apiVersion: batch/v1 kind: Job diff --git a/charts/consul/test/unit/helpers.bats b/charts/consul/test/unit/helpers.bats index 4e33b91886..d1f4c3f965 100644 --- a/charts/consul/test/unit/helpers.bats +++ b/charts/consul/test/unit/helpers.bats @@ -454,3 +454,12 @@ load _helpers [ "$status" -eq 1 ] [[ "$output" =~ "When the value global.experiments.resourceAPIs is set, terminatingGateways.enabled is currently unsupported." ]] } + +@test "helper/consul.validate_deprecated_apiGateway_not_set: fails if .values.apiGateway is set" { + cd `chart_dir` + run helm template \ + -s templates/tests/test-runner.yaml \ + --set 'apiGateway.enabled=true' . + [ "$status" -eq 1 ] + [[ "$output" =~ "[DEPRECATED and REMOVED] .Values.apiGateway is no longer supported as of Consul 1.19.0. Use connectInject.apiGateway instead." ]] +} \ No newline at end of file