|
| 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 }} |
0 commit comments