Skip to content

Commit ee8c422

Browse files
committed
feat(dingo): forge blocks
1 parent 9dbf2c4 commit ee8c422

11 files changed

Lines changed: 444 additions & 89 deletions

charts/dingo/Chart.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
apiVersion: v2
33
name: dingo
44
description: "A Helm chart for deploying Dingo"
5-
version: 0.0.28
6-
appVersion: 0.22.0
5+
version: 0.1.0
6+
appVersion: 0.22.1
77

88
sources:
9-
- https://github.com/blinklabs-io/dingo
9+
- https://github.com/blinklabs-io/dingo
1010

1111
maintainers:
12-
- name: aurora
13-
email: aurora@blinklabs.io
14-
- name: overcookedpanda
15-
email: overcookedpanda@blinklabs.io
16-
- name: verbotenj
17-
email: verbotenj@blinklabs.io
18-
- name: wolf31o2
19-
email: wolf31o2@blinklabs.io
12+
- name: aurora
13+
email: aurora@blinklabs.io
14+
- name: overcookedpanda
15+
email: overcookedpanda@blinklabs.io
16+
- name: verbotenj
17+
email: verbotenj@blinklabs.io
18+
- name: wolf31o2
19+
email: wolf31o2@blinklabs.io

charts/dingo/templates/_helpers.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@ app.kubernetes.io/instance: {{ .Release.Name }}
1212
app.kubernetes.io/version: {{ .Chart.AppVersion }}
1313
app.kubernetes.io/managed-by: {{ .Release.Service }}
1414
{{- end }}
15+
16+
{{- define "dingo.matchLabels" -}}
17+
app.kubernetes.io/name: {{ include "dingo.name" . }}
18+
app.kubernetes.io/instance: {{ .Release.Name }}
19+
{{- end }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- if .Values.dingoConfig.enabled }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ include "dingo.fullname" . }}-config
6+
namespace: {{ .Release.Namespace | default "default" }}
7+
labels:
8+
{{- include "dingo.labels" . | nindent 4 }}
9+
data:
10+
dingo.yaml: |
11+
{{- .Values.dingoConfig.data | nindent 4 }}
12+
{{- end }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if .Values.blockProducer.enabled }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ .Release.Name }}-secret
6+
namespace: {{ .Release.Namespace | default "default" }}
7+
labels:
8+
{{- include "dingo.labels" . | nindent 4 }}
9+
type: Opaque
10+
data:
11+
{{- range .Values.blockProducer.keys }}
12+
{{ .name }}: {{ dict "type" .type "description" .description "cborHex" .cborHex | toJson | b64enc }}
13+
{{- end }}
14+
{{- end }}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
{{- if .Values.podMonitor.enabled }}
3+
apiVersion: monitoring.coreos.com/v1
4+
kind: PodMonitor
5+
metadata:
6+
name: {{ include "dingo.fullname" . }}
7+
labels:
8+
{{- include "dingo.labels" . | nindent 4 }}
9+
{{- with .Values.podMonitor.extraLabels }}
10+
{{ toYaml . | indent 4 }}
11+
{{- end }}
12+
spec:
13+
{{- with .Values.podMonitor.fallbackScrapeProtocol }}
14+
fallbackScrapeProtocol: {{ . | quote }}
15+
{{- end }}
16+
{{- with .Values.podMonitor.podTargetLabels }}
17+
podTargetLabels:
18+
{{- toYaml . | nindent 4 }}
19+
{{- end }}
20+
selector:
21+
matchLabels:
22+
{{- include "dingo.matchLabels" . | nindent 6 }}
23+
namespaceSelector:
24+
matchNames:
25+
- {{ .Release.Namespace }}
26+
podMetricsEndpoints:
27+
{{- toYaml .Values.podMonitor.podMetricsEndpoints | nindent 4 }}
28+
{{- end }}

