Files
nomad/demo/csi/hostpath/run.sh
hashicorp-copywrite[bot] 4f55df8306 Adding explicit MPL license for sub-package (#18219)
This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-16 09:59:07 -05:00

56 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
# Run the hostpath plugin and create some volumes, and then claim them.
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
VOLUME_BASE_NAME=test-volume
run_plugin() {
local expected
expected=$(nomad node status | grep -cv ID)
echo "$ nomad job run ./plugin.nomad"
nomad job run "${DIR}/plugin.nomad"
while :
do
nomad plugin status hostpath \
| grep "Nodes Healthy = $expected" && break
sleep 2
done
echo
echo "$ nomad plugin status hostpath"
nomad plugin status hostpath
}
create_volumes() {
echo
echo "$ cat hostpath.hcl | sed | nomad volume create -"
sed -e "s/VOLUME_NAME/${VOLUME_BASE_NAME}[0]/" \
"${DIR}/hostpath.hcl" | nomad volume create -
echo
echo "$ cat hostpath.hcl | sed | nomad volume create -"
sed -e "s/VOLUME_NAME/${VOLUME_BASE_NAME}[1]/" \
"${DIR}/hostpath.hcl" | nomad volume create -
}
claim_volumes() {
echo
echo "$ nomad job run ./redis.nomad"
nomad job run "${DIR}/redis.nomad"
}
show_status() {
echo
echo "$ nomad volume status"
nomad volume status
}
run_plugin
create_volumes
claim_volumes
show_status