-
Notifications
You must be signed in to change notification settings - Fork 327
/
Copy pathboot-node.yaml
323 lines (319 loc) · 12 KB
/
boot-node.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
{{- if .Values.bootNode.enabled }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "aztec-network.fullname" . }}-boot-node
labels:
{{- include "aztec-network.labels" . | nindent 4 }}
spec:
serviceName: {{ include "aztec-network.fullname" . }}-boot-node
replicas: {{ .Values.bootNode.replicas }}
selector:
matchLabels:
{{- include "aztec-network.selectorLabels" . | nindent 6 }}
app: boot-node
{{- if not .Values.storage.localSsd }}
volumeClaimTemplates:
- metadata:
name: boot-node-data
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: {{ .Values.bootNode.storageSize }}
{{- end }}
template:
metadata:
labels:
{{- include "aztec-network.selectorLabels" . | nindent 8 }}
app: boot-node
spec:
{{- if .Values.network.gke }}
nodeSelector:
local-ssd: "{{ .Values.storage.localSsd }}"
node-type: network
{{- end }}
dnsPolicy: ClusterFirstWithHostNet
{{- if .Values.network.public }}
hostNetwork: true
serviceAccountName: {{ include "aztec-network.fullname" . }}-node
{{- include "aztec-network.publicAntiAffinity" . | nindent 6 }}
{{- end }}
terminationGracePeriodSeconds: 5 # default is 30 - speed up initcontainer termination
initContainers:
{{- include "aztec-network.combinedAllSetupContainer" . | nindent 8 }}
# Generate the validator addresses; used in the deploy-l1-contracts step
- name: generate-validator-addresses
image: {{ .Values.images.foundry.image }}
imagePullPolicy: {{ .Values.images.foundry.pullPolicy }}
command:
- /bin/sh
- -c
- |
source /scripts/get-validator-addresses.sh
volumeMounts:
- name: scripts
mountPath: /scripts
- name: config
mountPath: /shared/config
env:
- name: KEY_INDEX_START
value: {{ .Values.aztec.validatorKeyIndexStart | quote }}
- name: MNEMONIC
value: {{ .Values.aztec.l1DeploymentMnemonic }}
- name: NUMBER_OF_VALIDATORS
value: {{ .Values.validator.replicas | quote }}
- name: deploy-l1-contracts
{{- include "aztec-network.image" . | nindent 10 }}
command:
- /bin/bash
- -c
- |
source /shared/config/service-addresses
source /shared/config/validator-addresses
{{- include "aztec-network.waitForEthereum" . | nindent 14 }}
/scripts/deploy-l1-contracts.sh "{{ .Values.aztec.l1Salt }}" "{{ .Values.ethereum.chainId }}" "$VALIDATOR_ADDRESSES"
volumeMounts:
- name: scripts-output
mountPath: /shared/contracts
- name: config
mountPath: /shared/config
- name: scripts
mountPath: /scripts
env:
- name: ACCELERATED_TEST_DEPLOYMENTS
value: "{{ .Values.ethereum.acceleratedTestDeployments }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
- name: REGISTRY_CONTRACT_ADDRESS
value: "{{ .Values.bootNode.contracts.registryAddress }}"
- name: TELEMETRY
value: "{{ .Values.telemetry.enabled }}"
- name: INIT_VALIDATORS
value: "true"
- name: MNEMONIC
value: "{{ .Values.aztec.l1DeploymentMnemonic }}"
- name: L1_DEPLOYMENT_PRIVATE_KEY
value: "{{ .Values.ethereum.deployL1ContractsPrivateKey }}"
- name: ETHEREUM_SLOT_DURATION
value: "{{ .Values.ethereum.blockTime }}"
- name: AZTEC_SLOT_DURATION
value: "{{ .Values.aztec.slotDuration }}"
- name: AZTEC_EPOCH_DURATION
value: "{{ .Values.aztec.epochDuration }}"
- name: AZTEC_PROOF_SUBMISSION_WINDOW
value: "{{ .Values.aztec.proofSubmissionWindow }}"
- name: L1_GAS_PRICE_MAX
value: "{{ .Values.ethereum.l1GasPriceMax }}"
- name: L1_FIXED_PRIORITY_FEE_PER_GAS
value: "{{ .Values.ethereum.l1FixedPriorityFeePerGas }}"
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: K8S_NAMESPACE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: USE_GCLOUD_LOGGING
value: "{{ .Values.telemetry.useGcloudLogging }}"
containers:
- name: boot-node
{{- include "aztec-network.image" . | nindent 10 }}
command:
- /bin/bash
- -c
- |
source /shared/contracts/contracts.env && \
source /shared/config/p2p-addresses && \
source /shared/config/service-addresses && \
source /shared/config/otel-resource && \
env && \
node --no-warnings /usr/src/yarn-project/aztec/dest/bin/index.js start --node --archiver --sequencer --pxe
startupProbe:
httpGet:
path: /status
port: {{ .Values.bootNode.service.nodePort }}
periodSeconds: {{ .Values.bootNode.startupProbe.periodSeconds }}
failureThreshold: {{ .Values.bootNode.startupProbe.failureThreshold }}
livenessProbe:
httpGet:
path: /status
port: {{ .Values.bootNode.service.nodePort }}
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 30
failureThreshold: 3
volumeMounts:
- name: config
mountPath: /shared/config
- name: boot-node-data
mountPath: {{ .Values.bootNode.dataDir }}
- name: scripts-output
mountPath: /shared/contracts
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: K8S_POD_UID
valueFrom:
fieldRef:
fieldPath: metadata.uid
- name: K8S_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: K8S_NAMESPACE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: NODE_OPTIONS
value: "--max-old-space-size={{ .Values.bootNode.maxOldSpaceSize}}"
- name: AZTEC_PORT
value: "{{ .Values.bootNode.service.nodePort }}"
- name: LOG_LEVEL
value: "{{ .Values.bootNode.logLevel }}"
- name: LOG_JSON
value: "1"
- name: P2P_ENABLED
value: "{{ .Values.bootNode.p2p.enabled }}"
- name: P2P_GOSSIPSUB_FLOOD_PUBLISH
value: "{{ .Values.bootNode.p2p.floodPublish }}"
- name: COINBASE
value: "{{ .Values.bootNode.coinbaseAddress }}"
- name: VALIDATOR_DISABLED
value: "true"
- name: L1_CHAIN_ID
value: "{{ .Values.ethereum.chainId }}"
- name: PROVER_REAL_PROOFS
value: "{{ .Values.aztec.realProofs }}"
- name: PXE_PROVER_ENABLED
value: "{{ .Values.aztec.realProofs }}"
- name: ETHEREUM_SLOT_DURATION
value: "{{ .Values.ethereum.blockTime }}"
- name: AZTEC_SLOT_DURATION
value: "{{ .Values.aztec.slotDuration }}"
- name: AZTEC_EPOCH_DURATION
value: "{{ .Values.aztec.epochDuration }}"
- name: AZTEC_PROOF_SUBMISSION_WINDOW
value: "{{ .Values.aztec.proofSubmissionWindow }}"
- name: ARCHIVER_POLLING_INTERVAL_MS
value: {{ .Values.bootNode.archiverPollingInterval | quote }}
- name: ARCHIVER_VIEM_POLLING_INTERVAL_MS
value: {{ .Values.bootNode.archiverViemPollingInterval | quote }}
- name: L1_READER_VIEM_POLLING_INTERVAL_MS
value: {{ .Values.bootNode.archiverViemPollingInterval | quote }}
- name: SEQ_VIEM_POLLING_INTERVAL_MS
value: {{ .Values.bootNode.viemPollingInterval | quote }}
- name: PEER_ID_PRIVATE_KEY
value: "{{ .Values.bootNode.peerIdPrivateKey }}"
- name: DATA_DIRECTORY
value: "{{ .Values.bootNode.dataDir }}"
- name: DATA_STORE_MAP_SIZE_KB
value: "{{ .Values.storage.dataStoreMapSize }}"
- name: WS_DB_MAP_SIZE_KB
value: "{{ .Values.storage.worldStateMapSize }}"
- name: USE_GCLOUD_LOGGING
value: "{{ .Values.telemetry.useGcloudLogging }}"
- name: OTEL_EXCLUDE_METRICS
value: "{{ .Values.telemetry.excludeMetrics }}"
- name: TEST_ACCOUNTS
value: "{{ .Values.aztec.testAccounts }}"
{{- if .Values.blobSink.enabled }}
- name: BLOB_SINK_URL
value: {{ include "aztec-network.blobSinkUrl" . }}
{{- end }}
ports:
- containerPort: {{ .Values.bootNode.service.nodePort }}
- containerPort: {{ .Values.bootNode.service.p2pTcpPort }}
- containerPort: {{ .Values.bootNode.service.p2pUdpPort }}
protocol: UDP
resources:
{{- toYaml .Values.bootNode.resources | nindent 12 }}
volumes:
- name: config
emptyDir: {}
{{- if .Values.storage.localSsd }}
- name: boot-node-data
emptyDir: {}
{{ else }}
- name: boot-node-data
persistentVolumeClaim:
claimName: boot-node-data
{{- end }}
- name: scripts
configMap:
name: {{ include "aztec-network.fullname" . }}-scripts
defaultMode: 0755
- name: scripts-output
emptyDir: {}
---
# Headless service for StatefulSet DNS entries
apiVersion: v1
kind: Service
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 }}
type: LoadBalancer
{{- if hasKey .Values.bootNode "fixedExternalIP" }}
loadBalancerIP: {{ .Values.bootNode.fixedExternalIP }}
{{- end}}
{{- else }}
type: ClusterIP
clusterIP: None
{{- end }}
selector:
{{- include "aztec-network.selectorLabels" . | nindent 4 }}
app: boot-node
ports:
# External load balancers cannot handle mixed TCP/UDP ports, so we only expose the node port
{{- if not .Values.network.public }}
- port: {{ .Values.bootNode.service.p2pTcpPort }}
name: p2p-tcp
- port: {{ .Values.bootNode.service.p2pUdpPort }}
name: p2p-udp
protocol: UDP
{{- end }}
- port: {{ .Values.bootNode.service.nodePort }}
name: node
---
{{- if hasKey .Values.bootNode "fixedExternalIP" }}
apiVersion: networking.gke.io/v1beta2
kind: ManagedCertificate
metadata:
name: {{ include "aztec-network.fullname" . }}-boot-node-cert
spec:
domains:
- aztecprotocol.com
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "aztec-network.fullname" . }}-boot-node-ingress
annotations:
kubernetes.io/ingress.class: "gce"
networking.gke.io/managed-certificates: {{ include "aztec-network.fullname" . }}-boot-node-cert
spec:
rules:
- host: aztecprotocol.com
http:
paths:
- path: /*
pathType: ImplementationSpecific
backend:
service:
name: {{ include "aztec-network.fullname" . }}-boot-node
port:
number: {{ .Values.bootNode.service.nodePort }}
{{- end }}
{{- end }}