charts/dingo/templates/service-account.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
apiVersion: v1
33
kind: ServiceAccount
44
metadata:
5-
name: {{ .Release.Name }}
5+
name: {{ .Values.serviceAccount.name | default .Release.Name }}
66
{{- if .Values.serviceAccount.annotations }}
77
annotations: {{- toYaml .Values.serviceAccount.annotations | nindent 4 }}
88
{{- end }}

charts/dingo/templates/service-headless.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
targetPort: {{ .Values.environment.CARDANO_PORT | default .Values.service.ports.relay }}
1818
- name: utxorpc
1919
port: {{ .Values.service.ports.utxorpc }}
20-
targetPort: {{ .Values.environment.CARDANO_UTXORPC_PORT | default .Values.service.ports.utxorpc }}
20+
targetPort: {{ .Values.environment.DINGO_UTXORPC_PORT | default .Values.service.ports.utxorpc }}
2121
- name: metrics
2222
port: {{ .Values.service.ports.metrics }}
2323
targetPort: {{ .Values.environment.CARDANO_METRICS_PORT | default .Values.service.ports.metrics }}

charts/dingo/templates/service.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,26 @@ spec:
1818
targetPort: {{ .Values.environment.CARDANO_PORT | default .Values.service.ports.relay }}
1919
- name: utxorpc
2020
port: {{ .Values.service.ports.utxorpc }}
21-
targetPort: {{ .Values.environment.CARDANO_UTXORPC_PORT | default .Values.service.ports.utxorpc }}
21+
targetPort: {{ .Values.environment.DINGO_UTXORPC_PORT | default .Values.service.ports.utxorpc }}
22+
{{- if gt (int .Values.service.ports.blockfrost) 0 }}
23+
- name: blockfrost
24+
port: {{ .Values.service.ports.blockfrost }}
25+
targetPort: {{ .Values.environment.DINGO_BLOCKFROST_PORT | default .Values.service.ports.blockfrost }}
26+
{{- end }}
27+
{{- if gt (int .Values.service.ports.mesh) 0 }}
28+
- name: mesh
29+
port: {{ .Values.service.ports.mesh }}
30+
targetPort: {{ .Values.environment.DINGO_MESH_PORT | default .Values.service.ports.mesh }}
31+
{{- end }}
32+
{{- if gt (int .Values.service.ports.bark) 0 }}
33+
- name: bark
34+
port: {{ .Values.service.ports.bark }}
35+
targetPort: {{ .Values.environment.DINGO_BARK_PORT | default .Values.service.ports.bark }}
36+
{{- end }}
2237
- name: metrics
2338
port: {{ .Values.service.ports.metrics }}
2439
targetPort: {{ .Values.environment.CARDANO_METRICS_PORT | default .Values.service.ports.metrics }}
2540
selector:
2641
app.kubernetes.io/name: {{ include "dingo.name" . }}
2742
app.kubernetes.io/instance: {{ .Release.Name }}
43+
sessionAffinity: ClientIP

