Add base-manifests

This commit is contained in:
Alberto Soutullo
2025-06-27 17:56:35 +02:00
parent ab4bc88a30
commit 7d0089fa10
7 changed files with 202 additions and 0 deletions

4
base-manifests/README.md Normal file
View File

@@ -0,0 +1,4 @@
# Base manifests
Necessary components to have in the namespace before running the benchmarks.
Apply these via `deploy.sh` just once.

View File

@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: Service
metadata:
name: anvil
namespace: status-go-test
spec:
ports:
- protocol: TCP
port: 8545
targetPort: 8545
selector:
app: anvil

View File

@@ -0,0 +1,35 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: anvil
namespace: status-go-test
spec:
selector:
matchLabels:
app: anvil
serviceName: "anvil"
replicas: 1
template:
metadata:
labels:
app: anvil
spec:
containers:
- name: anvil
image: ghcr.io/foundry-rs/foundry:latest
command: ["anvil", "--host", "0.0.0.0", "--block-time", "2"]
ports:
- containerPort: 8545
livenessProbe:
tcpSocket:
port: 8545
initialDelaySeconds: 30
periodSeconds: 20
failureThreshold: 3
timeoutSeconds: 5
envFrom:
- configMapRef:
name: snt-config
- secretRef:
name: snt-secrets

33
base-manifests/deploy.sh Normal file
View File

@@ -0,0 +1,33 @@
#!/bin/bash
#
# Deployer tool for status-go-test
# Deploys the Anvil/geth service and SNT contracts and prepares the environment for running status-backend
KUBECONFIG="$HOME/.kube/sapphire.yaml"
cd "$(dirname "$0")"
# Deploy the Anvil service
kubectl --kubeconfig $KUBECONFIG apply -f anvil-service.yaml
# Deploy the Anvil statefulset
kubectl --kubeconfig $KUBECONFIG apply -f anvil-statefulset.yaml
# Deploy secret + configmap
kubectl --kubeconfig $KUBECONFIG apply -f snt-configmap-and-secret.yaml
# Check for liveness of Anvil statefulset before deploying contracts
kubectl --kubeconfig $KUBECONFIG wait --for=condition=ready pod -l app=anvil --timeout=60s --namespace=status-go-test
# Deploy SNT contracts
kubectl --kubeconfig $KUBECONFIG apply -f snt-contract-deployment.yaml
# Deploy Communities contracts
kubectl --kubeconfig $KUBECONFIG apply -f snt-communities-deployment.yaml
# Wait and delete pods that finished their task
sleep 10
kubectl --kubeconfig $KUBECONFIG wait --for=condition=ready pod -l app=deploy-sntv2 --timeout=60s --namespace=status-go-test
kubectl --kubeconfig $KUBECONFIG wait --for=condition=ready pod -l app=deploy-communities-contracts --timeout=60s --namespace=status-go-test
kubectl --kubeconfig $KUBECONFIG delete -f snt-contract-deployment.yaml
kubectl --kubeconfig $KUBECONFIG delete -f snt-communities-deployment.yaml

View File

@@ -0,0 +1,50 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-communities-contracts
namespace: status-go-test
spec:
replicas: 1
selector:
matchLabels:
app: deploy-communities-contracts
template:
metadata:
labels:
app: deploy-communities-contracts
spec:
dnsConfig:
searches:
- anvil.status-go-test.svc.cluster.local
containers:
- name: deploy-communities-contracts
image: zorlin/deploy-communities-contracts:latest
envFrom:
- configMapRef:
name: snt-config
- secretRef:
name: snt-secrets
command: []
args: ["/bin/bash", "-c", "forge script script/DeployContracts.s.sol --broadcast --fork-url=http://anvil.status-go-test:8545 --private-key=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --sender=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"]
env:
- name: GITHUB_ORG
value: "status-im"
- name: GITHUB_REPO
value: "communities-contracts"
- name: API_KEY_ETHERSCAN
valueFrom:
secretKeyRef:
name: snt-secrets
key: API_KEY_ETHERSCAN
- name: API_KEY_ARBISCAN
valueFrom:
secretKeyRef:
name: snt-secrets
key: API_KEY_ARBISCAN
- name: API_KEY_OPTIMISTIC_ETHERSCAN
valueFrom:
secretKeyRef:
name: snt-secrets
key: API_KEY_OPTIMISTIC_ETHERSCAN

View File

@@ -0,0 +1,22 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: snt-config
namespace: status-go-test
data:
GITHUB_ORG: "status-im"
GITHUB_REPO_SNTV2: "status-network-token-v2"
GITHUB_REPO_COMMUNITIES: "communities-contracts"
---
apiVersion: v1
kind: Secret
metadata:
name: snt-secrets
namespace: status-go-test
type: Opaque
data:
API_KEY_ETHERSCAN: ""
API_KEY_ARBISCAN: ""
API_KEY_OPTIMISTIC_ETHERSCAN: ""
PRIVATE_KEY: "YWMwOTc0YmVjMzlhMTdlMzZiYTRhNmI0ZDIzOGZmOTQ0YmFjYjQ3OGNiZWQ1ZWZjYWU3ODRkN2JmNGYyZmY4MA=="

View File

@@ -0,0 +1,45 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: deploy-sntv2
namespace: status-go-test
spec:
replicas: 1
selector:
matchLabels:
app: deploy-sntv2
template:
metadata:
labels:
app: deploy-sntv2
spec:
dnsConfig:
searches:
- anvil.status-go-test.svc.cluster.local
containers:
- name: deploy-sntv2
image: zorlin/deploy-sntv2:latest
command: []
args: ["/bin/bash", "-c", "forge script script/Deploy.s.sol --broadcast --fork-url=http://anvil:8545 --private-key=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"]
env:
- name: GITHUB_ORG
value: "status-im"
- name: GITHUB_REPO
value: "status-network-token-v2"
- name: API_KEY_ETHERSCAN
valueFrom:
secretKeyRef:
name: snt-secrets
key: API_KEY_ETHERSCAN
- name: API_KEY_ARBISCAN
valueFrom:
secretKeyRef:
name: snt-secrets
key: API_KEY_ARBISCAN
- name: API_KEY_OPTIMISTIC_ETHERSCAN
valueFrom:
secretKeyRef:
name: snt-secrets
key: API_KEY_OPTIMISTIC_ETHERSCAN