Skip to content

Commit d69ab88

Browse files
authored
chore: deploy internal p2p bootnodes first (#24220)
.
2 parents a7ccbfe + 881f225 commit d69ab88

4 files changed

Lines changed: 83 additions & 27 deletions

File tree

spartan/aztec-node/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ metadata:
77
{{- include "chart.labels" . | nindent 4 }}
88
spec:
99
replicas: {{ .Values.replicaCount }}
10+
{{ with .Values.deploymentStrategy }}
11+
strategy:
12+
{{- toYaml . | nindent 4 }}
13+
{{ end }}
1014
selector:
1115
matchLabels:
1216
{{- include "chart.selectorLabels" . | nindent 6 }}

spartan/aztec-node/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ hostNetwork: false
5151
# -- Number of replicas
5252
replicaCount: 1
5353

54+
# -- Deployment strategy. Only used when statefulSet.enabled is false.
55+
deploymentStrategy: {}
56+
5457
statefulSet:
5558
enabled: false
5659
volumeClaimTemplates: []

spartan/terraform/deploy-aztec-infra/main.tf

Lines changed: 73 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,34 @@ locals {
308308
})
309309
} : {}
310310

311-
# Define all releases in a map
311+
p2p_bootstrap_release = {
312+
name = "${var.RELEASE_PREFIX}-p2p-bootstrap"
313+
chart = "aztec-node"
314+
values = [
315+
"common.yaml",
316+
"p2p-bootstrap.yaml",
317+
"p2p-bootstrap-resources-${var.P2P_BOOTSTRAP_RESOURCE_PROFILE}.yaml"
318+
]
319+
inline_values = [yamlencode({
320+
service = {
321+
p2p = { publicIP = var.P2P_PUBLIC_IP }
322+
}
323+
})]
324+
custom_settings = {
325+
"nodeType" = "p2p-bootstrap"
326+
"service.p2p.nodePortEnabled" = var.P2P_NODEPORT_ENABLED
327+
"service.p2p.hostPortEnabled" = var.P2P_HOSTPORT_ENABLED
328+
"service.p2p.announcePort" = local.p2p_port_p2p_bootstrap
329+
"service.p2p.port" = local.p2p_port_p2p_bootstrap
330+
"node.env.P2P_MAX_PENDING_TX_COUNT" = var.P2P_MAX_PENDING_TX_COUNT
331+
}
332+
boot_node_host_path = ""
333+
bootstrap_nodes_path = ""
334+
wait = true
335+
}
336+
337+
# Define all non-bootstrap releases in a map. The p2p bootstrap release is
338+
# applied first so nodes cannot fetch an ENR from an old bootstrap pod.
312339
helm_releases = merge({
313340
snapshot = var.STORE_SNAPSHOT_URL != null ? {
314341
name = "${var.RELEASE_PREFIX}-snapshot"
@@ -325,32 +352,6 @@ locals {
325352
wait = true
326353
} : null
327354

328-
p2p_bootstrap = var.DEPLOY_INTERNAL_BOOTNODE ? {
329-
name = "${var.RELEASE_PREFIX}-p2p-bootstrap"
330-
chart = "aztec-node"
331-
values = [
332-
"common.yaml",
333-
"p2p-bootstrap.yaml",
334-
"p2p-bootstrap-resources-${var.P2P_BOOTSTRAP_RESOURCE_PROFILE}.yaml"
335-
]
336-
inline_values = [yamlencode({
337-
service = {
338-
p2p = { publicIP = var.P2P_PUBLIC_IP }
339-
}
340-
})]
341-
custom_settings = {
342-
"nodeType" = "p2p-bootstrap"
343-
"service.p2p.nodePortEnabled" = var.P2P_NODEPORT_ENABLED
344-
"service.p2p.hostPortEnabled" = var.P2P_HOSTPORT_ENABLED
345-
"service.p2p.announcePort" = local.p2p_port_p2p_bootstrap
346-
"service.p2p.port" = local.p2p_port_p2p_bootstrap
347-
"node.env.P2P_MAX_PENDING_TX_COUNT" = var.P2P_MAX_PENDING_TX_COUNT
348-
}
349-
boot_node_host_path = ""
350-
bootstrap_nodes_path = ""
351-
wait = true
352-
} : null
353-
354355
prover = var.PROVER_ENABLED ? {
355356
name = "${var.RELEASE_PREFIX}-prover"
356357
chart = "aztec-prover-stack"
@@ -677,6 +678,49 @@ locals {
677678
}, local.validator_releases)
678679
}
679680

681+
resource "helm_release" "p2p_bootstrap" {
682+
count = var.DEPLOY_INTERNAL_BOOTNODE ? 1 : 0
683+
684+
provider = helm.gke-cluster
685+
name = local.p2p_bootstrap_release.name
686+
repository = "../../"
687+
chart = local.p2p_bootstrap_release.chart
688+
namespace = var.NAMESPACE
689+
create_namespace = true
690+
upgrade_install = true
691+
force_update = true
692+
recreate_pods = true
693+
reuse_values = false
694+
timeout = lookup(local.p2p_bootstrap_release, "timeout", 600)
695+
wait = local.p2p_bootstrap_release.wait
696+
wait_for_jobs = true
697+
698+
values = concat(
699+
[for v in local.p2p_bootstrap_release.values : file("./values/${v}")],
700+
[local.common_inline_values],
701+
lookup(local.p2p_bootstrap_release, "inline_values", [])
702+
)
703+
704+
dynamic "set" {
705+
for_each = { for k, v in merge(
706+
local.common_settings,
707+
local.p2p_bootstrap_release.custom_settings
708+
) : k => v if v != null }
709+
content {
710+
name = set.key
711+
value = set.value
712+
}
713+
}
714+
715+
dynamic "set_list" {
716+
for_each = { for k, v in local.common_list_settings : k => v if v != null }
717+
content {
718+
name = set_list.key
719+
value = set_list.value
720+
}
721+
}
722+
}
723+
680724
# Create all helm releases using for_each
681725
resource "helm_release" "releases" {
682726
for_each = { for k, v in local.helm_releases : k => v if v != null }
@@ -694,6 +738,8 @@ resource "helm_release" "releases" {
694738
timeout = lookup(each.value, "timeout", 600)
695739
wait = each.value.wait
696740
wait_for_jobs = true
741+
# Safe for networks without an internal bootnode: helm_release.p2p_bootstrap has count 0.
742+
depends_on = [helm_release.p2p_bootstrap]
697743

698744
values = concat(
699745
[for v in each.value.values : file("./values/${v}")],

spartan/terraform/deploy-aztec-infra/values/p2p-bootstrap.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ nameOverride: "node"
22

33
replicaCount: 1
44

5+
deploymentStrategy:
6+
type: Recreate
7+
58
podDisruptionBudget:
69
enabled: true
710
minAvailable: 1

0 commit comments

Comments
 (0)