Skip to content

Commit b1780a8

Browse files
committed
feat(helm): support external artifact sourcing
1 parent 3ad607e commit b1780a8

4 files changed

Lines changed: 134 additions & 0 deletions

File tree

charts/network/charts/network-bootstrapper/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ A Helm chart for Kubernetes
1515
| Key | Type | Default | Description |
1616
|-----|------|---------|-------------|
1717
| affinity | object | `{}` | |
18+
| artifacts.external.faucet.address | string | `""` | Faucet account address stored in the `besu-faucet-address` ConfigMap when `source` equals `external`. |
19+
| artifacts.external.faucet.privateKey | string | `""` | Faucet private key stored in the `besu-faucet-private-key` Secret when `source` equals `external`. |
20+
| artifacts.external.faucet.publicKey | string | `""` | Faucet account public key stored in the `besu-faucet-pubkey` ConfigMap when `source` equals `external`. |
21+
| artifacts.external.genesis | object | `{}` | Besu genesis document rendered into the `besu-genesis` ConfigMap when `source` equals `external`. |
22+
| artifacts.external.staticNodes | list | `[]` | Collection of enode URIs persisted to the `besu-static-nodes` ConfigMap when `source` equals `external`. |
23+
| artifacts.external.validators | list | `[]` | Validator node definitions providing the data expected by the nodes chart. Each entry must include `address`, `publicKey`, `privateKey`, and `enode`. |
24+
| artifacts.source | string | `"generated"` | Determines how Besu network artifacts are populated. Use `generated` to run the job or `external` to supply values manually. |
1825
| fullnameOverride | string | `"bootstrapper"` | Override for the fully qualified resource name generated by helpers. |
1926
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy controlling when Kubernetes fetches updated image layers. |
2027
| image.repository | string | `"ghcr.io/settlemint/network-bootstrapper"` | OCI registry path hosting the network bootstrapper image. |
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{{- $artifactSource := default "generated" .Values.artifacts.source -}}
2+
{{- if eq $artifactSource "external" }}
3+
{{- $root := . -}}
4+
{{- $external := .Values.artifacts.external | default (dict) -}}
5+
{{- $genesis := get $external "genesis" -}}
6+
{{- $staticNodes := get $external "staticNodes" -}}
7+
{{- $validators := get $external "validators" -}}
8+
{{- $faucet := get $external "faucet" -}}
9+
{{- if not $genesis }}{{ fail "artifacts.external.genesis must be provided when artifacts.source is 'external'." }}{{- end }}
10+
{{- if not $staticNodes }}{{ fail "artifacts.external.staticNodes must include at least one enode when artifacts.source is 'external'." }}{{- end }}
11+
{{- if not $validators }}{{ fail "artifacts.external.validators must include at least one entry when artifacts.source is 'external'." }}{{- end }}
12+
{{- if not ($faucet.address) }}{{ fail "artifacts.external.faucet.address must be set when artifacts.source is 'external'." }}{{- end }}
13+
{{- if not ($faucet.publicKey) }}{{ fail "artifacts.external.faucet.publicKey must be set when artifacts.source is 'external'." }}{{- end }}
14+
{{- if not ($faucet.privateKey) }}{{ fail "artifacts.external.faucet.privateKey must be set when artifacts.source is 'external'." }}{{- end }}
15+
apiVersion: v1
16+
kind: ConfigMap
17+
metadata:
18+
name: besu-genesis
19+
labels:
20+
{{- include "network-bootstrapper.labels" . | nindent 4 }}
21+
data:
22+
genesis.json: |-
23+
{{ toPrettyJson $genesis | indent 4 }}
24+
---
25+
apiVersion: v1
26+
kind: ConfigMap
27+
metadata:
28+
name: besu-static-nodes
29+
labels:
30+
{{- include "network-bootstrapper.labels" . | nindent 4 }}
31+
data:
32+
static-nodes.json: |-
33+
{{ toPrettyJson $staticNodes | indent 4 }}
34+
{{- range $index, $validator := $validators }}
35+
{{- $requiredAddress := required (printf "artifacts.external.validators[%d].address must be set." $index) $validator.address }}
36+
{{- $requiredPublicKey := required (printf "artifacts.external.validators[%d].publicKey must be set." $index) $validator.publicKey }}
37+
{{- $requiredPrivateKey := required (printf "artifacts.external.validators[%d].privateKey must be set." $index) $validator.privateKey }}
38+
{{- $requiredEnode := required (printf "artifacts.external.validators[%d].enode must be set." $index) $validator.enode }}
39+
---
40+
apiVersion: v1
41+
kind: ConfigMap
42+
metadata:
43+
name: {{ printf "besu-node-validator-%d-address" $index }}
44+
labels:
45+
{{- include "network-bootstrapper.labels" $root | nindent 4 }}
46+
data:
47+
address: {{ $requiredAddress | quote }}
48+
---
49+
apiVersion: v1
50+
kind: ConfigMap
51+
metadata:
52+
name: {{ printf "besu-node-validator-%d-enode" $index }}
53+
labels:
54+
{{- include "network-bootstrapper.labels" $root | nindent 4 }}
55+
data:
56+
enode: {{ $requiredEnode | quote }}
57+
---
58+
apiVersion: v1
59+
kind: ConfigMap
60+
metadata:
61+
name: {{ printf "besu-node-validator-%d-pubkey" $index }}
62+
labels:
63+
{{- include "network-bootstrapper.labels" $root | nindent 4 }}
64+
data:
65+
publicKey: {{ $requiredPublicKey | quote }}
66+
---
67+
apiVersion: v1
68+
kind: Secret
69+
metadata:
70+
name: {{ printf "besu-node-validator-%d-private-key" $index }}
71+
labels:
72+
{{- include "network-bootstrapper.labels" $root | nindent 4 }}
73+
type: Opaque
74+
stringData:
75+
privateKey: {{ $requiredPrivateKey | quote }}
76+
{{- end }}
77+
---
78+
apiVersion: v1
79+
kind: ConfigMap
80+
metadata:
81+
name: besu-faucet-address
82+
labels:
83+
{{- include "network-bootstrapper.labels" . | nindent 4 }}
84+
data:
85+
address: {{ $faucet.address | quote }}
86+
---
87+
apiVersion: v1
88+
kind: ConfigMap
89+
metadata:
90+
name: besu-faucet-pubkey
91+
labels:
92+
{{- include "network-bootstrapper.labels" . | nindent 4 }}
93+
data:
94+
publicKey: {{ $faucet.publicKey | quote }}
95+
---
96+
apiVersion: v1
97+
kind: Secret
98+
metadata:
99+
name: besu-faucet-private-key
100+
labels:
101+
{{- include "network-bootstrapper.labels" . | nindent 4 }}
102+
type: Opaque
103+
stringData:
104+
privateKey: {{ $faucet.privateKey | quote }}
105+
{{- end }}

