Skip to content

Commit e2a0036

Browse files
authored
Merge pull request #713 from macgyver13/add-ln-nodes
Add CLN support
2 parents 4367c7c + f21bfdd commit e2a0036

File tree

21 files changed

+1034
-103
lines changed

21 files changed

+1034
-103
lines changed

resources/charts/bitcoincore/Chart.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ dependencies:
66
- name: lnd
77
version: 0.1.0
88
condition: ln.lnd
9+
- name: cln
10+
version: 0.1.0
11+
condition: ln.cln
912

1013
# A chart can be either an 'application' or a 'library' chart.
1114
#
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: cln
3+
description: A Helm chart for CLN
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
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 "cln.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 "cln.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 "cln.chart" -}}
46+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
47+
{{- end }}
48+
49+
{{/*
50+
Common labels
51+
*/}}
52+
{{- define "cln.labels" -}}
53+
helm.sh/chart: {{ include "cln.chart" . }}
54+
{{ include "cln.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 "cln.selectorLabels" -}}
65+
app.kubernetes.io/name: {{ include "cln.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 "cln.serviceAccountName" -}}
73+
{{- if .Values.serviceAccount.create }}
74+
{{- default (include "cln.fullname" .) .Values.serviceAccount.name }}
75+
{{- else }}
76+
{{- default "default" .Values.serviceAccount.name }}
77+
{{- end }}
78+
{{- end }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ include "cln.fullname" . }}
5+
labels:
6+
{{- include "cln.labels" . | nindent 4 }}
7+
data:
8+
config: |
9+
{{- .Values.baseConfig | nindent 4 }}
10+
{{- .Values.defaultConfig | nindent 4 }}
11+
{{- .Values.config | nindent 4 }}
12+
network={{ .Values.global.chain }}
13+
addr=0.0.0.0:{{ .Values.P2PPort }}
14+
bitcoin-rpcconnect={{ include "bitcoincore.fullname" . }}
15+
bitcoin-rpcport={{ index .Values.global .Values.global.chain "RPCPort" }}
16+
bitcoin-rpcpassword={{ .Values.global.rpcpassword }}
17+
alias={{ include "cln.fullname" . }}
18+
announce-addr=dns:{{ include "cln.fullname" . }}:{{ .Values.P2PPort }}
19+
database-upgrade=true
20+
bitcoin-retry-timeout=600
21+
grpc-port={{ .Values.RPCPort }}
22+
grpc-host=0.0.0.0
23+
clnrest-host=0.0.0.0
24+
clnrest-port=3010
25+
---
26+
apiVersion: v1
27+
kind: ConfigMap
28+
metadata:
29+
name: {{ include "cln.fullname" . }}-channels
30+
labels:
31+
channels: "true"
32+
{{- include "cln.labels" . | nindent 4 }}
33+
data:
34+
source: {{ include "cln.fullname" . }}
35+
channels: |
36+
{{ .Values.channels | toJson }}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: {{ include "cln.fullname" . }}
5+
labels:
6+
{{- include "cln.labels" . | nindent 4 }}
7+
{{- with .Values.podLabels }}
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
app: {{ include "cln.fullname" . }}
11+
{{- if .Values.collectLogs }}
12+
collect_logs: "true"
13+
{{- end }}
14+
chain: {{ .Values.global.chain }}
15+
annotations:
16+
kubectl.kubernetes.io/default-container: "cln"
17+
spec:
18+
{{- with .Values.imagePullSecrets }}
19+
imagePullSecrets:
20+
{{- toYaml . | nindent 4 }}
21+
{{- end }}
22+
securityContext:
23+
{{- toYaml .Values.podSecurityContext | nindent 4 }}
24+
containers:
25+
- name: {{ .Chart.Name }}
26+
securityContext:
27+
{{- toYaml .Values.securityContext | nindent 8 }}
28+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
29+
imagePullPolicy: {{ .Values.image.pullPolicy }}
30+
ports:
31+
- name: p2p
32+
containerPort: {{ .Values.P2PPort }}
33+
protocol: TCP
34+
- name: rpc
35+
containerPort: {{ .Values.RPCPort }}
36+
protocol: TCP
37+
- name: rest
38+
containerPort: {{ .Values.RestPort }}
39+
protocol: TCP
40+
command:
41+
- /bin/sh
42+
- -c
43+
- |
44+
lightningd --conf=/root/.lightning/config &
45+
sleep 1
46+
lightning-cli createrune > /working/rune.json
47+
echo "Here is the rune file contents"
48+
cat /working/rune.json
49+
wait
50+
livenessProbe:
51+
{{- toYaml .Values.livenessProbe | nindent 8 }}
52+
readinessProbe:
53+
{{- toYaml .Values.readinessProbe | nindent 8 }}
54+
startupProbe:
55+
{{- toYaml .Values.startupProbe | nindent 8 }}
56+
resources:
57+
{{- toYaml .Values.resources | nindent 8 }}
58+
volumeMounts:
59+
{{- with .Values.volumeMounts }}
60+
{{- toYaml . | nindent 8 }}
61+
{{- end }}
62+
- mountPath: /root/.lightning/config
63+
name: config
64+
subPath: config
65+
{{- with .Values.extraContainers }}
66+
{{- toYaml . | nindent 4 }}
67+
{{- end }}
68+
- name: http-server
69+
image: busybox
70+
command: ["/bin/sh", "-c"]
71+
args:
72+
- |
73+
echo "Starting HTTP server..."
74+
busybox httpd -f -p 8080 -h /working
75+
ports:
76+
- containerPort: 8080
77+
name: http
78+
volumeMounts:
79+
{{- with .Values.volumeMounts }}
80+
{{- toYaml . | nindent 8 }}
81+
{{- end }}
82+
volumes:
83+
{{- with .Values.volumes }}
84+
{{- toYaml . | nindent 4 }}
85+
{{- end }}
86+
- configMap:
87+
name: {{ include "cln.fullname" . }}
88+
name: config
89+
{{- with .Values.nodeSelector }}
90+
nodeSelector:
91+
{{- toYaml . | nindent 4 }}
92+
{{- end }}
93+
{{- with .Values.affinity }}
94+
affinity:
95+
{{- toYaml . | nindent 4 }}
96+
{{- end }}
97+
{{- with .Values.tolerations }}
98+
tolerations:
99+
{{- toYaml . | nindent 4 }}
100+
{{- end }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ include "cln.fullname" . }}
5+
labels:
6+
{{- include "cln.labels" . | nindent 4 }}
7+
app: {{ include "cln.fullname" . }}
8+
spec:
9+
type: {{ .Values.service.type }}
10+
ports:
11+
- port: {{ .Values.P2PPort }}
12+
targetPort: p2p
13+
protocol: TCP
14+
name: p2p
15+
- port: {{ .Values.RPCPort }}
16+
targetPort: rpc
17+
protocol: TCP
18+
name: rpc
19+
- port: {{ .Values.RestPort }}
20+
targetPort: rest
21+
protocol: TCP
22+
name: rest
23+
selector:
24+
{{- include "cln.selectorLabels" . | nindent 4 }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- if .Values.metricsExport }}
2+
apiVersion: monitoring.coreos.com/v1
3+
kind: ServiceMonitor
4+
metadata:
5+
name: {{ include "cln.fullname" . }}
6+
labels:
7+
app.kubernetes.io/name: cln-metrics
8+
release: prometheus
9+
spec:
10+
endpoints:
11+
- port: prometheus-metrics
12+
selector:
13+
matchLabels:
14+
app: {{ include "cln.fullname" . }}
15+
{{- end }}

0 commit comments

Comments
 (0)