From 433f570d1c41d2c904143d31ba48ad43dd39dd5a Mon Sep 17 00:00:00 2001 From: Abhishek koserwal Date: Tue, 12 Mar 2024 14:36:21 +0530 Subject: [PATCH] reserve namespace if not reserved and output route info --- deploy/deploy.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/deploy/deploy.sh b/deploy/deploy.sh index 467de01..bd6675b 100755 --- a/deploy/deploy.sh +++ b/deploy/deploy.sh @@ -24,13 +24,14 @@ else exit 1 fi -# Reserve a namespace -bonfire namespace reserve --duration 8h -NAMESPACE=$(oc config view --minify -o 'jsonpath={..namespace}') + + +NAMESPACE=$(oc project -q) if [[ -z "${NAMESPACE}" ]]; then echo "Namespace is not set" - exit 1 + # Reserve a namespace + bonfire namespace reserve --duration 8h fi echo "Using Namespace:" $NAMESPACE @@ -66,3 +67,16 @@ oc create configmap spicedb-schema --from-file=schema.yaml -n $NAMESPACE #Deploy Relations service, spiceDB service bonfire deploy relationships -n $NAMESPACE --local-config-method override + +ROUTE=$(oc get routes --selector='app=relationships' -o jsonpath='{.items[*].spec.host}') +BASE_URL="https://$ROUTE" + +echo "Route: ${BASE_URL}/api/authz/v1/relationships" + +USER="$(oc get secrets env-$NAMESPACE-keycloak --template={{.data.defaultUsername}} | base64 -d)" +PASSWORD="$( oc get secrets env-$NAMESPACE-keycloak --template={{.data.defaultPassword}} | base64 -d)" + +echo "user: ${USER}" +echo "pass: ${PASSWORD}" + +echo "curl -u ${USER}:${PASSWORD} ${BASE_URL}/api/authz/v1/relationships -d '{ "touch": true, "relationships": [{"object": {"type": "group","id": "bob_club"},"relation": "member","subject": {"object": {"type": "user","id": "bob"}}}]}'"