Skip to content

Commit 5112e03

Browse files
committed
BREAKING REFACTOR: move some values to global, add lnd as subchart
lnd nodes running, connected to tank, rpc working test: ensure ln channels and payments with rpc commands test: wait for ln nodes to be ready
1 parent 82306a8 commit 5112e03

File tree

24 files changed

+627
-178
lines changed

24 files changed

+627
-178
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
- dag_connection_test.py
4545
- graph_test.py
4646
- logging_test.py
47+
- ln_basic_test.py
4748
- rpc_test.py
4849
- services_test.py
4950
- signet_test.py

resources/charts/bitcoincore/Chart.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ apiVersion: v2
22
name: bitcoincore
33
description: A Helm chart for Bitcoin Core
44

5+
dependencies:
6+
- name: lnd
7+
version: 0.1.0
8+
condition: ln.lnd
9+
510
# A chart can be either an 'application' or a 'library' chart.
611
#
712
# Application charts are a collection of templates that can be packaged into versioned archives
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: v2
2+
name: lnd
3+
4+
description: A Helm chart for LND
5+
6+
# A chart can be either an 'application' or a 'library' chart.
7+
#
8+
# Application charts are a collection of templates that can be packaged into versioned archives
9+
# to be deployed.
10+
#
11+
# Library charts provide useful utilities or functions for the chart developer. They're included as
12+
# a dependency of application charts to inject those utilities and functions into the rendering
13+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
14+
type: application
15+
16+
# This is the chart version. This version number should be incremented each time you make changes
17+
# to the chart and its templates, including the app version.
18+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19+
version: 0.1.0
20+
21+
# This is the version number of the application being deployed. This version number should be
22+
# incremented each time you make changes to the application. Versions are not expected to
23+
# follow Semantic Versioning. They should reflect the version the application is using.
24+
# It is recommended to use it with quotes.
25+
appVersion: 0.1.0
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{{/*
2+
Expand the name of the PARENT chart.
3+
*/}}
4+
{{- define "bitcoincore.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified PARENT app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "bitcoincore.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }}
18+
{{- end }}
19+
{{- end }}
20+
21+
22+
{{/*
23+
Expand the name of the chart.
24+
*/}}
25+
{{- define "lnd.name" -}}
26+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}-ln
27+
{{- end }}
28+
29+
{{/*
30+
Create a default fully qualified app name.
31+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
32+
If release name contains chart name it will be used as a full name.
33+
*/}}
34+
{{- define "lnd.fullname" -}}
35+
{{- if .Values.fullnameOverride }}
36+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
37+
{{- else }}
38+
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }}-ln
39+
{{- end }}
40+
{{- end }}
41+
42+
{{/*
43+
Create chart name and version as used by the chart label.
44+
*/}}
45+
{{- define "lnd.chart" -}}
46+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
47+
{{- end }}
48+
49+
{{/*
50+
Common labels
51+
*/}}
52+
{{- define "lnd.labels" -}}
53+
helm.sh/chart: {{ include "lnd.chart" . }}
54+
{{ include "lnd.selectorLabels" . }}
55+
{{- if .Chart.AppVersion }}
56+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
57+
{{- end }}
58+
app.kubernetes.io/managed-by: {{ .Release.Service }}
59+
{{- end }}
60+
61+
{{/*
62+
Selector labels
63+
*/}}
64+
{{- define "lnd.selectorLabels" -}}
65+
app.kubernetes.io/name: {{ include "lnd.name" . }}
66+
app.kubernetes.io/instance: {{ .Release.Name }}
67+
{{- end }}
68+
69+
{{/*
70+
Create the name of the service account to use
71+
*/}}
72+
{{- define "lnd.serviceAccountName" -}}
73+
{{- if .Values.serviceAccount.create }}
74+
{{- default (include "lnd.fullname" .) .Values.serviceAccount.name }}
75+
{{- else }}
76+
{{- default "default" .Values.serviceAccount.name }}
77+
{{- end }}
78+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "lnd.fullname" . }}
5+
labels:
6+
{{- include "lnd.labels" . | nindent 4 }}
7+
data:
8+
lnd.conf: |
9+
{{- .Values.baseConfig | nindent 4 }}
10+
{{- .Values.defaultConfig | nindent 4 }}
11+
{{- .Values.config | nindent 4 }}
12+
bitcoin.{{ .Values.global.chain }}=1
13+
bitcoind.rpcpass={{ .Values.global.rpcpassword }}
14+
bitcoind.rpchost={{ include "bitcoincore.fullname" . }}:{{ index .Values.global .Values.global.chain "RPCPort" }}
15+
bitcoind.zmqpubrawblock=tcp://{{ include "bitcoincore.fullname" . }}:{{ .Values.global.ZMQBlockPort }}
16+
bitcoind.zmqpubrawtx=tcp://{{ include "bitcoincore.fullname" . }}:{{ .Values.global.ZMQTxPort }}
17+
alias={{ include "lnd.fullname" . }}
18+
externalhosts={{ include "lnd.fullname" . }}
19+
tlsextradomain={{ include "lnd.fullname" . }}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: {{ include "lnd.fullname" . }}
5+
labels:
6+
{{- include "lnd.labels" . | nindent 4 }}
7+
{{- with .Values.extraLabels }}
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
{{- with .Values.podLabels }}
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
app: {{ include "lnd.fullname" . }}
14+
{{- if .Values.collectLogs }}
15+
collect_logs: "true"
16+
{{- end }}
17+
chain: {{ .Values.global.chain }}
18+
spec:
19+
{{- with .Values.imagePullSecrets }}
20+
imagePullSecrets:
21+
{{- toYaml . | nindent 4 }}
22+
{{- end }}
23+
securityContext:
24+
{{- toYaml .Values.podSecurityContext | nindent 4 }}
25+
containers:
26+
- name: {{ .Chart.Name }}
27+
securityContext:
28+
{{- toYaml .Values.securityContext | nindent 8 }}
29+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
30+
imagePullPolicy: {{ .Values.image.pullPolicy }}
31+
ports:
32+
- name: rpc
33+
containerPort: {{ .Values.RPCPort }}
34+
protocol: TCP
35+
- name: p2p
36+
containerPort: {{ .Values.P2PPort }}
37+
protocol: TCP
38+
livenessProbe:
39+
{{- toYaml .Values.livenessProbe | nindent 8 }}
40+
readinessProbe:
41+
{{- toYaml .Values.readinessProbe | nindent 8 }}
42+
resources:
43+
{{- toYaml .Values.resources | nindent 8 }}
44+
volumeMounts:
45+
{{- with .Values.volumeMounts }}
46+
{{- toYaml . | nindent 8 }}
47+
{{- end }}
48+
- mountPath: /root/.lnd/lnd.conf
49+
name: config
50+
subPath: lnd.conf
51+
{{- if .Values.circuitBreaker }}
52+
- name: circuitbreaker
53+
image: pinheadmz/circuitbreaker:278737d
54+
imagePullPolicy: IfNotPresent
55+
{{- end}}
56+
volumes:
57+
{{- with .Values.volumes }}
58+
{{- toYaml . | nindent 4 }}
59+
{{- end }}
60+
- configMap:
61+
name: {{ include "lnd.fullname" . }}
62+
name: config
63+
{{- with .Values.nodeSelector }}
64+
nodeSelector:
65+
{{- toYaml . | nindent 4 }}
66+
{{- end }}
67+
{{- with .Values.affinity }}
68+
affinity:
69+
{{- toYaml . | nindent 4 }}
70+
{{- end }}
71+
{{- with .Values.tolerations }}
72+
tolerations:
73+
{{- toYaml . | nindent 4 }}
74+
{{- end }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "lnd.fullname" . }}
5+
labels:
6+
{{- include "lnd.labels" . | nindent 4 }}
7+
app: {{ include "lnd.fullname" . }}
8+
spec:
9+
type: {{ .Values.service.type }}
10+
ports:
11+
- port: {{ .Values.RPCPort }}
12+
targetPort: rpc
13+
protocol: TCP
14+
name: rpc
15+
- port: {{ .Values.P2PPort }}
16+
targetPort: p2p
17+
protocol: TCP
18+
name: p2p
19+
selector:
20+
{{- include "lnd.selectorLabels" . | nindent 4 }}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Default values for lnd.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
namespace: warnet
5+
6+
image:
7+
repository: lightninglabs/lnd
8+
pullPolicy: IfNotPresent
9+
# Overrides the image tag whose default is the chart appVersion.
10+
tag: "v0.18.3-beta"
11+
12+
imagePullSecrets: []
13+
nameOverride: ""
14+
fullnameOverride: ""
15+
16+
podLabels:
17+
app: "warnet"
18+
mission: "lightning"
19+
20+
podSecurityContext: {}
21+
# fsGroup: 2000
22+
23+
securityContext: {}
24+
# capabilities:
25+
# drop:
26+
# - ALL
27+
# readOnlyRootFilesystem: true
28+
# runAsNonRoot: true
29+
# runAsUser: 1000
30+
31+
service:
32+
type: ClusterIP
33+
34+
RPCPort: 10009
35+
P2PPort: 9735
36+
37+
ingress:
38+
enabled: false
39+
className: ""
40+
annotations: {}
41+
# kubernetes.io/ingress.class: nginx
42+
# kubernetes.io/tls-acme: "true"
43+
hosts:
44+
- host: chart-example.local
45+
paths:
46+
- path: /
47+
pathType: ImplementationSpecific
48+
tls: []
49+
# - secretName: chart-example-tls
50+
# hosts:
51+
# - chart-example.local
52+
53+
resources: {}
54+
# We usually recommend not to specify default resources and to leave this as a conscious
55+
# choice for the user. This also increases chances charts run on environments with little
56+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
57+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
58+
# limits:
59+
# cpu: 100m
60+
# memory: 128Mi
61+
# requests:
62+
# cpu: 100m
63+
# memory: 128Mi
64+
65+
66+
livenessProbe:
67+
exec:
68+
command:
69+
- pidof
70+
- lnd
71+
failureThreshold: 3
72+
initialDelaySeconds: 5
73+
periodSeconds: 5
74+
successThreshold: 1
75+
timeoutSeconds: 1
76+
readinessProbe:
77+
failureThreshold: 1
78+
periodSeconds: 1
79+
successThreshold: 1
80+
tcpSocket:
81+
port: 10009
82+
timeoutSeconds: 1
83+
84+
85+
# Additional volumes on the output Deployment definition.
86+
volumes: []
87+
# - name: foo
88+
# secret:
89+
# secretName: mysecret
90+
# optional: false
91+
92+
# Additional volumeMounts on the output Deployment definition.
93+
volumeMounts: []
94+
# - name: foo
95+
# mountPath: "/etc/foo"
96+
# readOnly: true
97+
98+
nodeSelector: {}
99+
100+
tolerations: []
101+
102+
affinity: {}
103+
104+
baseConfig: |
105+
noseedbackup=true
106+
norest=true
107+
debuglevel=debug
108+
accept-keysend=true
109+
bitcoin.active=true
110+
bitcoin.node=bitcoind
111+
maxpendingchannels=64
112+
trickledelay=1
113+
rpclisten=0.0.0.0:10009
114+
bitcoind.rpcuser=user
115+
# zmq* and bitcoind.rpcpass are set in configmap.yaml
116+
117+
config: ""
118+
119+
defaultConfig: ""
120+
121+
extraLabels: {}

