Skip to content
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

Add the hook api #665

Closed
wants to merge 73 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
63f2274
lnd nodes running, connected to tank, rpc working
pinheadmz Aug 23, 2024
b4f244f
test: ensure ln channels and payments with rpc commands
pinheadmz Nov 6, 2024
b637bd3
test: wait for ln nodes to be ready
pinheadmz Nov 6, 2024
e9dfabe
BREAKING REFACTOR: move some values to global, add lnd as subchart
pinheadmz Nov 6, 2024
fac8d11
store channel data from network.yaml in configmaps to open channels
pinheadmz Nov 8, 2024
6a4b46a
import LN json
pinheadmz Nov 8, 2024
4574eb6
Add the hook api
mplsgrant Nov 11, 2024
61109a7
hooks: reduce the noise from the plugin check
mplsgrant Nov 11, 2024
df9f39c
hooks: add func docs to hooks_api.py
mplsgrant Nov 11, 2024
6815d9b
add @api to a number of functions
mplsgrant Nov 11, 2024
43be628
add rudimentary hooks test
mplsgrant Nov 11, 2024
0e97c3d
update hooks commands
mplsgrant Nov 11, 2024
2406805
ln: same macaroon and cert for all nodes
pinheadmz Nov 12, 2024
f43eeda
add ark plugin
mplsgrant Nov 14, 2024
3a2c08e
add demo plugin
mplsgrant Nov 14, 2024
fc253dc
add plugin "mission"
mplsgrant Nov 14, 2024
28d389e
update hooks logic
mplsgrant Nov 14, 2024
71e217c
ln: open rest api and ensure scenarios can open channels
pinheadmz Nov 14, 2024
131689f
use k8s client in commander to get pods instead of warnet.json
pinheadmz Nov 15, 2024
11d88ca
namespaces: give wargames accounts auth to create commander roles
pinheadmz Nov 15, 2024
98e209a
add ln nodes and channels along with tanks to commander
pinheadmz Nov 15, 2024
e400b3d
minor: lint and remove duplicate config maps
pinheadmz Nov 18, 2024
fef2e67
update namespace permissions
mplsgrant Nov 20, 2024
1f7567a
ln_init: up through opening all channels
pinheadmz Nov 22, 2024
34cd1f9
Add the hook api
mplsgrant Nov 11, 2024
50c8521
hooks: reduce the noise from the plugin check
mplsgrant Nov 11, 2024
e32eeb9
hooks: add func docs to hooks_api.py
mplsgrant Nov 11, 2024
acee874
add @api to a number of functions
mplsgrant Nov 11, 2024
0c9ca5d
add rudimentary hooks test
mplsgrant Nov 11, 2024
7cc9fb7
update hooks commands
mplsgrant Nov 11, 2024
097ea4a
add ark plugin
mplsgrant Nov 14, 2024
7134126
add demo plugin
mplsgrant Nov 14, 2024
e9503fb
add plugin "mission"
mplsgrant Nov 14, 2024
6b83422
update hooks logic
mplsgrant Nov 14, 2024
737a0b1
add simln charts
mplsgrant Nov 18, 2024
4f9870a
fix config path
mplsgrant Nov 18, 2024
ab06a8e
Merge branch '2024-11-ln-helm-plugin' into 2024-11-hook-api
mplsgrant Nov 18, 2024
8ed8973
list and toggle plugins; clean up cruft
mplsgrant Nov 19, 2024
d9b1fc7
add get_pods_with_label
mplsgrant Nov 19, 2024
6acaa1a
update hooks and simln plugin
mplsgrant Nov 19, 2024
0485204
add test
mplsgrant Nov 19, 2024
990122e
k8s: make download fn; move get_pods_with_label
mplsgrant Nov 20, 2024
dae9ba1
hooks: add args to `run`
mplsgrant Nov 20, 2024
0677b92
update tests
mplsgrant Nov 20, 2024
eb02ecb
clean up simln chart
mplsgrant Nov 20, 2024
9d0448e
make plugin functionality discoverable
mplsgrant Nov 20, 2024
1dc7e8d
clean up prompts
mplsgrant Nov 20, 2024
0cb1163
update simln test
mplsgrant Nov 20, 2024
14c50c3
improve test
mplsgrant Nov 20, 2024
585f33d
rename hooks -> plugin
mplsgrant Nov 20, 2024
389310a
improve ergonomics
mplsgrant Nov 20, 2024
20410b7
tighten up simln and plugin interaction
mplsgrant Nov 21, 2024
7e6eea3
get mission=simln
mplsgrant Nov 21, 2024
f0f107d
fix call to download
mplsgrant Nov 21, 2024
cf84808
wait longer for everyone to have a host
mplsgrant Nov 21, 2024
a39955a
improve function menu
mplsgrant Nov 21, 2024
cef2766
add error handling around get_example_activity
mplsgrant Nov 22, 2024
a2abbdb
add positional params
mplsgrant Nov 22, 2024
1d4227f
trim the fat on parameter parsing
mplsgrant Nov 22, 2024
f6871ed
clear out unneeded Param classes
mplsgrant Nov 22, 2024
b4f8468
minor plugin cleanups
mplsgrant Nov 22, 2024
5d4104c
expand simln test
mplsgrant Nov 22, 2024
97cad87
misc cleanup
mplsgrant Nov 23, 2024
afef50c
update ark's dockerfiles & instructions
mplsgrant Nov 24, 2024
ec48e42
clean up imports, ark
mplsgrant Nov 25, 2024
02a0b99
add simpler plugins with click
mplsgrant Nov 26, 2024
4d8397f
remove cruft
mplsgrant Nov 26, 2024
141c738
remove `run` from plugins
mplsgrant Nov 26, 2024
f9e527d
remove `api`
mplsgrant Nov 26, 2024
84198a8
rectify plugin/register names
mplsgrant Nov 26, 2024
9e5f37e
use better looking separator
mplsgrant Nov 26, 2024
9cfdbc7
implement SimLN plugin via click
mplsgrant Nov 26, 2024
5f11d3f
imporove test
mplsgrant Nov 26, 2024
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
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ jobs:
- dag_connection_test.py
- graph_test.py
- logging_test.py
- ln_basic_test.py
- rpc_test.py
- services_test.py
- signet_test.py
- scenarios_test.py
- namespace_admin_test.py
- simln_test.py
steps:
- uses: actions/checkout@v4
- uses: azure/[email protected]
Expand Down
5 changes: 5 additions & 0 deletions resources/charts/bitcoincore/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ apiVersion: v2
name: bitcoincore
description: A Helm chart for Bitcoin Core