charts/network/charts/network-bootstrapper/templates/job.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{{- $artifactSource := default "generated" .Values.artifacts.source -}}
2+
{{- if eq $artifactSource "generated" }}
13
apiVersion: batch/v1
24
kind: Job
35
metadata:
@@ -106,3 +108,4 @@ spec:
106108
tolerations:
107109
{{- toYaml . | nindent 8 }}
108110
{{- end }}
111+
{{- end }}

charts/network/charts/network-bootstrapper/values.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,22 @@ settings:
121121
evmStackSize:
122122
# -- (int) Maximum smart-contract bytecode size accepted by the EVM.
123123
contractSizeLimit:
124+
125+
# Artifact sourcing controls for bootstrap data used by the nodes chart.
126+
artifacts:
127+
# -- (string) Determines how Besu network artifacts are populated. Use `generated` to run the job or `external` to supply values manually.
128+
source: generated
129+
external:
130+
# -- (object) Besu genesis document rendered into the `besu-genesis` ConfigMap when `source` equals `external`.
131+
genesis: {}
132+
# -- (list) Collection of enode URIs persisted to the `besu-static-nodes` ConfigMap when `source` equals `external`.
133+
staticNodes: []
134+
# -- (list) Validator node definitions providing the data expected by the nodes chart. Each entry must include `address`, `publicKey`, `privateKey`, and `enode`.
135+
validators: []
136+
faucet:
137+
# -- (string) Faucet account address stored in the `besu-faucet-address` ConfigMap when `source` equals `external`.
138+
address: ""
139+
# -- (string) Faucet account public key stored in the `besu-faucet-pubkey` ConfigMap when `source` equals `external`.
140+
publicKey: ""
141+
# -- (string) Faucet private key stored in the `besu-faucet-private-key` Secret when `source` equals `external`.
142+
privateKey: ""

0 commit comments

Comments
 (0)