Skip to content

Commit 1df9adf

Browse files
committed
feat(topology): enhance topology.json template
Signed-off-by: wcatz <waynecataldo@gmail.com>
1 parent 77b653a commit 1df9adf

3 files changed

Lines changed: 75 additions & 22 deletions

File tree

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