Skip to content

Commit

Permalink
chore: migrate k8s cluster to use the same scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Maddiaa0 committed Jan 20, 2025
1 parent 6079c85 commit 802bcca
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 68 deletions.
8 changes: 8 additions & 0 deletions spartan/aztec-network/eth-devnet/entrypoints/eth-beacon.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#! /bin/bash

if [ -n $K8S_MODE ]; then
# In k8s config maps cannot contain ssz files
# Genesis information is copied such that we can write into it
# First serialize the ssz file
cp -r /genesis-template /genesis &&
base64 -d /genesis/genesis-ssz > /genesis/genesis.ssz
fi

lighthouse bn \
--disable-peer-scoring \
--disable-packet-filter \
Expand Down
Empty file modified spartan/aztec-network/eth-devnet/entrypoints/eth-execution.sh
100644 → 100755
Empty file.
9 changes: 9 additions & 0 deletions spartan/aztec-network/eth-devnet/entrypoints/eth-validator.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#! /bin/bash

if [ -n $K8S_MODE ]; then
cp -r /genesis-template /genesis &&
mkdir -p /data/validators &&
mkdir -p /data/secrets &&
cp -r /validator-setup/keys/* /data/validators &&
cp -r /validator-setup/secrets/* /data/secrets &&
base64 -d /genesis/genesis-ssz > /genesis/genesis.ssz &&
fi

lighthouse vc \
--datadir="/data" \
--beacon-nodes=$ETH_BEACON_URL \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,15 @@ spec:
- name: eth-beacon
image: "{{ .Values.images.lighthouse.image }}"
imagePullPolicy: {{ .Values.images.lighthouse.pullPolicy }}
command: ["/bin/sh", "-c"]
args:
# Genesis information is copied such that we can write into it
# First serialize the ssz file
- >-
cp -r /genesis-template /genesis &&
base64 -d /genesis/genesis-ssz > /genesis/genesis.ssz &&
lighthouse bn
--disable-peer-scoring
--disable-packet-filter
--enable-private-discovery
--disable-enr-auto-update
--staking
--http
--http-address=0.0.0.0
--http-port=5052
--validator-monitor-auto
--http-allow-origin='*'
--listen-address=0.0.0.0
{{- include "helpers.flag" (list "port" .Values.ethereum.beacon.port) }}
--target-peers=0
--testnet-dir=/genesis
--execution-endpoints="http://{{ include "aztec-network.fullname" . }}-eth-execution.{{ .Release.Namespace }}.svc.cluster.local:8551"
--execution-jwt-secret-key="61e1dd9539e8cc37b3d71dcf8ce372f0e119cc1c73426ee80472a4214f2a41a1"
--allow-insecure-genesis-sync
--debug-level=info
command: ["/bin/sh"]
args: ["/entrypoints/eth-beacon.sh"]
env:
- name: K8S_MODE
value: "true"
- name: BEACON_HTTP_PORT
value: "{{ .Values.ethereum.beacon.service.port }}"
- name: ETH_EXECUTION_URL
value: "http://{{ include "aztec-network.fullname" . }}-eth-execution.{{ .Release.Namespace }}.svc.cluster.local:8551"
volumeMounts:
- name: shared-volume
mountPath: /data
Expand Down
10 changes: 10 additions & 0 deletions spartan/aztec-network/templates/eth/eth-entrypoint-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "aztec-network.fullname" . }}-entrypoint-scripts
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
data:
eth-validator.sh: {{ .Files.Get "eth-devnet/entrypoints/eth-validator.sh" | quote }}
eth-beacon.sh: {{ .Files.Get "eth-devnet/entrypoints/eth-beacon.sh" | quote }}
eth-execution.sh: {{ .Files.Get "eth-devnet/entrypoints/eth-execution.sh" | quote }}
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,15 @@ spec:
- name: ethereum
image: "{{ .Values.images.reth.image }}"
imagePullPolicy: {{ .Values.images.reth.pullPolicy }}
command: ["/bin/sh", "-c"]
args:
- >-
reth node
{{ include "helpers.flag" (list "http.port" .Values.ethereum.execution.service.port) }}
--http
--http.addr="0.0.0.0"
--http.api="admin,net,eth,web3,debug,trace"
--http.corsdomain="*"
--txpool.max-tx-input-bytes={{ .Values.ethereum.maxTxInputSizeBytes }}
--max-outbound-peers=0
--max-inbound-peers=0
--ipcdisable
--disable-discovery
--authrpc.addr="0.0.0.0"
--authrpc.port=8551
--authrpc.jwtsecret="/genesis/jwt-secret.hex"
--chain="/genesis/genesis.json"
--datadir="/data"
-vvvv
command: ["/bin/sh"]
args: ["/entrypoints/eth-execution.sh"]
env:
- name: K8S_MODE
value: "true"
- name: HTTP_PORT
value: "{{ .Values.ethereum.execution.service.port }}"
- name: MAX_TX_INPUT_SIZE_BYTES
value: "{{ .Values.ethereum.maxTxInputSizeBytes }}"
ports:
- containerPort: {{ .Values.ethereum.execution.service.port }}
name: eth-execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,22 @@ spec:
- name: eth-validator
image: "{{ .Values.images.lighthouse.image }}"
imagePullPolicy: {{ .Values.images.lighthouse.pullPolicy }}
command: ["/bin/sh", "-c"]
# Copy the genesis and validator setup into the data directory
args:
- >-
cp -r /genesis-template /genesis &&
mkdir -p /data/validators &&
mkdir -p /data/secrets &&
cp -r /validator-setup/keys/* /data/validators &&
cp -r /validator-setup/secrets/* /data/secrets &&
base64 -d /genesis/genesis-ssz > /genesis/genesis.ssz &&
lighthouse vc
--datadir="/data"
--beacon-nodes="http://{{ include "aztec-network.fullname" . }}-eth-beacon.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.ethereum.beacon.service.port }}"
--testnet-dir=/genesis
--init-slashing-protection
--suggested-fee-recipient="0xff00000000000000000000000000000000c0ffee"
--debug-level=debug
command: ["/bin/sh"]
args: ["/entrypoints/eth-validator.sh"]
env:
- name: ETH_BEACON_URL
value: "http://{{ include "aztec-network.fullname" . }}-eth-beacon.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.ethereum.beacon.service.port }}"
- name: K8S_MODE
value: "true"
volumeMounts:
- name: shared-volume
mountPath: /data
- name: genesis
mountPath: /genesis-template
mountPath: /genesis
- name: validator-setup
mountPath: /validator-setup
- name: entrypoint-scripts
mountPath: /entrypoints
resources:
{{- toYaml .Values.ethereum.validator.resources | nindent 12 }}
volumes:
Expand All @@ -83,6 +74,10 @@ spec:
name: {{ include "aztec-network.fullname" . }}-eth-beacon-genesis
- name: validator-setup
emptyDir: {}
- name: entrypoint-scripts
configMap:
name: {{ include "aztec-network.fullname" . }}-entrypoint-scripts
defaultMode: 0755
{{- if gt (.Values.ethereum.replicas | int) 0 }}
---
apiVersion: v1
Expand Down

0 comments on commit 802bcca

Please sign in to comment.