resources/charts/bitcoincore/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ Always add for custom semver, check version for valid semver
6565
{{- $custom := contains "-" .Values.image.tag -}}
6666
{{- $newer := semverCompare ">=0.17.0" .Values.image.tag -}}
6767
{{- if or $newer $custom -}}
68-
[{{ .Values.chain }}]
68+
[{{ .Values.global.chain }}]
6969
{{- end -}}
7070
{{- end -}}

resources/charts/bitcoincore/templates/configmap.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ metadata:
66
{{- include "bitcoincore.labels" . | nindent 4 }}
77
data:
88
bitcoin.conf: |
9-
{{ .Values.chain }}=1
9+
{{ .Values.global.chain }}=1
1010
1111
{{ template "bitcoincore.check_semver" . }}
1212
{{- .Values.baseConfig | nindent 4 }}
13-
rpcport={{ index .Values .Values.chain "RPCPort" }}
14-
rpcpassword={{ .Values.rpcpassword }}
15-
zmqpubrawblock=tcp://0.0.0.0:{{ .Values.ZMQBlockPort }}
16-
zmqpubrawtx=tcp://0.0.0.0:{{ .Values.ZMQTxPort }}
13+
rpcport={{ index .Values.global .Values.global.chain "RPCPort" }}
14+
rpcpassword={{ .Values.global.rpcpassword }}
15+
zmqpubrawblock=tcp://0.0.0.0:{{ .Values.global.ZMQBlockPort }}
16+
zmqpubrawtx=tcp://0.0.0.0:{{ .Values.global.ZMQTxPort }}
1717
{{- .Values.defaultConfig | nindent 4 }}
1818
{{- .Values.config | nindent 4 }}
1919
{{- range .Values.addnode }}

0 commit comments

Comments
 (0)