Skip to content

Add CLN support #713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
e0def8f
add eclair chart
danvergara Feb 23, 2025
1f44794
add eclair as a dependency
danvergara Feb 23, 2025
6c54c7b
add cln chart
danvergara Mar 25, 2025
80c3211
add improvements to the cln node
danvergara Mar 25, 2025
02609bc
fixes for eclair
danvergara Mar 27, 2025
814793c
checkpoint cln integrated into ln_framework
macgyver13 Apr 5, 2025
4df0c33
move certs from cln nodes to simln
macgyver13 Apr 14, 2025
4c409fd
adjust cln to start grpc
macgyver13 Apr 15, 2025
7831413
enable grpc plugin to respond to remote nodes
macgyver13 Apr 18, 2025
9fdd5f8
Add styling to standard out for improved readability
macgyver13 Apr 19, 2025
a6fc662
Fix wait for gossip loop
macgyver13 Apr 19, 2025
915b70e
Merge branch 'main' into add-ln-nodes
macgyver13 Apr 20, 2025
5767109
fix linter findings
macgyver13 Apr 20, 2025
ff9d32e
don't setup a ln connection to itself
macgyver13 Apr 20, 2025
cda355b
Add ln_mixed node test
macgyver13 Apr 23, 2025
f1a8b37
switch from print to logger
macgyver13 Apr 23, 2025
6355e85
correct formatting ruff finding
macgyver13 Apr 23, 2025
f1d7b39
revert -lnd changes based on comments
macgyver13 Apr 23, 2025
10531d5
Remove all dependences on -cln or -lnd name to determine type - use p…
macgyver13 Apr 23, 2025
3d846d3
address comments
macgyver13 Apr 25, 2025
f5aba7c
remove RPC requirements for CLN - fetch rune via http transfer from pod
macgyver13 Apr 25, 2025
4fb0225
Add debug logs to deploy step
macgyver13 Apr 25, 2025
7890267
try wait_for_pod_ready
macgyver13 Apr 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/scenarios.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,9 @@ Total Tanks: 6 | Active Scenarios: 0
## Running a custom scenario

You can write your own scenario file and run it in the same way.

## Scenarios with lightning nodes

When defining network.yaml all lnd nodes should be indexed in the same block before any cln nodes otherwise node responsiveness causes the expected index to get out of order with actual regardless of how the channels are opened
Review `test/data/ln_mixed/network.yaml` for an example

3 changes: 3 additions & 0 deletions resources/charts/bitcoincore/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ dependencies:
- name: lnd
version: 0.1.0
condition: ln.lnd
- name: cln
version: 0.1.0
condition: ln.cln

# A chart can be either an 'application' or a 'library' chart.
#
Expand Down
23 changes: 23 additions & 0 deletions resources/charts/bitcoincore/charts/cln/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions resources/charts/bitcoincore/charts/cln/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: cln
description: A Helm chart for CLN

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.1.0"
78 changes: 78 additions & 0 deletions resources/charts/bitcoincore/charts/cln/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{{/*
Expand the name of the PARENT chart.
*/}}
{{- define "bitcoincore.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified PARENT app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "bitcoincore.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}


{{/*
Expand the name of the chart.
*/}}
{{- define "cln.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}-ln
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "cln.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }}-ln
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cln.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "cln.labels" -}}
helm.sh/chart: {{ include "cln.chart" . }}
{{ include "cln.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cln.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cln.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "cln.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "cln.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
36 changes: 36 additions & 0 deletions resources/charts/bitcoincore/charts/cln/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "cln.fullname" . }}
labels:
{{- include "cln.labels" . | nindent 4 }}
data:
config: |
{{- .Values.baseConfig | nindent 4 }}
{{- .Values.defaultConfig | nindent 4 }}
{{- .Values.config | nindent 4 }}
network={{ .Values.global.chain }}
addr=0.0.0.0:{{ .Values.P2PPort }}
bitcoin-rpcconnect={{ include "bitcoincore.fullname" . }}
bitcoin-rpcport={{ index .Values.global .Values.global.chain "RPCPort" }}
bitcoin-rpcpassword={{ .Values.global.rpcpassword }}
alias={{ include "cln.fullname" . }}
announce-addr=dns:{{ include "cln.fullname" . }}:{{ .Values.P2PPort }}
database-upgrade=true
bitcoin-retry-timeout=600
grpc-port={{ .Values.RPCPort }}
grpc-host=0.0.0.0
clnrest-host=0.0.0.0
clnrest-port=3010
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "cln.fullname" . }}-channels
labels:
channels: "true"
{{- include "cln.labels" . | nindent 4 }}
data:
source: {{ include "cln.fullname" . }}
channels: |
{{ .Values.channels | toJson }}
100 changes: 100 additions & 0 deletions resources/charts/bitcoincore/charts/cln/templates/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
apiVersion: v1
kind: Pod
metadata:
name: {{ include "cln.fullname" . }}
labels:
{{- include "cln.labels" . | nindent 4 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app: {{ include "cln.fullname" . }}
{{- if .Values.collectLogs }}
collect_logs: "true"
{{- end }}
chain: {{ .Values.global.chain }}
annotations:
kubectl.kubernetes.io/default-container: "cln"
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 4 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 4 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- name: p2p
containerPort: {{ .Values.P2PPort }}
protocol: TCP
- name: rpc
containerPort: {{ .Values.RPCPort }}
protocol: TCP
- name: rest
containerPort: {{ .Values.RestPort }}
protocol: TCP
command:
- /bin/sh
- -c
- |
lightningd --conf=/root/.lightning/config &
sleep 1
lightning-cli createrune > /working/rune.json
echo "Here is the rune file contents"
cat /working/rune.json
wait
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 8 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 8 }}
startupProbe:
{{- toYaml .Values.startupProbe | nindent 8 }}
resources:
{{- toYaml .Values.resources | nindent 8 }}
volumeMounts:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
- mountPath: /root/.lightning/config
name: config
subPath: config
{{- with .Values.extraContainers }}
{{- toYaml . | nindent 4 }}
{{- end }}
- name: http-server
image: busybox
command: ["/bin/sh", "-c"]
args:
- |
echo "Starting HTTP server..."
busybox httpd -f -p 8080 -h /working
ports:
- containerPort: 8080
name: http
volumeMounts:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- with .Values.volumes }}
{{- toYaml . | nindent 4 }}
{{- end }}
- configMap:
name: {{ include "cln.fullname" . }}
name: config
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 4 }}
{{- end }}
24 changes: 24 additions & 0 deletions resources/charts/bitcoincore/charts/cln/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "cln.fullname" . }}
labels:
{{- include "cln.labels" . | nindent 4 }}
app: {{ include "cln.fullname" . }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.P2PPort }}
targetPort: p2p
protocol: TCP
name: p2p
- port: {{ .Values.RPCPort }}
targetPort: rpc
protocol: TCP
name: rpc
- port: {{ .Values.RestPort }}
targetPort: rest
protocol: TCP
name: rest
selector:
{{- include "cln.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.metricsExport }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "cln.fullname" . }}
labels:
app.kubernetes.io/name: cln-metrics
release: prometheus
spec:
endpoints:
- port: prometheus-metrics
selector:
matchLabels:
app: {{ include "cln.fullname" . }}
{{- end }}
Loading
Loading