diff --git a/README.md b/README.md index b23b695..50a6c43 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,16 @@ docker run --rm -p 8000:8000 -p 9000:9000 -v :/data/conf ### Prerequisite [bonfire](https://github.com/RedHatInsights/bonfire) + +NOTE: The minimum required version of [bonfire](https://github.com/RedHatInsights/bonfire) +is specified in the MIN_BONFIRE_VERSION variable in the deploy.sh script +Bonfire could be upgraded by command: +```asciidoc +pip install --upgrade crc-bonfire +``` +Latest version of [bonfire](https://github.com/RedHatInsights/bonfire) could be found [here](https://github.com/RedHatInsights/bonfire/releases). + + [oc](https://docs.openshift.com/container-platform/4.8/cli_reference/openshift_cli/getting-started-cli.html) You should have logged into a valid openshift cluster using the oc login command diff --git a/deploy/deploy.sh b/deploy/deploy.sh index f1d9899..393be7c 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -1,4 +1,8 @@ #!/bin/bash +set -e + +# Define the minimum required version +MIN_BONFIRE_VERSION="5.7.2" RBAC_ARGUMENT="$1" RBAC_DIR="$2" @@ -29,6 +33,15 @@ else exit 1 fi +CURRENT_BONFIRE_VERSION=$(bonfire version | cut -d' ' -f3) + +if [[ $(printf '%s\n' "$MIN_BONFIRE_VERSION" "$CURRENT_BONFIRE_VERSION" | sort -V | head -n1) != "$MIN_BONFIRE_VERSION" ]]; then + echo "Current bonfire version ($CURRENT_BONFIRE_VERSION) is less than required version ($MIN_BONFIRE_VERSION)." + echo "Please upgrade bonfire with command:" + echo "pip install --upgrade crc-bonfire" + exit 1 +fi + # Check if there is an existing NS RESERVATIONS=$(bonfire namespace list -m) @@ -86,7 +99,12 @@ done echo "postgress is ready" # Create spiceDB bootstrap schema configmap -oc create configmap spicedb-schema --from-file=schema.yaml -n $NAMESPACE + +if ! oc get configmap spicedb-schema >/dev/null 2>&1; then + oc create configmap spicedb-schema --from-file=schema.yaml -n $NAMESPACE +else + echo "Configmap 'spicedb-schema' already exists." +fi #Deploy Relations service, spiceDB service and rbac service when $RBAC_ARGUMENT is not empty bonfire deploy $RBAC_ARGUMENT relationships -n $NAMESPACE --local-config-method merge --local-config-path $config_file_location