dependencies:
- name: lnd
version: 0.1.0
condition: ln.lnd

# 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
Expand Down
25 changes: 25 additions & 0 deletions resources/charts/bitcoincore/charts/lnd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v2
name: lnd

description: A Helm chart for LND

# 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/lnd/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 "lnd.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 "lnd.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 "lnd.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Selector labels
*/}}
{{- define "lnd.selectorLabels" -}}
app.kubernetes.io/name: {{ include "lnd.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- 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 }}
52 changes: 52 additions & 0 deletions resources/charts/bitcoincore/charts/lnd/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "lnd.fullname" . }}
labels:
{{- include "lnd.labels" . | nindent 4 }}
data:
lnd.conf: |
{{- .Values.baseConfig | nindent 4 }}
{{- .Values.defaultConfig | nindent 4 }}
{{- .Values.config | nindent 4 }}
bitcoin.{{ .Values.global.chain }}=1
bitcoind.rpcpass={{ .Values.global.rpcpassword }}
bitcoind.rpchost={{ include "bitcoincore.fullname" . }}:{{ index .Values.global .Values.global.chain "RPCPort" }}
bitcoind.zmqpubrawblock=tcp://{{ include "bitcoincore.fullname" . }}:{{ .Values.global.ZMQBlockPort }}
bitcoind.zmqpubrawtx=tcp://{{ include "bitcoincore.fullname" . }}:{{ .Values.global.ZMQTxPort }}
alias={{ include "lnd.fullname" . }}
externalhosts={{ include "lnd.fullname" . }}
tlsextradomain={{ include "lnd.fullname" . }}
tls.cert: |
-----BEGIN CERTIFICATE-----
MIIB8TCCAZagAwIBAgIUJDsR6mmY+TaO9pCfjtotlbOkzJMwCgYIKoZIzj0EAwIw
MjEfMB0GA1UECgwWbG5kIGF1dG9nZW5lcmF0ZWQgY2VydDEPMA0GA1UEAwwGd2Fy
bmV0MB4XDTI0MTExMTE2NTM1MFoXDTM0MTEwOTE2NTM1MFowMjEfMB0GA1UECgwW
bG5kIGF1dG9nZW5lcmF0ZWQgY2VydDEPMA0GA1UEAwwGd2FybmV0MFkwEwYHKoZI
zj0CAQYIKoZIzj0DAQcDQgAEBVltIvaTlAQI/3FFatTqVflZuZdRJ0SmRMSJrFLP
tp0fxE7hmteSt6gjQriy90fP8j9OJXBNAjt915kLY4zVvqOBiTCBhjAOBgNVHQ8B
Af8EBAMCAqQwEwYDVR0lBAwwCgYIKwYBBQUHAwEwDwYDVR0TAQH/BAUwAwEB/zAd
BgNVHQ4EFgQU5d8QMrwhLgTkDjWA+eXZGz+dybUwLwYDVR0RBCgwJoIJbG9jYWxo
b3N0ggEqhwR/AAABhxAAAAAAAAAAAAAAAAAAAAABMAoGCCqGSM49BAMCA0kAMEYC
IQDPofN0fEl5gTwCYhk3nZbjMqJhZ8BsSJ6K8XRhxr7zbwIhAPsgQCFOqUWg632O
NEO53OQ6CIqnpxSskjsFNH4ZBQOE
-----END CERTIFICATE-----
tls.key: |
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIIcFtWTLQv5JaRRxdkPKkO98OrvgeztbZ7h8Ev/4UbE4oAoGCCqGSM49
AwEHoUQDQgAEBVltIvaTlAQI/3FFatTqVflZuZdRJ0SmRMSJrFLPtp0fxE7hmteS
t6gjQriy90fP8j9OJXBNAjt915kLY4zVvg==
-----END EC PRIVATE KEY-----

