Skip to content

Commit 877051f

Browse files
authored
feat(cardano-node): enhance topology.json template (#248)
Signed-off-by: wcatz <[email protected]>
1 parent 2ca8e67 commit 877051f

File tree

3 files changed

+75
-18
lines changed

3 files changed

+75
-18
lines changed

charts/cardano-node/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
name: cardano-node
33
description: Creates a Cardano node deployment with SOCAT sidecar
4-
version: 0.3.0
4+
version: 0.4.0
55
appVersion: 10.3.1
66
maintainers:
77
- name: aurora

charts/cardano-node/templates/topology-configmap.yaml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,53 @@ metadata:
88
labels:
99
{{ include "cardano-node.labels" . | nindent 4 }}
1010
data:
11-
topology.json: |-
12-
{{ toJson .Values.topology.config | indent 4 }}
11+
topology.json: |
12+
{
13+
"bootstrapPeers": [{{- range $i, $peer := .Values.topology.bootstrapPeers }}
14+
{{- if $i }},{{ end }}
15+
{ "address": "{{ $peer.address }}", "port": {{ $peer.port }} }
16+
{{- end }}],
17+
"localRoots": [
18+
{{- range $i, $local := .Values.topology.localRoots }}
19+
{{- if $i }},{{ end }}
20+
{
21+
"accessPoints": [
22+
{{- range $j, $peer := $local.accessPoints }}
23+
{{- if $j }},{{ end }}
24+
{ "address": "{{ $peer.address }}", "port": {{ $peer.port }}, "name": "{{ $peer.name }}" }
25+
{{- end }}
26+
],
27+
"advertise": {{ $local.advertise | toJson }},
28+
"trustable": {{ $local.trustable | default false | toJson }},
29+
"valency": {{ $local.valency }}
30+
}
31+
{{- end }}
32+
]
33+
{{- with .Values.topology.peerSnapshotFile }},
34+
"peerSnapshotFile": "{{ . }}"
35+
{{- end }},
36+
"publicRoots": [{{- $hasPublicRoots := false }}
37+
{{- range $public := .Values.topology.publicRoots }}
38+
{{- if and (hasKey $public "accessPoints") (gt (len $public.accessPoints) 0) }}
39+
{{- $hasPublicRoots = true }}
40+
{{- end }}
41+
{{- end }}
42+
{{- if $hasPublicRoots }}
43+
{{- range $i, $public := .Values.topology.publicRoots }}
44+
{{- if and (hasKey $public "accessPoints") (gt (len $public.accessPoints) 0) }}
45+
{{- if $i }},{{ end }}
46+
{
47+
"accessPoints": [
48+
{{- range $j, $peer := $public.accessPoints }}
49+
{{- if $j }},{{ end }}
50+
{ "address": "{{ $peer.address }}", "port": {{ $peer.port }}, "name": "{{ $peer.name }}" }
51+
{{- end }}
52+
],
53+
"advertise": {{ $public.advertise | default false | toJson }}
54+
}
55+
{{- end }}
56+
{{- end }}
57+
{{- end }}],
58+
"useLedgerAfterSlot": {{ .Values.topology.useLedgerAfterSlot | int }}
59+
}
1360
{{- end }}

charts/cardano-node/values.yaml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,34 @@ blockProducer:
3636
# description: VRF Signing Key
3737
# cborHex: 5840823318989cf48897044629a22a27c8bf975215fe28161fc90cc42e9446a331be96a37ee0c4060a46ee0bf99fcba3460be133e7e343dd7d4144f67f2a6402e886
3838

39+
# Custom topology. When disabled the image will load the default topology for chosen cardano_network
3940
topology:
4041
enabled: false
41-
# config:
42-
# bootstrapPeers:
43-
# - address: "preview-node.play.dev.cardano.org"
44-
# port: 3001
45-
# localRoots:
46-
# - accessPoints:
47-
# - address: "preview-node.play.dev.cardano.org"
42+
# bootstrapPeers:
43+
# - address: preview-node.play.dev.cardano.org
44+
# port: 3001
45+
# localRoots:
46+
# - accessPoints:
47+
# - name: Example
48+
# address: preview-node.play.dev.cardano.org
4849
# port: 3001
49-
# advertise: false
50-
# trustable: false
51-
# valency: 1
52-
# peerSnapshotFile: "peer-snapshot.json"
53-
# publicRoots:
54-
# - accessPoints: []
55-
# advertise: false
56-
# useLedgerAfterSlot: 83116868
50+
# advertise: false
51+
# trustable: true
52+
# valency: 1
53+
# - accessPoints:
54+
# - name: Example
55+
# address: preview-node.play.dev.cardano.org
56+
# port: 3001
57+
# - name: Example
58+
# address: preview-node.play.dev.cardano.org
59+
# port: 3001
60+
# advertise: true
61+
# trustable: false
62+
# valency: 2
63+
# publicRoots:
64+
# - advertise: true
65+
# # useLedgerAfterSlot: -1 to disable ledger peer discovery
66+
# useLedgerAfterSlot: 83116868
5767

5868
storage:
5969
# Suitable for preview and preprod, 250+ for mainnet

0 commit comments

Comments
 (0)