Skip to content

Commit

Permalink
ci: create default subvolumegroup
Browse files Browse the repository at this point in the history
Signed-off-by: Praveen M <m.praveen@ibm.com>
  • Loading branch information
iPraveenParihar committed Nov 9, 2023
1 parent 3572a38 commit c20158d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PendingReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Breaking Changes

- Removed the deprecated grpc metrics flag's in [PR](https://github.com/ceph/ceph-csi/pull/4225)

- Support for pre-creation of cephFS subvolumegroup before creating subvolume
is removed in [PR](https://github.com/ceph/ceph-csi/pull/4195)

Expand Down
20 changes: 20 additions & 0 deletions scripts/rook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ROOK_DEPLOY_TIMEOUT=${ROOK_DEPLOY_TIMEOUT:-300}
ROOK_URL="https://raw.githubusercontent.com/rook/rook/${ROOK_VERSION}/deploy/examples"
ROOK_BLOCK_POOL_NAME=${ROOK_BLOCK_POOL_NAME:-"newrbdpool"}
ROOK_BLOCK_EC_POOL_NAME=${ROOK_BLOCK_EC_POOL_NAME:-"ec-pool"}
ROOK_SUBVOLUMEGROUP_NAME=${ROOK_SUBVOLUMEGROUP_NAME:-"csi"}

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# shellcheck disable=SC1091
Expand Down Expand Up @@ -53,11 +54,14 @@ function deploy_rook() {
cat "${TEMP_DIR}"/cluster-test.yaml
kubectl_retry create -f "${TEMP_DIR}/cluster-test.yaml"
fi

rm -rf "${TEMP_DIR}"

kubectl_retry create -f "${ROOK_URL}/toolbox.yaml"
kubectl_retry create -f "${ROOK_URL}/filesystem-test.yaml"
kubectl_retry create -f "${ROOK_URL}/pool-test.yaml"

createOrDelete_subvolumegroup "create"

# Check if CephCluster is empty
if ! kubectl_retry -n rook-ceph get cephclusters -oyaml | grep 'items: \[\]' &>/dev/null; then
Expand All @@ -79,6 +83,7 @@ function deploy_rook() {
}

function teardown_rook() {
createOrDelete_subvolumegroup "delete"
kubectl delete -f "${ROOK_URL}/pool-test.yaml"
kubectl delete -f "${ROOK_URL}/filesystem-test.yaml"
kubectl delete -f "${ROOK_URL}/toolbox.yaml"
Expand All @@ -88,6 +93,21 @@ function teardown_rook() {
kubectl delete -f "${ROOK_URL}/crds.yaml"
}

# TODO: to be removed once issue is closed - https://github.com/rook/rook/issues/13040
function createOrDelete_subvolumegroup() {
local action="$1"
curl -o "subvolumegroup.yaml" "${ROOK_URL}/subvolumegroup.yaml"
sed -i "s|name:.*|name: $ROOK_SUBVOLUMEGROUP_NAME|g" subvolumegroup.yaml

if [ "$action" == "create" ]; then
kubectl_retry create -f subvolumegroup.yaml
else
kubectl delete -f subvolumegroup.yaml
fi

rm -f "subvolumegroup.yaml"
}

function create_block_pool() {
curl -o newpool.yaml "${ROOK_URL}/pool-test.yaml"
sed -i "s/replicapool/$ROOK_BLOCK_POOL_NAME/g" newpool.yaml
Expand Down

0 comments on commit c20158d

Please sign in to comment.