Skip to content

Commit

Permalink
fix the kind local dev set up
Browse files Browse the repository at this point in the history
- Fix the kind set up
- Add make target to teardown kind
- fix the readme for updated paths and sameple request
  • Loading branch information
Rajagopalan-Ranganathan committed Jun 18, 2024
1 parent d063e89 commit f25b8ea
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ kind/rebac:
./spicedb-kind-setup/setup.sh
.PHONY: kind/spicedb

kind/teardown:
./spicedb-kind-setup/teardown.sh
.PHONY: kind/teardown

.PHONY: run
# run api locally
run: build
Expand Down
13 changes: 7 additions & 6 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,14 @@ if [[ "$RBAC_ARGUMENT" == "rbac" ]]; then
echo ""
echo "curl -v -u ${USER}:${PASSWORD} ${BASE_URL}/api/rbac/v1/status/"
echo ""
echo "Relations - Read(GET) - Sample CURL request"
echo ""
echo "curl -v -u ${USER}:${PASSWORD} '${BASE_URL}/api/authz/v1/relationships?filter.objectType=group&filter.objectId=bob_club&filter.relation=member'"
echo ""
# Revisit after the HTTP streaming decision
# echo "Relations - Read(GET) - Sample CURL request"
# echo ""
# echo "curl -v -u ${USER}:${PASSWORD} '${BASE_URL}/api/authz/v1/relationships?filter.objectType=group&filter.objectId=bob_club&filter.relation=member'"
# echo ""
fi

echo "Relations - Write(POST) - Sample CURL request"
echo ""
JSON_DATA='{"touch":true,"relationships":[{"object":{"type":"group","id":"bob_club"},"relation":"member","subject":{"object":{"type":"user","id":"bob"}}}]}'
echo "curl -v -u ${USER}:${PASSWORD} ${BASE_URL}/api/authz/v1/relationships -H 'Content-Type: application/json' -d '$JSON_DATA'"
JSON_DATA='{ "tuples": [{"resource": {"type": {"type": "group"},"id": "bob_club2"},"relation": "member","subject": {"subject": {"type": {"type": "user"},"id": "bob2"}}}]}'
echo "curl -v -u ${USER}:${PASSWORD} ${BASE_URL}/api/authz/v0/tuples -H 'Content-Type: application/json' -d '$JSON_DATA'"
6 changes: 3 additions & 3 deletions spicedb-kind-setup/kind-kube/kind-ingress.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: sp-cluster
name: kessel-relations-cluster
nodes:
- role: control-plane
kubeadmConfigPatches:
Expand All @@ -11,8 +11,8 @@ nodes:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
hostPort: 8000
listenAddress: "0.0.0.0"
- containerPort: 443
hostPort: 443
hostPort: 8443
listenAddress: "0.0.0.0"
5 changes: 3 additions & 2 deletions spicedb-kind-setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ done
echo "Route"
kubectl get ingresses.networking.k8s.io -n spicedb

echo "Sample curl to relationships api"
echo "Relations - Write(POST) - Sample CURL request"
echo ""
echo "curl http://relationships.127.0.0.1.nip.io/api/authz/v1/relationships -d '{ "touch": true, "relationships": [{"object": {"type": "group","id": "bob_club"},"relation": "member","subject": {"object": {"type": "user","id": "bob"}}}]}'"
JSON_DATA='{ "tuples": [{"resource": {"type": {"type": "group"},"id": "bob_club2"},"relation": "member","subject": {"subject": {"type": {"type": "user"},"id": "bob2"}}}]}'
echo "curl -v http://relationships.127.0.0.1.nip.io:8000/api/authz/v0/tuples -H 'Content-Type: application/json' -d '$JSON_DATA'"
25 changes: 25 additions & 0 deletions spicedb-kind-setup/teardown.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -oe errexit

if ! command -v kind &> /dev/null
then
echo "kind could not be found"
exit
fi

if ! command -v helm &> /dev/null
then
echo "helm could not be found"
exit
fi

if ! command -v kubectl &> /dev/null
then
echo "kubectl could not be found"
exit
fi

# desired cluster name; default is "kind"
echo "Deleting kind cluster -- \"kessel-relations-cluster\""

kind delete cluster --name kessel-relations-cluster

0 comments on commit f25b8ea

Please sign in to comment.