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. This is to achieve parity with OSH-infra patch in [0]. [0] https://review.opendev.org/#/c/697749/ Depends-On: https://review.opendev.org/#/c/697749 Change-Id: I3ed504c65900e7b84728019f3acdf706a40c0427 Signed-off-by: Tin Lam <tlam@omegaprime.dev>
This commit is contained in:
parent
97ac0575ba
commit
5057052c70
@ -8,10 +8,10 @@ network_policy:
|
||||
cidr: 172.17.0.1/16
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: $API_ADDR/16
|
||||
cidr: %%%REPLACE_API_ADDR%%%/16
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: $API_ADDR/32
|
||||
cidr: %%%REPLACE_API_ADDR%%%/32
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: $API_PORT
|
||||
port: %%%REPLACE_API_PORT%%%
|
||||
|
@ -42,7 +42,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%%%
|
||||
|
@ -42,7 +42,7 @@ network_policy:
|
||||
application: cinder
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: $API_ADDR/32
|
||||
cidr: %%%REPLACE_API_ADDR%%%/32
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: $API_PORT
|
||||
port: %%%REPLACE_API_PORT%%%
|
||||
|
@ -47,7 +47,7 @@ network_policy:
|
||||
application: heat
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: $API_ADDR/32
|
||||
cidr: %%%REPLACE_API_ADDR%%%/32
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: $API_PORT
|
||||
port: %%%REPLACE_API_PORT%%%
|
||||
|
@ -66,7 +66,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%%%
|
||||
|
@ -5,15 +5,15 @@ network_policy:
|
||||
egress:
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: $API_ADDR/32
|
||||
cidr: %%%REPLACE_API_ADDR%%%/32
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: $API_PORT
|
||||
port: %%%REPLACE_API_PORT%%%
|
||||
placement:
|
||||
egress:
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: $API_ADDR/32
|
||||
cidr: %%%REPLACE_API_ADDR%%%/32
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: $API_PORT
|
||||
port: %%%REPLACE_API_PORT%%%
|
||||
|
0
tools/deployment/common/env-variables.sh
Normal file → Executable file
0
tools/deployment/common/env-variables.sh
Normal file → Executable file
@ -54,14 +54,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