aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes
diff options
context:
space:
mode:
authorMike Elliott <mike.elliott@amdocs.com>2018-10-24 12:29:00 -0400
committerMike Elliott <mike.elliott@amdocs.com>2018-10-24 12:32:40 -0400
commitdd6f75f73c7d1d78a342ce473a8df7b65ae6eed9 (patch)
tree090bd2e02f1cca9b711baeb5b2450e6c278471d2 /kubernetes
parente343acfd09a8f96200eeeb79dacfe36a5445063e (diff)
Fix deployment of sniro and sdnc
There was a bug that prevented charts from being deployed when sniro-emulator was disabled. The '-' caused parsing issues which is now resolved. Change-Id: I0e35d3ef5f07dfd2d6dc2f2d60a1614dcf53a73c Issue-ID: OOM-1478 Signed-off-by: Mike Elliott <mike.elliott@amdocs.com>
Diffstat (limited to 'kubernetes')
-rwxr-xr-xkubernetes/helm/plugins/deploy/deploy.sh65
1 files changed, 23 insertions, 42 deletions
diff --git a/kubernetes/helm/plugins/deploy/deploy.sh b/kubernetes/helm/plugins/deploy/deploy.sh
index 9d9d1d208c..938c651a97 100755
--- a/kubernetes/helm/plugins/deploy/deploy.sh
+++ b/kubernetes/helm/plugins/deploy/deploy.sh
@@ -42,22 +42,6 @@ Flags:
EOF
}
-parse_yaml() {
- local prefix=$2
- local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
- sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
- -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
- awk -F$fs '{
- indent = length($1)/2;
- vname[indent] = $2;
- for (i in vname) {if (i > indent) {delete vname[i]}}
- if (length($3) > 0) {
- vn=""; for (i=0; i<indent; i++) {vn=(vn)(vname[i])("_")}
- printf("%s%s%s=\"%s\"\n", "'$prefix'",vn, $2, $3);
- }
- }'
-}
-
generate_overrides() {
SUBCHART_NAMES=($(cat $COMPUTED_OVERRIDES | grep -v '^\s\s'))
@@ -79,22 +63,19 @@ generate_overrides() {
}
resolve_deploy_flags() {
- DEPLOY_FLAGS=$1
- for flag in -f --values --set --set-string
- do
- while true ; do
- # extract value of flag
- length=${#flag}
- length=$((length+1))
- FLAG_VALUE="$(echo $DEPLOY_FLAGS | sed -n 's/.*\('$flag'\).\s*/\1/p' | cut -c$length- | cut -d' ' -f1)"
-
- # purge flag and value from
- DEPLOY_FLAGS="${DEPLOY_FLAGS//$flag $FLAG_VALUE/}"
- DEPLOY_FLAGS=$(echo $DEPLOY_FLAGS | awk '{$1=$1};1')
- if [ -z "$FLAG_VALUE" ] ; then
- break
- fi
- done
+ flags=($1)
+ n=${#flags[*]}
+ for (( i = 0; i < n; i++ )); do
+ PARAM=${flags[i]}
+ if [[ $PARAM == "-f" || \
+ $PARAM == "--values" || \
+ $PARAM == "--set" || \
+ $PARAM == "--set-string" ]]; then
+ # skip param and its value
+ i=$((i + 1))
+ else
+ DEPLOY_FLAGS="$DEPLOY_FLAGS $PARAM"
+ fi
done
echo "$DEPLOY_FLAGS"
}
@@ -195,25 +176,25 @@ deploy() {
if [[ $VERBOSE == "true" ]]; then
cat $LOG_FILE
else
- echo "release $RELEASE deployed"
+ echo "release \"$RELEASE\" deployed"
fi
fi
- # parse computed overrides - will use to determine if a subchart is "enabled"
- eval $(parse_yaml $COMPUTED_OVERRIDES "computed_")
-
# upgrade/install each "enabled" subchart
cd $CACHE_SUBCHART_DIR/
for subchart in * ; do
- VAR="computed_${subchart}_enabled"
- COMMAND="$"$VAR
- eval "SUBCHART_ENABLED=$COMMAND"
- if [[ $SUBCHART_ENABLED == "true" ]]; then
+ SUBCHART_OVERRIDES=$CACHE_SUBCHART_DIR/$subchart/subchart-overrides.yaml
+
+ SUBCHART_ENABLED=0
+ if [[ -f $SUBCHART_OVERRIDES ]]; then
+ SUBCHART_ENABLED=$(cat $SUBCHART_OVERRIDES | grep -c "^enabled: true")
+ fi
+
+ if [[ $SUBCHART_ENABLED -eq 1 ]]; then
if [[ -z "$SUBCHART_RELEASE" || $SUBCHART_RELEASE == "$subchart" ]]; then
LOG_FILE=$LOG_DIR/"${RELEASE}-${subchart}".log
:> $LOG_FILE
- SUBCHART_OVERRIDES=$CACHE_SUBCHART_DIR/$subchart/subchart-overrides.yaml
helm upgrade -i "${RELEASE}-${subchart}" $CACHE_SUBCHART_DIR/$subchart \
$DEPLOY_FLAGS -f $GLOBAL_OVERRIDES -f $SUBCHART_OVERRIDES \
> $LOG_FILE 2>&1
@@ -221,7 +202,7 @@ deploy() {
if [[ $VERBOSE == "true" ]]; then
cat $LOG_FILE
else
- echo "release ${RELEASE}-${subchart} deployed"
+ echo "release \"${RELEASE}-${subchart}\" deployed"
fi
fi
else