Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(deploy): use docker run instead of helm test, metrics dashboard scripts #8926

Merged
merged 7 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/run_on_tester
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ ENV_VARS="
# Format the environment variables for the SSH command
ENV_EXPORTS=$(printf 'export %s; ' $ENV_VARS)

echo "Running on tester at IP: $SPOT_IP"
ssh -o ControlMaster=auto -o ControlPath=~/.ssh_mux_%h_%p_%r -o ControlPersist=30s -o TCPKeepAlive=no -o ServerAliveCountMax=5 -o ServerAliveInterval=30 -o StrictHostKeyChecking=no -i "$SPOT_KEY" ubuntu@"$SPOT_IP" "$ENV_EXPORTS $@"
25 changes: 0 additions & 25 deletions spartan/aztec-network/templates/tests/run-tests.yaml

This file was deleted.

8 changes: 1 addition & 7 deletions spartan/aztec-network/values.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
test: "sample"
scenario: "default"

network:
public: false
enableBots: true
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing helm test config


images:
test:
image: aztecprotocol/end-to-end
pullPolicy: IfNotPresent
aztec:
image: aztecprotocol/aztec
pullPolicy: IfNotPresent
Expand Down Expand Up @@ -182,4 +176,4 @@ metrics:
periodSeconds: 10
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 3
failureThreshold: 3
4 changes: 4 additions & 0 deletions spartan/scripts/forward_metrics_dashboard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
echo "Run this script after the metrics pods all come up. After running this script, port forward 5601 locally"
echo "Then navigate to https://localhost:5601 and login with user elastic password admin"
kubectl port-forward -n metrics service/metrics-eck-kibana-kb-http 5601:5601
6 changes: 5 additions & 1 deletion spartan/scripts/setup_local_k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ if ! command -v helm &> /dev/null; then
rm get_helm.sh
fi

kind create cluster
if kind get clusters | grep -q "^kind$"; then
echo "Cluster 'kind' already exists. Skipping creation."
else
kind create cluster
fi
10 changes: 10 additions & 0 deletions spartan/scripts/setup_metrics_dashboard.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo add elastic https://helm.elastic.co
helm repo update
helm dependency build "$(git rev-parse --show-toplevel)/spartan/metrics/"
kubectl create -f https://download.elastic.co/downloads/eck/2.14.0/crds.yaml 2>/dev/null
kubectl create secret generic elasticsearch-es-elastic-user --from-literal=elastic=admin -n metrics
kubectl apply -f https://download.elastic.co/downloads/eck/2.14.0/operator.yaml
helm upgrade --install metrics "$(git rev-parse --show-toplevel)/spartan/metrics/" --wait --namespace metrics --create-namespace --wait-for-jobs=true --timeout=30m
4 changes: 2 additions & 2 deletions yarn-project/end-to-end/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ e2e-cli-wallet:
network-smoke:
ARG values_file
LOCALLY
RUN NAMESPACE=smoke FRESH_INSTALL=true FORCE_BUILD=$force_build VALUES_FILE=${values_file:-default.yaml} ./scripts/network_test.sh ./src/spartan/smoke.test.ts
RUN NAMESPACE=smoke FRESH_INSTALL=true VALUES_FILE=${values_file:-default.yaml} ./scripts/network_test.sh ./src/spartan/smoke.test.ts

Copy link
Collaborator Author

@ludamad ludamad Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer an arg, we never build anymore instead requesting user does (often passing AZTEC_DOCKER_TAG instead suffices)

network-transfer:
ARG values_file
LOCALLY
RUN NAMESPACE=transfer FRESH_INSTALL=true FORCE_BUILD=$force_build VALUES_FILE=${values_file:-default.yaml} ./scripts/network_test.sh ./src/spartan/transfer.test.ts
RUN NAMESPACE=transfer FRESH_INSTALL=true VALUES_FILE=${values_file:-default.yaml} ./scripts/network_test.sh ./src/spartan/transfer.test.ts
35 changes: 31 additions & 4 deletions yarn-project/end-to-end/scripts/network_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,45 @@ if [ "$FRESH_INSTALL" = "true" ]; then
kubectl delete namespace "$NAMESPACE" --ignore-not-found=true --wait=true --now --timeout=10m
fi

function show_status_until_pxe_ready() {
set +x # don't spam with our commands
sleep 15 # let helm upgrade start
for i in {1..100} ; do
if kubectl wait pod -l app==pxe --for=condition=Ready -n "transfer" --timeout=20s >/dev/null 2>/dev/null ; then
break # we are up, stop showing status
fi
# show startup status
kubectl get pods -n "$NAMESPACE"
done
}

show_status_until_pxe_ready &

# Install the Helm chart
helm install spartan "$(git rev-parse --show-toplevel)/spartan/aztec-network/" \
helm upgrade --install spartan "$(git rev-parse --show-toplevel)/spartan/aztec-network/" \
--namespace "$NAMESPACE" \
--create-namespace \
--values "$(git rev-parse --show-toplevel)/spartan/aztec-network/values/$VALUES_FILE" \
--set images.test.image="aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG" \
--set images.aztec.image="aztecprotocol/aztec:$AZTEC_DOCKER_TAG" \
--set test="$TEST" \
--set ingress.enabled=true \
--wait \
--wait-for-jobs=true \
--timeout=30m

kubectl wait pod -l app==pxe --for=condition=Ready -n "$NAMESPACE" --timeout=10m

helm test spartan --namespace "$NAMESPACE" --timeout 30m
function forward_pxe_k8s_port() {
ludamad marked this conversation as resolved.
Show resolved Hide resolved
# NOTE we fail silently, and work in the background
kubectl port-forward --namespace transfer svc/spartan-aztec-network-pxe 9082:8080 2>/dev/null >/dev/null || true
}
# tunnel in to get access directly to our PXE service in k8s
(kubectl port-forward --namespace transfer svc/spartan-aztec-network-pxe 9082:8080 2>/dev/null >/dev/null || true) &

# run our test in the host network namespace (so we can access the above with localhost)
docker run --rm --network=host \
-e SCENARIO=default \
-e PXE_URL=http://localhost:9082 \
-e DEBUG="aztec:*" \
-e LOG_LEVEL=debug \
-e LOG_JSON=1 \
aztecprotocol/end-to-end:$AZTEC_DOCKER_TAG $TEST
Loading