Skip to content

Commit

Permalink
[lnd] New (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
bboerst authored Oct 7, 2023
1 parent 2bd537b commit a02ec42
Show file tree
Hide file tree
Showing 14 changed files with 558 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ updates:
directory: "charts/fulcrum"
schedule:
interval: "daily"


- package-ecosystem: "docker"
directory: "charts/lnd"
schedule:
interval: "daily"

- package-ecosystem: "docker"
directory: "charts/lndhub"
schedule:
Expand Down
9 changes: 9 additions & 0 deletions charts/lnd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
name: lnd
version: 0.1.0
appVersion: v0.17.0-beta
description: A golang implementation of a Lightning Network node
keywords:
- lnd
- bitcoin
home: https://github.com/lightningnetwork/lnd
62 changes: 62 additions & 0 deletions charts/lnd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# lnd

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: v0.17.0-beta](https://img.shields.io/badge/AppVersion-v0.17.0--beta-informational?style=flat-square)

A golang implementation of a Lightning Network node

**Homepage:** <https://github.com/lightningnetwork/lnd>

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| autoUnlock | bool | `false` | |
| autoUnlockPassword | string | `"password"` | |
| command[0] | string | `"lnd"` | |
| configurationFile."lnd.conf" | string | `"bitcoin.active=1\nbitcoin.mainnet=0\nbitcoin.testnet=1\ndebuglevel=info\nbitcoin.node=neutrino\nneutrino.addpeer=faucet.lightning.community\nneutrino.addpeer=lnd.bitrefill.com:18333\nrpclisten=0.0.0.0:10009\ntlsextradomain=nodes-lnd-internal.nodes\ntlsextradomain=lnd.example.com\ntlsextraip=0.0.0.0\nprotocol.wumbo-channels=1\nprometheus.enable=false\nprometheus.listen=0.0.0.0:8989"` | |
| externalServices.p2pPort | int | `9735` | |
| externalServices.type | string | `"LoadBalancer"` | |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"lightninglabs/lnd"` | |
| imagePullSecrets | list | `[]` | |
| ingress.rest.annotations."cert-manager.io/cluster-issuer" | string | `"letsencrypt-prod"` | |
| ingress.rest.annotations."kubernetes.io/ingress.class" | string | `"nginx"` | |
| ingress.rest.annotations."nginx.ingress.kubernetes.io/backend-protocol" | string | `"HTTPS"` | |
| ingress.rest.annotations."nginx.ingress.kubernetes.io/enable-cors" | string | `"true"` | |
| ingress.rest.enable | bool | `false` | |
| ingress.rest.hosts[0].host | string | `"lnd.example.com"` | |
| ingress.rest.hosts[0].paths[0].path | string | `"/"` | |
| ingress.rest.hosts[0].paths[0].port | int | `8080` | |
| ingress.rest.tls[0].hosts[0] | string | `"lnd.example.com"` | |
| ingress.rest.tls[0].secretName | string | `"lnd-tls-secret"` | |
| ingress.rpc.annotations."cert-manager.io/cluster-issuer" | string | `"letsencrypt-prod"` | |
| ingress.rpc.annotations."kubernetes.io/ingress.class" | string | `"nginx"` | |
| ingress.rpc.annotations."nginx.ingress.kubernetes.io/backend-protocol" | string | `"GRPCS"` | |
| ingress.rpc.annotations."nginx.ingress.kubernetes.io/enable-cors" | string | `"true"` | |
| ingress.rpc.enabled | bool | `false` | |
| ingress.rpc.hosts[0].host | string | `"rpc.lnd.example.com"` | |
| ingress.rpc.hosts[0].paths[0].path | string | `"/"` | |
| ingress.rpc.hosts[0].paths[0].port | int | `10009` | |
| ingress.rpc.tls[0].hosts[0] | string | `"rpc.lnd.example.com"` | |
| ingress.rpc.tls[0].secretName | string | `"lnd-rpc-tls-secret"` | |
| internalServices.prometheusPort | int | `8989` | |
| internalServices.restPort | int | `8080` | |
| internalServices.rpcPort | int | `10009` | |
| nameOverride | string | `""` | |
| network | string | `"testnet"` | |
| persistence.accessMode | string | `"ReadWriteOnce"` | |
| persistence.enabled | bool | `false` | |
| persistence.size | string | `"5Gi"` | |
| podSecurityContext | object | `{}` | |
| resources.limits.memory | string | `"512Mi"` | |
| resources.requests.cpu | string | `"100m"` | |
| resources.requests.memory | string | `"512Mi"` | |
| securityContext.allowPrivilegeEscalation | bool | `false` | |
| securityContext.capabilities.drop[0] | string | `"ALL"` | |
| securityContext.seccompProfile.type | string | `"RuntimeDefault"` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `nil` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
4 changes: 4 additions & 0 deletions charts/lnd/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Note: Make sure to follow the instructions in the README to finish setting up your wallet.

Once your wallet is setup, the lnd RPC interface can be accessed via port {{ .Values.internalServices.rpcPort }} on the following DNS name from within your cluster:
{{ template "lnd.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local
56 changes: 56 additions & 0 deletions charts/lnd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "lnd.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- 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 "lnd.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

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

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

{{/*
Create the name of the service account to use
*/}}
{{- define "lnd.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "lnd.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
11 changes: 11 additions & 0 deletions charts/lnd/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "lnd.fullname" . }}
labels:
app: {{ template "lnd.name" . }}
chart: {{ template "lnd.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
{{ toYaml .Values.configurationFile | indent 2 }}
112 changes: 112 additions & 0 deletions charts/lnd/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "lnd.fullname" . }}
labels:
app: {{ template "lnd.name" . }}
chart: {{ template "lnd.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
strategy:
type: Recreate
selector:
matchLabels:
app: {{ template "lnd.name" . }}
release: {{ .Release.Name }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
labels:
app: {{ template "lnd.name" . }}
release: {{ .Release.Name }}
spec:
{{- if .Values.configurationFile }}
initContainers:
- name: copy-lnd-config
image: busybox
{{- if .Values.extraconfig }}
command: ['sh', '-c', 'for f in /configmap/*.conf; do (cat "${f}"; echo) >> /root/.lnd/lnd.conf; done']
{{- else }}
command: ['sh', '-c', 'cat /configmap/lnd.conf > /root/.lnd/lnd.conf']
{{- end }}
volumeMounts:
- name: configmap
mountPath: /configmap
- name: config
mountPath: /root/.lnd/
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ template "lnd.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
terminationGracePeriodSeconds: 60
containers:
- name: {{ template "lnd.fullname" . }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ default .Chart.AppVersion .Values.image.tag }}"
command:
{{ toYaml .Values.command | indent 12 }}
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
resources:
{{ toYaml .Values.resources | indent 12 }}
ports:
- name: rpc
containerPort: {{ .Values.internalServices.rpcPort }}
- name: rest
containerPort: {{ .Values.internalServices.restPort }}
- name: prometheus
containerPort: {{ .Values.internalServices.prometheusPort }}
- name: p2p
containerPort: {{ .Values.externalServices.p2pPort }}
volumeMounts:
- name: data
mountPath: /root/.lnd
subPath: .lnd
{{- if .Values.configurationFile }}
- name: config
mountPath: /root/.lnd/lnd.conf
subPath: lnd.conf
{{- end }}
{{- if .Values.autoUnlock }}
- name: secrets
mountPath: /passwords/wallet_password
subPath: wallet_password
{{- end }}
lifecycle:
preStop:
exec:
# Make sure we safely quit lnd so we don't corrupt
# anything
command: ["/bin/lncli", "-n", "{{ .Values.network }}", "stop"]
volumes:
{{- if .Values.autoUnlock }}
- name: secrets
secret:
secretName: {{ template "lnd.fullname" . }}
{{- end }}
{{- if .Values.configurationFile }}
- name: config
emptyDir: {}
- name: configmap
projected:
sources:
- configMap:
name: {{ template "lnd.fullname" . }}
{{- if .Values.extraconfig }}
- secret:
name: {{ .Values.extraconfig.secretName}}
{{- end }}
{{- end }}
- name: data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "lnd.fullname" .) }}
{{- else }}
emptyDir: {}
{{- end -}}
41 changes: 41 additions & 0 deletions charts/lnd/templates/ingress_rest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.ingress.rest.enabled -}}
{{- $fullName := include "lnd.fullname" . -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-rest
{{- with .Values.ingress.rest.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.rest.tls }}
tls:
{{- range .Values.ingress.rest.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.rest.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: Prefix
backend:
service:
name: {{ $fullName }}-internal
port:
number: {{ .port }}
{{- end }}
{{- end }}
{{- end }}
41 changes: 41 additions & 0 deletions charts/lnd/templates/ingress_rpc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.ingress.rpc.enabled -}}
{{- $fullName := include "lnd.fullname" . -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}-rpc
{{- with .Values.ingress.rpc.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.rpc.tls }}
tls:
{{- range .Values.ingress.rpc.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.rpc.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
pathType: Prefix
backend:
service:
name: {{ $fullName }}-internal
port:
number: {{ .port }}
{{- end }}
{{- end }}
{{- end }}
26 changes: 26 additions & 0 deletions charts/lnd/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "lnd.fullname" . }}
annotations:
"helm.sh/resource-policy": keep
labels:
app: {{ template "lnd.name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
{{- if (eq "-" .Values.persistence.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}
9 changes: 9 additions & 0 deletions charts/lnd/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{ if .Values.autoUnlock }}
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: {{ template "lnd.fullname" . }}
data:
wallet_password: {{ .Values.autoUnlockPassword | b64enc }}
{{ end }}
Loading

0 comments on commit a02ec42

Please sign in to comment.