---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "lnd.fullname" . }}-channels
labels:
channels: "true"
{{- include "lnd.labels" . | nindent 4 }}
data:
source: {{ include "lnd.fullname" . }}
channels: |
{{ .Values.channels | toJson }}
82 changes: 82 additions & 0 deletions resources/charts/bitcoincore/charts/lnd/templates/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
apiVersion: v1
kind: Pod
metadata:
name: {{ include "lnd.fullname" . }}
labels:
{{- include "lnd.labels" . | nindent 4 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
app: {{ include "lnd.fullname" . }}
{{- if .Values.collectLogs }}
collect_logs: "true"
{{- end }}
chain: {{ .Values.global.chain }}
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: rpc
containerPort: {{ .Values.RPCPort }}
protocol: TCP
- name: p2p
containerPort: {{ .Values.P2PPort }}
protocol: TCP
- name: rest
containerPort: {{ .Values.RestPort }}
protocol: TCP
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/.lnd/lnd.conf
name: config
subPath: lnd.conf
- mountPath: /root/.lnd/tls.key
name: config
subPath: tls.key
- mountPath: /root/.lnd/tls.cert
name: config
subPath: tls.cert
{{- if .Values.circuitBreaker }}
- name: circuitbreaker
image: pinheadmz/circuitbreaker:278737d
imagePullPolicy: IfNotPresent
{{- end}}
volumes:
{{- with .Values.volumes }}
{{- toYaml . | nindent 4 }}
{{- end }}
- configMap:
name: {{ include "lnd.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/lnd/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "lnd.fullname" . }}
labels:
{{- include "lnd.labels" . | nindent 4 }}
app: {{ include "lnd.fullname" . }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.RPCPort }}
targetPort: rpc
protocol: TCP
name: rpc
- port: {{ .Values.P2PPort }}
targetPort: p2p
protocol: TCP
name: p2p
- port: {{ .Values.RestPort }}
targetPort: rest
protocol: TCP
name: rest
selector:
{{- include "lnd.selectorLabels" . | nindent 4 }}
Loading