Skip to content

Commit

Permalink
reserve namespace if not reserved and output route info
Browse files Browse the repository at this point in the history
  • Loading branch information
akoserwal committed Mar 12, 2024
1 parent 22f553b commit 433f570
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"}}}]}'"

0 comments on commit 433f570

Please sign in to comment.