Fix feature gate envvar overriding
Currently using envsubst to perform substitution of value overrides in the feature gate caused conflicts as gotpl gets templated into those overrides. This adds in '%%%REPLACE_${var}%%%' and uses sed to perform the substitution instead to address the issue. Change-Id: I9d3d630b53a2f3d828866229a5072bb04440ae15 Signed-off-by: Tin Lam <tin@irrational.io>
This commit is contained in:
parent
d216fbf731
commit
ac18e6acf9
@ -14,7 +14,7 @@ network_policy:
|
||||
port: 443
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: $API_ADDR/32
|
||||
cidr: %%%REPLACE_API_ADDR%%%/32
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: $API_PORT
|
||||
port: %%%REPLACE_API_PORT%%%
|
||||
|
@ -5,7 +5,7 @@ network_policy:
|
||||
egress:
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: $API_ADDR/32
|
||||
cidr: %%%REPLACE_API_ADDR%%%/32
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: $API_PORT
|
||||
port: %%%REPLACE_API_PORT%%%
|
||||
|
@ -5,7 +5,7 @@ network_policy:
|
||||
egress:
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: $API_ADDR/32
|
||||
cidr: %%%REPLACE_API_ADDR%%%/32
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: $API_PORT
|
||||
port: %%%REPLACE_API_PORT%%%
|
||||
|
@ -102,7 +102,7 @@ network_policy:
|
||||
# port: 35197
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: $API_ADDR/32
|
||||
cidr: %%%REPLACE_API_ADDR%%%/32
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: $API_PORT
|
||||
port: %%%REPLACE_API_PORT%%%
|
||||
|
@ -47,14 +47,21 @@ function combination () {
|
||||
done
|
||||
}
|
||||
|
||||
function replace_variables() {
|
||||
for key in $(env); do
|
||||
local arr=( $(echo $key | awk -F'=' '{ print $1, $2}') )
|
||||
sed -i "s#%%%REPLACE_${arr[0]}%%%#${arr[1]}#g" $@
|
||||
done
|
||||
}
|
||||
|
||||
function override_file_args () {
|
||||
OVERRIDE_ARGS=""
|
||||
echoerr "We will attempt to use values-override files with the following paths:"
|
||||
for FILE in $(combination ${1//,/ } | uniq | tac); do
|
||||
FILE_PATH="${HELM_CHART_ROOT_PATH}/${HELM_CHART}/values_overrides/${FILE}.yaml"
|
||||
if [ -f "${FILE_PATH}" ]; then
|
||||
envsubst < ${FILE_PATH} > /tmp/${HELM_CHART}-${FILE}.yaml
|
||||
OVERRIDE_ARGS+=" --values=/tmp/${HELM_CHART}-${FILE}.yaml "
|
||||
replace_variables ${FILE_PATH}
|
||||
OVERRIDE_ARGS+=" --values=${FILE_PATH} "
|
||||
fi
|
||||
echoerr "${FILE_PATH}"
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user