From ee076f5b3270a57c06d7cd5ee178af9cfab93634 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Wed, 29 Jan 2025 19:36:14 +0000 Subject: [PATCH 1/4] fix: node port on beacon --- spartan/aztec-network/templates/eth/eth-beacon.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spartan/aztec-network/templates/eth/eth-beacon.yaml b/spartan/aztec-network/templates/eth/eth-beacon.yaml index 8ab5d89e41d..2d1b8f31f76 100644 --- a/spartan/aztec-network/templates/eth/eth-beacon.yaml +++ b/spartan/aztec-network/templates/eth/eth-beacon.yaml @@ -74,6 +74,9 @@ spec: - protocol: TCP port: {{ .Values.ethereum.beacon.service.port }} targetPort: {{ .Values.ethereum.beacon.service.targetPort }} + {{- if and (eq .Values.ethereum.beacon.service.type "NodePort") .Values.ethereum.beacon.service.nodePort }} + nodePort: {{ .Values.ethereum.beacon.service.nodePort }} + {{- end }} --- apiVersion: v1 kind: ConfigMap From a241b77b7ff0af1f2155488a91e84194d195fa35 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Wed, 29 Jan 2025 20:30:50 +0000 Subject: [PATCH 2/4] fix: no node port get load balancer addr --- .../files/config/setup-service-addresses.sh | 34 +++++++++++++++++-- .../templates/eth/eth-beacon.yaml | 5 +-- .../templates/eth/eth-execution.yaml | 1 + spartan/aztec-network/values.yaml | 2 -- 4 files changed, 33 insertions(+), 9 deletions(-) diff --git a/spartan/aztec-network/files/config/setup-service-addresses.sh b/spartan/aztec-network/files/config/setup-service-addresses.sh index 83118f1bf2b..809fb760179 100644 --- a/spartan/aztec-network/files/config/setup-service-addresses.sh +++ b/spartan/aztec-network/files/config/setup-service-addresses.sh @@ -2,8 +2,36 @@ set -ex +# Get load balancer IP for service +function get_load_balancer_ip() { + local SERVICE_LABEL=$1 + local PORT=$2 + local MAX_RETRIES=30 + local RETRY_INTERVAL=2 + local attempt=1 + + # Check load balancer exists for service + while [ $attempt -le $MAX_RETRIES ]; do + LOAD_BALANCER_IP=$(kubectl get svc -n ${NAMESPACE} -l app=${SERVICE_LABEL} -o jsonpath='{.items[0].status.loadBalancer.ingress[0].ip}') + if [ -n "$LOAD_BALANCER_IP" ]; then + break + fi + echo "Attempt $attempt: Waiting for ${SERVICE_LABEL} load balancer to be available..." >&2 + sleep $RETRY_INTERVAL + attempt=$((attempt + 1)) + done + + if [ -z "$LOAD_BALANCER_IP" ]; then + echo "Error: Failed to get load balancer IP after $MAX_RETRIES attempts" >&2 + return 1 + fi + + echo "Load balancer IP: ${LOAD_BALANCER_IP}" >&2 + echo "http://${LOAD_BALANCER_IP}:${PORT}" +} + # Function to get pod and node details -get_service_address() { +function get_service_address() { local SERVICE_LABEL=$1 local PORT=$2 local MAX_RETRIES=30 @@ -56,7 +84,7 @@ get_service_address() { if [ "${EXTERNAL_ETHEREUM_HOST}" != "" ]; then ETHEREUM_ADDR="${EXTERNAL_ETHEREUM_HOST}" elif [ "${NETWORK_PUBLIC}" = "true" ]; then - ETHEREUM_ADDR=$(get_service_address "eth-execution" "${ETHEREUM_PORT}") + ETHEREUM_ADDR=$(get_load_balancer_ip "eth-execution" "${ETHEREUM_PORT}") else ETHEREUM_ADDR="http://${SERVICE_NAME}-eth-execution.${NAMESPACE}:${ETHEREUM_PORT}" fi @@ -65,7 +93,7 @@ fi if [ "${EXTERNAL_ETHEREUM_CONSENSUS_HOST}" != "" ]; then ETHEREUM_CONSENSUS_ADDR="${EXTERNAL_ETHEREUM_CONSENSUS_HOST}" elif [ "${NETWORK_PUBLIC}" = "true" ]; then - ETHEREUM_CONSENSUS_ADDR=$(get_service_address "eth-beacon" "${ETHEREUM_CONSENSUS_PORT}") + ETHEREUM_CONSENSUS_ADDR=$(get_load_balancer_ip "eth-beacon" "${ETHEREUM_CONSENSUS_PORT}") else ETHEREUM_CONSENSUS_ADDR="http://${SERVICE_NAME}-eth-beacon.${NAMESPACE}:${ETHEREUM_CONSENSUS_PORT}" fi diff --git a/spartan/aztec-network/templates/eth/eth-beacon.yaml b/spartan/aztec-network/templates/eth/eth-beacon.yaml index 2d1b8f31f76..4e5459d9f76 100644 --- a/spartan/aztec-network/templates/eth/eth-beacon.yaml +++ b/spartan/aztec-network/templates/eth/eth-beacon.yaml @@ -61,6 +61,7 @@ metadata: name: {{ include "aztec-network.fullname" . }}-eth-beacon labels: {{- include "aztec-network.labels" . | nindent 4 }} + app: eth-beacon spec: {{- if .Values.network.public}} type: LoadBalancer @@ -74,10 +75,6 @@ spec: - protocol: TCP port: {{ .Values.ethereum.beacon.service.port }} targetPort: {{ .Values.ethereum.beacon.service.targetPort }} - {{- if and (eq .Values.ethereum.beacon.service.type "NodePort") .Values.ethereum.beacon.service.nodePort }} - nodePort: {{ .Values.ethereum.beacon.service.nodePort }} - {{- end }} ---- apiVersion: v1 kind: ConfigMap metadata: diff --git a/spartan/aztec-network/templates/eth/eth-execution.yaml b/spartan/aztec-network/templates/eth/eth-execution.yaml index 6c4e475936b..83dcf7a3f41 100644 --- a/spartan/aztec-network/templates/eth/eth-execution.yaml +++ b/spartan/aztec-network/templates/eth/eth-execution.yaml @@ -65,6 +65,7 @@ metadata: name: {{ include "aztec-network.fullname" . }}-eth-execution labels: {{- include "aztec-network.labels" . | nindent 4 }} + app: eth-execution spec: {{- if .Values.network.public }} type: LoadBalancer diff --git a/spartan/aztec-network/values.yaml b/spartan/aztec-network/values.yaml index c660769756f..2748786292c 100644 --- a/spartan/aztec-network/values.yaml +++ b/spartan/aztec-network/values.yaml @@ -233,7 +233,6 @@ ethereum: service: port: 8545 targetPort: 8545 - nodePort: "" resources: requests: memory: "4Gi" @@ -243,7 +242,6 @@ ethereum: service: port: 5052 targetPort: 5052 - nodePort: "" resources: requests: memory: "4Gi" From db4e90897d27ce3f2a5cc2085aa91a6556acbea4 Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Wed, 29 Jan 2025 20:31:39 +0000 Subject: [PATCH 3/4] chore: give all svc's label names --- spartan/aztec-network/templates/boot-node.yaml | 1 + spartan/aztec-network/templates/faucet.yaml | 1 + spartan/aztec-network/templates/prover-broker.yaml | 1 + spartan/aztec-network/templates/prover-node.yaml | 1 + spartan/aztec-network/templates/pxe.yaml | 1 + spartan/aztec-network/templates/transaction-bot.yaml | 1 + spartan/aztec-network/templates/validator.yaml | 1 + 7 files changed, 7 insertions(+) diff --git a/spartan/aztec-network/templates/boot-node.yaml b/spartan/aztec-network/templates/boot-node.yaml index d0d470019ae..18ff5d46bce 100644 --- a/spartan/aztec-network/templates/boot-node.yaml +++ b/spartan/aztec-network/templates/boot-node.yaml @@ -279,6 +279,7 @@ metadata: name: {{ include "aztec-network.fullname" . }}-boot-node labels: {{- include "aztec-network.labels" . | nindent 4 }} + app: boot-node spec: # If this is a public network, we want to expose the boot node as a LoadBalancer {{- if .Values.network.public }} diff --git a/spartan/aztec-network/templates/faucet.yaml b/spartan/aztec-network/templates/faucet.yaml index 0f93712e975..d895fa382ca 100644 --- a/spartan/aztec-network/templates/faucet.yaml +++ b/spartan/aztec-network/templates/faucet.yaml @@ -101,6 +101,7 @@ metadata: name: {{ include "aztec-network.fullname" . }}-faucet labels: {{- include "aztec-network.labels" . | nindent 4 }} + app: faucet spec: type: ClusterIP selector: diff --git a/spartan/aztec-network/templates/prover-broker.yaml b/spartan/aztec-network/templates/prover-broker.yaml index 070e0de0e6c..3c2036b43f4 100644 --- a/spartan/aztec-network/templates/prover-broker.yaml +++ b/spartan/aztec-network/templates/prover-broker.yaml @@ -135,6 +135,7 @@ metadata: name: {{ include "aztec-network.fullname" . }}-prover-broker labels: {{- include "aztec-network.labels" . | nindent 4 }} + app: prover-broker spec: type: ClusterIP selector: diff --git a/spartan/aztec-network/templates/prover-node.yaml b/spartan/aztec-network/templates/prover-node.yaml index a0375a001d1..79a8f271223 100644 --- a/spartan/aztec-network/templates/prover-node.yaml +++ b/spartan/aztec-network/templates/prover-node.yaml @@ -225,6 +225,7 @@ metadata: name: {{ include "aztec-network.fullname" . }}-prover-node labels: {{- include "aztec-network.labels" . | nindent 4 }} + app: prover-node spec: type: ClusterIP selector: diff --git a/spartan/aztec-network/templates/pxe.yaml b/spartan/aztec-network/templates/pxe.yaml index 22d2e07a343..3ea226059ae 100644 --- a/spartan/aztec-network/templates/pxe.yaml +++ b/spartan/aztec-network/templates/pxe.yaml @@ -134,6 +134,7 @@ metadata: name: {{ include "aztec-network.fullname" . }}-pxe labels: {{- include "aztec-network.labels" . | nindent 4 }} + app: pxe spec: type: ClusterIP selector: diff --git a/spartan/aztec-network/templates/transaction-bot.yaml b/spartan/aztec-network/templates/transaction-bot.yaml index ccfaad522b5..81c3c71b63f 100644 --- a/spartan/aztec-network/templates/transaction-bot.yaml +++ b/spartan/aztec-network/templates/transaction-bot.yaml @@ -150,6 +150,7 @@ metadata: name: {{ include "aztec-network.fullname" . }}-bot labels: {{- include "aztec-network.labels" . | nindent 4 }} + app: bot spec: type: {{ .Values.bot.service.type }} selector: diff --git a/spartan/aztec-network/templates/validator.yaml b/spartan/aztec-network/templates/validator.yaml index 802051f2c4f..cd056038828 100644 --- a/spartan/aztec-network/templates/validator.yaml +++ b/spartan/aztec-network/templates/validator.yaml @@ -254,6 +254,7 @@ metadata: name: {{ include "aztec-network.fullname" . }}-validator labels: {{- include "aztec-network.labels" . | nindent 4 }} + app: validator spec: clusterIP: None selector: From a2543b59b61b339172ad09e429a085c777daf65a Mon Sep 17 00:00:00 2001 From: Maddiaa0 <47148561+Maddiaa0@users.noreply.github.com> Date: Fri, 7 Feb 2025 16:44:05 +0000 Subject: [PATCH 4/4] fix --- spartan/aztec-network/templates/eth/eth-beacon.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/spartan/aztec-network/templates/eth/eth-beacon.yaml b/spartan/aztec-network/templates/eth/eth-beacon.yaml index aea59691970..b542cf41977 100644 --- a/spartan/aztec-network/templates/eth/eth-beacon.yaml +++ b/spartan/aztec-network/templates/eth/eth-beacon.yaml @@ -79,6 +79,7 @@ spec: - protocol: TCP port: {{ .Values.ethereum.beacon.service.port }} targetPort: {{ .Values.ethereum.beacon.service.targetPort }} +--- apiVersion: v1 kind: ConfigMap metadata: