From 9d248a24091cfbf1c4d09b49227136883e6118f0 Mon Sep 17 00:00:00 2001 From: "Steven Platt, PhD" <31355889+stevenplatt@users.noreply.github.com> Date: Tue, 24 Sep 2024 16:16:00 -0400 Subject: [PATCH] chore: consolidate aztec node configurations (helm refactor) (#8731) This PR performs a refactor of the `aztec-network` helm chart. The primary focus of the refactor is to condense configurations relating to each node, into a single file. A portion of the yaml files were condensed in this way previously, but the format had not been consistent across the helm chart. --- .../templates/anvil.service.yaml | 18 --------- .../{anvil.deployment.yaml => anvil.yaml} | 21 +++++++++- .../templates/boot-node.service.yaml | 16 -------- ...-node.stateful-set.yaml => boot-node.yaml} | 17 ++++++++ .../templates/deploy-l2-contracts.job.yaml | 38 ------------------ ...acts.config-map.yaml => l2-contracts.yaml} | 39 +++++++++++++++++++ .../templates/prover-node.service.yaml | 14 ------- ...ode.stateful-set.yaml => prover-node.yaml} | 15 +++++++ .../aztec-network/templates/pxe.service.yaml | 18 --------- .../{pxe.deployment.yaml => pxe.yaml} | 21 +++++++++- .../templates/validator.service.yaml | 16 -------- ...dator.stateful-set.yaml => validator.yaml} | 17 ++++++++ 12 files changed, 128 insertions(+), 122 deletions(-) delete mode 100644 spartan/aztec-network/templates/anvil.service.yaml rename spartan/aztec-network/templates/{anvil.deployment.yaml => anvil.yaml} (78%) delete mode 100644 spartan/aztec-network/templates/boot-node.service.yaml rename spartan/aztec-network/templates/{boot-node.stateful-set.yaml => boot-node.yaml} (92%) delete mode 100644 spartan/aztec-network/templates/deploy-l2-contracts.job.yaml rename spartan/aztec-network/templates/{deploy-contracts.config-map.yaml => l2-contracts.yaml} (53%) delete mode 100644 spartan/aztec-network/templates/prover-node.service.yaml rename spartan/aztec-network/templates/{prover-node.stateful-set.yaml => prover-node.yaml} (91%) delete mode 100644 spartan/aztec-network/templates/pxe.service.yaml rename spartan/aztec-network/templates/{pxe.deployment.yaml => pxe.yaml} (77%) delete mode 100644 spartan/aztec-network/templates/validator.service.yaml rename spartan/aztec-network/templates/{validator.stateful-set.yaml => validator.yaml} (91%) diff --git a/spartan/aztec-network/templates/anvil.service.yaml b/spartan/aztec-network/templates/anvil.service.yaml deleted file mode 100644 index c0eca3456c7..00000000000 --- a/spartan/aztec-network/templates/anvil.service.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "aztec-network.fullname" . }}-ethereum - labels: - {{- include "aztec-network.labels" . | nindent 4 }} -spec: - type: {{ .Values.ethereum.service.type }} - selector: - {{- include "aztec-network.selectorLabels" . | nindent 4 }} - app: ethereum - ports: - - protocol: TCP - port: {{ .Values.ethereum.service.port }} - targetPort: {{ .Values.ethereum.service.targetPort }} - {{- if and (eq .Values.ethereum.service.type "NodePort") .Values.ethereum.service.nodePort }} - nodePort: {{ .Values.ethereum.service.nodePort }} - {{- end }} \ No newline at end of file diff --git a/spartan/aztec-network/templates/anvil.deployment.yaml b/spartan/aztec-network/templates/anvil.yaml similarity index 78% rename from spartan/aztec-network/templates/anvil.deployment.yaml rename to spartan/aztec-network/templates/anvil.yaml index 3894ee5607e..a45c52d58b5 100644 --- a/spartan/aztec-network/templates/anvil.deployment.yaml +++ b/spartan/aztec-network/templates/anvil.yaml @@ -50,4 +50,23 @@ spec: successThreshold: {{ .Values.ethereum.readinessProbe.successThreshold }} failureThreshold: {{ .Values.ethereum.readinessProbe.failureThreshold }} resources: - {{- toYaml .Values.ethereum.resources | nindent 12 }} \ No newline at end of file + {{- toYaml .Values.ethereum.resources | nindent 12 }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "aztec-network.fullname" . }}-ethereum + labels: + {{- include "aztec-network.labels" . | nindent 4 }} +spec: + type: {{ .Values.ethereum.service.type }} + selector: + {{- include "aztec-network.selectorLabels" . | nindent 4 }} + app: ethereum + ports: + - protocol: TCP + port: {{ .Values.ethereum.service.port }} + targetPort: {{ .Values.ethereum.service.targetPort }} + {{- if and (eq .Values.ethereum.service.type "NodePort") .Values.ethereum.service.nodePort }} + nodePort: {{ .Values.ethereum.service.nodePort }} + {{- end }} \ No newline at end of file diff --git a/spartan/aztec-network/templates/boot-node.service.yaml b/spartan/aztec-network/templates/boot-node.service.yaml deleted file mode 100644 index ccaf38c0c06..00000000000 --- a/spartan/aztec-network/templates/boot-node.service.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "aztec-network.fullname" . }}-boot-node - labels: - {{- include "aztec-network.labels" . | nindent 4 }} -spec: - clusterIP: None - selector: - {{- include "aztec-network.selectorLabels" . | nindent 4 }} - app: boot-node - ports: - - port: {{ .Values.bootNode.service.p2pPort }} - name: p2p - - port: {{ .Values.bootNode.service.nodePort }} - name: node \ No newline at end of file diff --git a/spartan/aztec-network/templates/boot-node.stateful-set.yaml b/spartan/aztec-network/templates/boot-node.yaml similarity index 92% rename from spartan/aztec-network/templates/boot-node.stateful-set.yaml rename to spartan/aztec-network/templates/boot-node.yaml index d40c9969f2b..779d90ee86f 100644 --- a/spartan/aztec-network/templates/boot-node.stateful-set.yaml +++ b/spartan/aztec-network/templates/boot-node.yaml @@ -128,3 +128,20 @@ spec: - name: scripts configMap: name: {{ include "aztec-network.fullname" . }}-deploy-contracts-script +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "aztec-network.fullname" . }}-boot-node + labels: + {{- include "aztec-network.labels" . | nindent 4 }} +spec: + clusterIP: None + selector: + {{- include "aztec-network.selectorLabels" . | nindent 4 }} + app: boot-node + ports: + - port: {{ .Values.bootNode.service.p2pPort }} + name: p2p + - port: {{ .Values.bootNode.service.nodePort }} + name: node \ No newline at end of file diff --git a/spartan/aztec-network/templates/deploy-l2-contracts.job.yaml b/spartan/aztec-network/templates/deploy-l2-contracts.job.yaml deleted file mode 100644 index aeb84cc4eae..00000000000 --- a/spartan/aztec-network/templates/deploy-l2-contracts.job.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ include "aztec-network.fullname" . }}-deploy-l2-contracts - labels: - {{- include "aztec-network.labels" . | nindent 4 }} -spec: - template: - metadata: - labels: - {{- include "aztec-network.selectorLabels" . | nindent 8 }} - app: deploy-l2-contracts - spec: - restartPolicy: OnFailure - containers: - - name: deploy-l2-contracts - image: {{ .Values.images.aztec.image }} - command: - - /bin/bash - - -c - - | - until curl -s -X POST -H 'content-type: application/json' \ - -d '{"jsonrpc":"2.0","method":"pxe_getNodeInfo","params":[],"id":67}' \ - {{ include "aztec-network.pxeUrl" . }} | grep -q '"enr:-'; do - echo "Waiting for PXE service..." - sleep 5 - done - echo "PXE service is ready!" - set -e - node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-protocol-contracts - echo "Deployed L2 contracts" - env: - - name: PXE_URL - value: {{ include "aztec-network.pxeUrl" . | quote }} - - name: DEBUG - value: "aztec:*" - - name: LOG_LEVEL - value: "debug" diff --git a/spartan/aztec-network/templates/deploy-contracts.config-map.yaml b/spartan/aztec-network/templates/l2-contracts.yaml similarity index 53% rename from spartan/aztec-network/templates/deploy-contracts.config-map.yaml rename to spartan/aztec-network/templates/l2-contracts.yaml index 7191a38b78f..d4ba521e985 100644 --- a/spartan/aztec-network/templates/deploy-contracts.config-map.yaml +++ b/spartan/aztec-network/templates/l2-contracts.yaml @@ -1,3 +1,42 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ include "aztec-network.fullname" . }}-deploy-l2-contracts + labels: + {{- include "aztec-network.labels" . | nindent 4 }} +spec: + template: + metadata: + labels: + {{- include "aztec-network.selectorLabels" . | nindent 8 }} + app: deploy-l2-contracts + spec: + restartPolicy: OnFailure + containers: + - name: deploy-l2-contracts + image: {{ .Values.images.aztec.image }} + command: + - /bin/bash + - -c + - | + until curl -s -X POST -H 'content-type: application/json' \ + -d '{"jsonrpc":"2.0","method":"pxe_getNodeInfo","params":[],"id":67}' \ + {{ include "aztec-network.pxeUrl" . }} | grep -q '"enr:-'; do + echo "Waiting for PXE service..." + sleep 5 + done + echo "PXE service is ready!" + set -e + node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js deploy-protocol-contracts + echo "Deployed L2 contracts" + env: + - name: PXE_URL + value: {{ include "aztec-network.pxeUrl" . | quote }} + - name: DEBUG + value: "aztec:*" + - name: LOG_LEVEL + value: "debug" +--- apiVersion: v1 kind: ConfigMap metadata: diff --git a/spartan/aztec-network/templates/prover-node.service.yaml b/spartan/aztec-network/templates/prover-node.service.yaml deleted file mode 100644 index 1d20ba7cd3e..00000000000 --- a/spartan/aztec-network/templates/prover-node.service.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "aztec-network.fullname" . }}-prover-node - labels: - {{- include "aztec-network.labels" . | nindent 4 }} -spec: - clusterIP: None - selector: - {{- include "aztec-network.selectorLabels" . | nindent 4 }} - app: prover-node - ports: - - port: {{ .Values.proverNode.service.nodePort }} - name: node \ No newline at end of file diff --git a/spartan/aztec-network/templates/prover-node.stateful-set.yaml b/spartan/aztec-network/templates/prover-node.yaml similarity index 91% rename from spartan/aztec-network/templates/prover-node.stateful-set.yaml rename to spartan/aztec-network/templates/prover-node.yaml index cee694e36b2..13cb4762719 100644 --- a/spartan/aztec-network/templates/prover-node.stateful-set.yaml +++ b/spartan/aztec-network/templates/prover-node.yaml @@ -98,3 +98,18 @@ metadata: data: configure-prover-env.sh: | {{ .Files.Get "files/config/config-prover-env.sh" | nindent 4 }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "aztec-network.fullname" . }}-prover-node + labels: + {{- include "aztec-network.labels" . | nindent 4 }} +spec: + clusterIP: None + selector: + {{- include "aztec-network.selectorLabels" . | nindent 4 }} + app: prover-node + ports: + - port: {{ .Values.proverNode.service.nodePort }} + name: node \ No newline at end of file diff --git a/spartan/aztec-network/templates/pxe.service.yaml b/spartan/aztec-network/templates/pxe.service.yaml deleted file mode 100644 index 09e5d2c6db3..00000000000 --- a/spartan/aztec-network/templates/pxe.service.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "aztec-network.fullname" . }}-pxe - labels: - {{- include "aztec-network.labels" . | nindent 4 }} -spec: - type: {{ .Values.pxe.service.type }} - selector: - {{- include "aztec-network.selectorLabels" . | nindent 4 }} - app: pxe - ports: - - protocol: TCP - port: {{ .Values.pxe.service.port }} - targetPort: {{ .Values.pxe.service.targetPort }} - {{- if and (eq .Values.pxe.service.type "NodePort") .Values.pxe.service.nodePort }} - nodePort: {{ .Values.pxe.service.nodePort }} - {{- end }} \ No newline at end of file diff --git a/spartan/aztec-network/templates/pxe.deployment.yaml b/spartan/aztec-network/templates/pxe.yaml similarity index 77% rename from spartan/aztec-network/templates/pxe.deployment.yaml rename to spartan/aztec-network/templates/pxe.yaml index f664837fbd1..709a0a190e3 100644 --- a/spartan/aztec-network/templates/pxe.deployment.yaml +++ b/spartan/aztec-network/templates/pxe.yaml @@ -56,4 +56,23 @@ spec: successThreshold: {{ .Values.pxe.readinessProbe.successThreshold }} failureThreshold: {{ .Values.pxe.readinessProbe.failureThreshold }} resources: - {{- toYaml .Values.pxe.resources | nindent 12 }} \ No newline at end of file + {{- toYaml .Values.pxe.resources | nindent 12 }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "aztec-network.fullname" . }}-pxe + labels: + {{- include "aztec-network.labels" . | nindent 4 }} +spec: + type: {{ .Values.pxe.service.type }} + selector: + {{- include "aztec-network.selectorLabels" . | nindent 4 }} + app: pxe + ports: + - protocol: TCP + port: {{ .Values.pxe.service.port }} + targetPort: {{ .Values.pxe.service.targetPort }} + {{- if and (eq .Values.pxe.service.type "NodePort") .Values.pxe.service.nodePort }} + nodePort: {{ .Values.pxe.service.nodePort }} + {{- end }} \ No newline at end of file diff --git a/spartan/aztec-network/templates/validator.service.yaml b/spartan/aztec-network/templates/validator.service.yaml deleted file mode 100644 index 0a49e7d4e6b..00000000000 --- a/spartan/aztec-network/templates/validator.service.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "aztec-network.fullname" . }}-validator - labels: - {{- include "aztec-network.labels" . | nindent 4 }} -spec: - clusterIP: None - selector: - {{- include "aztec-network.selectorLabels" . | nindent 4 }} - app: validator - ports: - - port: {{ .Values.validator.service.p2pPort }} - name: p2p - - port: {{ .Values.validator.service.nodePort }} - name: node \ No newline at end of file diff --git a/spartan/aztec-network/templates/validator.stateful-set.yaml b/spartan/aztec-network/templates/validator.yaml similarity index 91% rename from spartan/aztec-network/templates/validator.stateful-set.yaml rename to spartan/aztec-network/templates/validator.yaml index 864b42daae9..d6de0f2d5f4 100644 --- a/spartan/aztec-network/templates/validator.stateful-set.yaml +++ b/spartan/aztec-network/templates/validator.yaml @@ -107,3 +107,20 @@ metadata: data: configure-validator-env.sh: | {{ .Files.Get "files/config/config-validator-env.sh" | nindent 4 }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "aztec-network.fullname" . }}-validator + labels: + {{- include "aztec-network.labels" . | nindent 4 }} +spec: + clusterIP: None + selector: + {{- include "aztec-network.selectorLabels" . | nindent 4 }} + app: validator + ports: + - port: {{ .Values.validator.service.p2pPort }} + name: p2p + - port: {{ .Values.validator.service.nodePort }} + name: node \ No newline at end of file