charts/dingo/templates/statefulset.yaml

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,26 @@ spec:
2020
labels:
2121
app.kubernetes.io/name: {{ include "dingo.name" . }}
2222
app.kubernetes.io/instance: {{ .Release.Name }}
23+
{{- with .Values.podLabels }}
24+
{{- toYaml . | nindent 8 }}
25+
{{- end }}
26+
annotations:
27+
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
28+
kubectl.kubernetes.io/default-container: dingo
29+
{{- if .Values.blockProducer.enabled }}
30+
checksum/keys: {{ .Values.blockProducer.keys | toJson | sha256sum }}
31+
{{- end }}
32+
{{- if .Values.topology.enabled }}
33+
checksum/topology: {{ .Values.topology | toJson | sha256sum }}
34+
{{- end }}
35+
{{- if .Values.dingoConfig.enabled }}
36+
checksum/config: {{ .Values.dingoConfig.data | sha256sum }}
37+
{{- end }}
2338
spec:
24-
serviceAccountName: {{ .Release.Name }}
39+
serviceAccountName: {{ .Values.serviceAccount.name | default .Release.Name }}
40+
{{- if .Values.affinity }}
41+
affinity: {{- toYaml .Values.affinity | nindent 8 }}
42+
{{- end }}
2543
{{- if .Values.tolerations }}
2644
tolerations: {{- toYaml .Values.tolerations | nindent 8 }}
2745
{{- end }}
@@ -165,6 +183,9 @@ spec:
165183
containers:
166184
- name: dingo
167185
command: ["dingo"]
186+
{{- if .Values.dingoConfig.enabled }}
187+
args: ["--config", "/etc/dingo/dingo.yaml"]
188+
{{- end }}
168189
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
169190
imagePullPolicy: {{ .Values.image.pullPolicy }}
170191
env:
@@ -174,21 +195,91 @@ spec:
174195
value: "{{ $value }}"
175196
{{- end }}
176197
{{- end }}
198+
{{- if not (index .Values.environment "CARDANO_CONFIG") }}
199+
- name: CARDANO_CONFIG
200+
value: "/opt/cardano/config/{{ .Values.environment.CARDANO_NETWORK }}/config.json"
201+
{{- end }}
202+
- name: CARDANO_TOPOLOGY
203+
value: "/opt/cardano/config/{{ .Values.environment.CARDANO_NETWORK }}/topology.json"
204+
{{- if .Values.blockProducer.enabled }}
205+
- name: CARDANO_BLOCK_PRODUCER
206+
value: "true"
207+
- name: CARDANO_SHELLEY_VRF_KEY
208+
value: "/keys/vrf.skey"
209+
- name: CARDANO_SHELLEY_KES_KEY
210+
value: "/keys/kes.skey"
211+
- name: CARDANO_SHELLEY_OPERATIONAL_CERTIFICATE
212+
value: "/keys/node.cert"
213+
{{- if .Values.blockProducer.forgeSyncToleranceSlots }}
214+
- name: DINGO_FORGE_SYNC_TOLERANCE_SLOTS
215+
value: {{ .Values.blockProducer.forgeSyncToleranceSlots | quote }}
216+
{{- end }}
217+
{{- if .Values.blockProducer.forgeStaleGapThresholdSlots }}
218+
- name: DINGO_FORGE_STALE_GAP_THRESHOLD_SLOTS
219+
value: {{ .Values.blockProducer.forgeStaleGapThresholdSlots | quote }}
220+
{{- end }}
221+
{{- end }}
222+
- name: DINGO_SOCKET_PATH
223+
value: /ipc/dingo.socket
224+
- name: CARDANO_SOCKET_PATH
225+
value: /ipc/dingo.socket
226+
- name: CARDANO_NODE_SOCKET_PATH
227+
value: /ipc/dingo.socket
177228
ports:
178229
- name: private
179230
containerPort: {{ .Values.service.ports.private }}
180231
- name: relay
181232
containerPort: {{ .Values.environment.CARDANO_PORT | default .Values.service.ports.relay }}
182233
- name: utxorpc
183-
containerPort: {{ .Values.environment.CARDANO_UTXORPC_PORT | default .Values.service.ports.utxorpc }}
234+
containerPort: {{ .Values.environment.DINGO_UTXORPC_PORT | default .Values.service.ports.utxorpc }}
184235
- name: metrics
185236
containerPort: {{ .Values.environment.CARDANO_METRICS_PORT | default .Values.service.ports.metrics }}
186237
volumeMounts:
187238
- name: dingo-data
188239
mountPath: {{ .Values.environment.CARDANO_DATABASE_PATH }}
240+
{{- if .Values.blockProducer.enabled }}
241+
- name: block-producer-keys
242+
mountPath: /keys
243+
readOnly: true
244+
{{- end }}
245+
{{- if .Values.topology.enabled }}
246+
- name: topology
247+
mountPath: /opt/cardano/config/{{ .Values.environment.CARDANO_NETWORK }}/topology.json
248+
subPath: topology.json
249+
readOnly: true
250+
{{- end }}
251+
- name: node-ipc
252+
mountPath: /ipc
253+
{{- if .Values.dingoConfig.enabled }}
254+
- name: dingo-config
255+
mountPath: /etc/dingo/dingo.yaml
256+
subPath: dingo.yaml
257+
readOnly: true
258+
{{- end }}
189259
{{- if .Values.resources }}
190260
resources: {{- toYaml .Values.resources | nindent 12 }}
191261
{{- end }}
262+
volumes:
263+
- name: node-ipc
264+
emptyDir: {}
265+
{{- if .Values.blockProducer.enabled }}
266+
- name: block-producer-keys
267+
secret:
268+
defaultMode: 0600
269+
secretName: {{ .Release.Name }}-secret
270+
{{- end }}
271+
{{- if .Values.topology.enabled }}
272+
- name: topology
273+
configMap:
274+
name: {{ include "dingo.fullname" . }}-topology
275+
defaultMode: 0644
276+
{{- end }}
277+
{{- if .Values.dingoConfig.enabled }}
278+
- name: dingo-config
279+
configMap:
280+
name: {{ include "dingo.fullname" . }}-config
281+
defaultMode: 0644
282+
{{- end }}
192283
volumeClaimTemplates:
193284
- metadata:
194285
name: dingo-data
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{{- if .Values.topology.enabled }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ include "dingo.fullname" . }}-topology
6+
namespace: {{ .Release.Namespace | default "default" }}
7+
labels:
8+
{{- include "dingo.labels" . | nindent 4 }}
9+
data:
10+
topology.json: |
11+
{
12+
"bootstrapPeers": [{{- range $i, $peer := .Values.topology.bootstrapPeers }}
13+
{{- if $i }},{{ end }}
14+
{ "address": "{{ $peer.address }}", "port": {{ $peer.port }} }
15+
{{- end }}],
16+
"localRoots": [
17+
{{- range $i, $local := .Values.topology.localRoots }}
18+
{{- if $i }},{{ end }}
19+
{
20+
"accessPoints": [
21+
{{- range $j, $peer := $local.accessPoints }}
22+
{{- if $j }},{{ end }}
23+
{ "address": "{{ $peer.address }}", "port": {{ $peer.port }}, "name": "{{ $peer.name }}" }
24+
{{- end }}
25+
],
26+
"advertise": {{ $local.advertise | toJson }},
27+
"trustable": {{ $local.trustable | default false | toJson }},
28+
"valency": {{ $local.valency }}
29+
}
30+
{{- end }}
31+
],
32+
{{- with .Values.topology.peerSnapshotFile }}
33+
"peerSnapshotFile": "{{ . }}",
34+
{{- end }}
35+
"publicRoots": [{{- $hasPublicRoots := false }}
36+
{{- range $public := .Values.topology.publicRoots }}
37+
{{- if and (hasKey $public "accessPoints") (gt (len $public.accessPoints) 0) }}
38+
{{- $hasPublicRoots = true }}
39+
{{- end }}
40+
{{- end }}
41+
{{- if $hasPublicRoots }}
42+
{{- range $i, $public := .Values.topology.publicRoots }}
43+
{{- if and (hasKey $public "accessPoints") (gt (len $public.accessPoints) 0) }}
44+
{{- if $i }},{{ end }}
45+
{
46+
"accessPoints": [
47+
{{- range $j, $peer := $public.accessPoints }}
48+
{{- if $j }},{{ end }}
49+
{ "address": "{{ $peer.address }}", "port": {{ $peer.port }}, "name": "{{ $peer.name }}" }
50+
{{- end }}
51+
],
52+
"advertise": {{ $public.advertise | default false | toJson }}
53+
}
54+
{{- end }}
55+
{{- end }}
56+
{{- end }}],
57+
"useLedgerAfterSlot": {{ .Values.topology.useLedgerAfterSlot | int }}
58+
}
59+
{{- end }}

0 commit comments

Comments
 (0)