Skip to content

Commit

Permalink
Default to --mount-containerd and show a message if the volume is big…
Browse files Browse the repository at this point in the history
…ger than 10GB
  • Loading branch information
chrisburr committed Oct 18, 2023
1 parent 06ae269 commit cb4ad0c
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions run_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@ function check_hostname(){
fi
}

usage="${0##*/} [-h|--help] [--exit-when-done] [--offline] [--enable-coverage] [--mount-containerd] [--set-value key=value] [--] [source directories]"
usage="${0##*/} [-h|--help] [--exit-when-done] [--offline] [--enable-coverage] [--no-mount-containerd] [--set-value key=value] [--] [source directories]"
usage+="\n\n"
usage+=" -h|--help: Print this help message and exit\n"
usage+=" --exit-when-done: Exit after the demo has been started (it will be left running in the background)\n"
usage+=" --enable-coverage: Enable coverage reporting\n"
usage+=" --offline: Run in a mode which is suitable for fully offline use.\n"
usage+=" WARNING: This may result in some weird behaviour, see the demo documentation for details.\n"
usage+=" Implies: --mount-containerd\n"
usage+=" --mount-containerd: Mount a directory on the host for the kind containerd storage.\n"
usage+=" This option avoids needing to pull container images every time the demo is started.\n"
usage+=" WARNING: There is no garbage collection so the directory will grow without bound.\n"
usage+=" --no-mount-containerd: Mount a directory on the host for the kind containerd storage.\n"
usage+=" This option avoids needing to pull container images every time the demo is started.\n"
usage+=" WARNING: There is no garbage collection so the directory will grow without bound.\n"
usage+=" --set-value: Set a value in the Helm values file. This can be used to override the default values.\n"
usage+=" For example, to enable coverage reporting pass: --set-value developer.enableCoverage=true\n"
usage+=" source directories: A list of directories containing Python packages to mount in the demo cluster.\n"

# Parse command-line switches
exit_when_done=0
mount_containerd=0
mount_containerd=1
offline_mode=0
declare -a helm_arguments=()
enable_coverage=0
Expand Down Expand Up @@ -100,8 +100,8 @@ while [ -n "${1:-}" ]; do case $1 in
shift
continue ;;

--mount-containerd)
mount_containerd=1
--no-mount-containerd)
mount_containerd=0
shift
continue ;;

Expand Down Expand Up @@ -380,4 +380,12 @@ while true; do
printf "%b No need to restart! %b\n" "${PARTY_EMOJI}" "${PARTY_EMOJI}"
machine_hostname_has_changed=0
fi
# Check the size of the containerd storage
if [ ${mount_containerd} -eq 1 ]; then
containerd_volume_size="$(docker exec diracx-demo-control-plane du -s -BG /var/lib/containerd | cut -d 'G' -f 1)"
if [[ "${containerd_volume_size}" -gt 10 ]]; then
printf "%b Volume for containerd is %s GB, if you want to save space " "${WARN_EMOJI}" "${containerd_volume_size}"
printf "shutdown the demo and run \"docker volume rm diracx-demo-containerd\"\n"
fi
fi
done

0 comments on commit cb4ad0c

Please sign in to comment.