Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
biplamal committed Jul 5, 2024
1 parent bf7610e commit 6376158
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions do.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1136,18 +1136,17 @@ k8s_namespace() {
grep namespace deployments/k8s/manifests/${1}.yaml -m 1 | cut -d \: -f2 | cut -d \ -f 2
}
eval_config_manifest() {
file=${1}
new_file=".${file}"
get_yq \
&& rm -rf ${new_file}
eval_yaml() {
get_yq
new_yaml=$(dirname ${1})/.$(basename ${1})
rm -rf ${new_yaml}
# avoid splitting based on whitespace
IFS=''
# mix of cat and echo is used to ensure the input file has
# at least one newline before EOF, otherwise read will not
# provide last line
{ cat ${file}; echo; } | while read line; do
{ cat ${1}; echo; } | while read line; do
# replace all double-quotes with single quotes
line=$(echo "${line}" | sed s#\"#\'#g)
# and revert them back to double-quotes post eval;
Expand All @@ -1157,19 +1156,18 @@ eval_config_manifest() {
# be an issue
# this workaround was put in place because eval gets
# rid of double-quotes
eval echo \"$line\" | sed s#\'#\"#g >> ${new_file}
eval echo \"$line\" | sed s#\'#\"#g >> ${new_yaml}
done
# restore default IFS
unset IFS
cat ${new_file}
echo ${new_yaml}
}
create_ixia_c_k8s() {
echo "Creating K8S ${1} topology ..."
ns=$(k8s_namespace ${1})
cd deployments/k8s/manifests \
&& eval_config_manifest "${1}.yaml" \
&& kubectl apply -f .${1}.yaml \
eval_yaml deployments/k8s/manifests/${1}.yaml \
&& kubectl apply -f deployments/k8s/manifests/.${1}.yaml \
&& cd ../../.. \
&& wait_for_pods ${ns} \
&& kubectl get pods -A \
Expand Down

0 comments on commit 6376158

Please sign in to comment.