initial commit
This commit is contained in:
39
deploy_wkload.sh
Executable file
39
deploy_wkload.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/zsh -e
|
||||
script_dir="$(dirname "$(readlink -f "$0")")"
|
||||
manifests_dir=${script_dir}/yamls
|
||||
|
||||
|
||||
ns_prefix=wkload-
|
||||
|
||||
if [[ "$1" =~ '^[0-9]+$' ]] ; then
|
||||
nb_ns="$1"
|
||||
else
|
||||
echo First paramater nor given or not number, assuming 1 >&2
|
||||
nb_ns=1
|
||||
fi
|
||||
|
||||
# Namesspaces Cleanup
|
||||
if [[ "$2" == "-d" ]] ; then
|
||||
oc delete --wait ns -l app.kubernetes.io/part-of=fakeworkload || echo No namespace to delete continuing
|
||||
fi
|
||||
|
||||
# yamls Cleanup
|
||||
if [ -d "${manifests_dir}" ] ; then
|
||||
rm -rf "${manifests_dir}"
|
||||
fi
|
||||
|
||||
## Generate yamls
|
||||
echo Template generation ....
|
||||
mkdir "${manifests_dir}"
|
||||
route_domain="$(oc get ingresses.config.openshift.io cluster -o jsonpath='{.spec.domain}')"
|
||||
start=1
|
||||
while [[ "${start}" -le "${nb_ns}" ]] ; do
|
||||
current_ns=${ns_prefix}$(printf "%05d" "${start}")
|
||||
start=$((start + 1))
|
||||
eval "cat >${manifests_dir}/${current_ns}.yaml <<EOF
|
||||
$(<${script_dir}/app_template.yaml)
|
||||
EOF"
|
||||
done
|
||||
|
||||
oc apply -f "${manifests_dir}"
|
||||
echo All Done!
|
||||
Reference in New Issue
Block a user