Skip to content

Commit

Permalink
Update provision tree script in k8s to use createtree (#2676)
Browse files Browse the repository at this point in the history
This tool replaces the manual instructions that involved the REST API.
  • Loading branch information
mhutchinson authored Feb 18, 2022
1 parent 17aa984 commit 30c5b40
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions examples/deployment/kubernetes/provision_tree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,18 @@ fi

# Set up tunnel:
PORT=35791
export LOG_URL="http://127.0.0.1:${PORT}"
export LOG_RPC="http://127.0.0.1:${PORT}"

echo kubectl port-forward service/trillian-log-service ${PORT}:8091
kubectl port-forward service/trillian-log-service ${PORT}:8091 &
echo kubectl port-forward service/trillian-log-service ${PORT}:8090
kubectl port-forward service/trillian-log-service ${PORT}:8090 &
trap "kill %1" 0 1 2 3 4 6 9 15

sleep 3

echo "Creating tree..."
# TODO(al): use cmd/createtree instead.
TREE=$(curl -sb -X POST ${LOG_URL}/v1beta1/trees -d '{ "tree":{ "tree_state":"ACTIVE", "tree_type":"LOG", "hash_strategy":"RFC6962_SHA256", "signature_algorithm":"ECDSA", "max_root_duration":"0", "hash_algorithm":"SHA256" }, "key_spec":{ "ecdsa_params":{ "curve":"P256" } } }')

echo $TREE

TREEID=$(echo ${TREE} | jq -r .tree_id)
TREEID=$(go run github.com/google/trillian/cmd/createtree --admin_server=${LOG_RPC})

echo "Created tree ${TREEID}:"
echo ${TREE} | jq

echo "Initialising tree ${TREEID}:"
STH=$(curl -s -X POST ${LOG_URL}/v1beta1/logs/${TREEID}:init)
echo "Created STH:"
echo ${STH} | jq

# stop port-forwarding
kill %1

0 comments on commit 30c5b40

Please sign in to comment.