Created
September 11, 2023 20:23
-
-
Save etrikp/908ccb63383bba50404f856af4cd8eae to your computer and use it in GitHub Desktop.
haproxy-nginx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{/* | |
Validate that only one of haproxy_gateway.enabled or nginx_gateway.enabled is set to true. | |
*/}} | |
{{- define "gateway.validate" -}} | |
{{- $haproxyEnabled := .Values.haproxy_gateway.enabled -}} | |
{{- $nginxEnabled := .Values.nginx_gateway.enabled -}} | |
{{- if and $haproxyEnabled $nginxEnabled -}} | |
{{- printf "Error: Both haproxy_gateway.enabled and nginx_gateway.enabled cannot be set to true simultaneously." -}} | |
{{- else if and (not $haproxyEnabled) (not $nginxEnabled) -}} | |
{{- printf "Error: Either haproxy_gateway.enabled or nginx_gateway.enabled must be set to true." -}} | |
{{- end -}} | |
{{- end -}} | |
{{- $gatewayError := include "gateway.validate" . }} | |
{{- if $gatewayError }} | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: error | |
data: | |
message: {{ $gatewayError | quote }} | |
{{- fail $gatewayError }} | |
{{- end }} | |
# The rest of your Helm templates here... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment