Skip to content

Commit 6745906

Browse files
committed
Merge branch 'circuit-breaker-plugin' of https://github.com/Camillarhi/warnet into circuit-breaker-plugin
2 parents 91da2a1 + a1bbd23 commit 6745906

File tree

4 files changed

+68
-3
lines changed

4 files changed

+68
-3
lines changed

resources/charts/bitcoincore/charts/lnd/templates/configmap.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,18 @@ data:
3838
AwEHoUQDQgAEBVltIvaTlAQI/3FFatTqVflZuZdRJ0SmRMSJrFLPtp0fxE7hmteS
3939
t6gjQriy90fP8j9OJXBNAjt915kLY4zVvg==
4040
-----END EC PRIVATE KEY-----
41-
MACAROON_HEX: 0201036c6e6402f801030a1062beabbf2a614b112128afa0c0b4fdd61201301a160a0761646472657373120472656164120577726974651a130a04696e666f120472656164120577726974651a170a08696e766f69636573120472656164120577726974651a210a086d616361726f6f6e120867656e6572617465120472656164120577726974651a160a076d657373616765120472656164120577726974651a170a086f6666636861696e120472656164120577726974651a160a076f6e636861696e120472656164120577726974651a140a057065657273120472656164120577726974651a180a067369676e6572120867656e657261746512047265616400000620b17be53e367290871681055d0de15587f6d1cd47d1248fe2662ae27f62cfbdc6
41+
42+
MACAROON_HEX: |
43+
0201036c6e6402f801030a1062beabbf2a614b112128afa0c0b4fdd61201301a160a0
44+
761646472657373120472656164120577726974651a130a04696e666f120472656164
45+
120577726974651a170a08696e766f69636573120472656164120577726974651a210
46+
a086d616361726f6f6e120867656e6572617465120472656164120577726974651a16
47+
0a076d657373616765120472656164120577726974651a170a086f6666636861696e1
48+
20472656164120577726974651a160a076f6e636861696e1204726561641205777269
49+
74651a140a057065657273120472656164120577726974651a180a067369676e65721
50+
20867656e657261746512047265616400000620b17be53e367290871681055d0de155
51+
87f6d1cd47d1248fe2662ae27f62cfbdc6
52+
4253
---
4354
apiVersion: v1
4455
kind: ConfigMap

resources/charts/bitcoincore/charts/lnd/templates/pod.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,28 @@ spec:
2121
{{- end }}
2222
securityContext:
2323
{{- toYaml .Values.podSecurityContext | nindent 4 }}
24+
{{- if .Values.enableInitContainers }}
25+
initContainers:
26+
- name: prepare-files
27+
image: busybox
28+
command:
29+
- sh
30+
- -c
31+
- |
32+
# Read the hex-encoded macaroon from the ConfigMap
33+
HEX_MACAROON=$(cat /config/MACAROON_HEX)
34+
35+
# Convert the hex-encoded macaroon to binary format
36+
echo "$HEX_MACAROON" | xxd -r -p > /shared-data/admin.macaroon
37+
38+
# Ensure the file has the correct permissions
39+
chmod 644 /shared-data/admin.macaroon
40+
volumeMounts:
41+
- name: {{ .Values.sharedVolume.name }}
42+
mountPath: {{ .Values.sharedVolume.mountPath }}
43+
- name: config
44+
mountPath: /config
45+
{{- end }}
2446
containers:
2547
- name: {{ .Chart.Name }}
2648
securityContext:
@@ -46,6 +68,8 @@ spec:
4668
resources:
4769
{{- toYaml .Values.resources | nindent 8 }}
4870
volumeMounts:
71+
- mountPath: {{ .Values.sharedVolume.mountPath }}
72+
name: {{ .Values.sharedVolume.name }}
4973
{{- with .Values.volumeMounts }}
5074
{{- toYaml . | nindent 8 }}
5175
{{- end }}
@@ -61,7 +85,12 @@ spec:
6185
{{- with .Values.extraContainers }}
6286
{{- toYaml . | nindent 4 }}
6387
{{- end }}
88+
{{- with .Values.extraContainers }}
89+
{{- toYaml . | nindent 4 }}
90+
{{- end }}
6491
volumes:
92+
- name: {{ .Values.sharedVolume.name }}
93+
emptyDir: {}
6594
{{- with .Values.volumes }}
6695
{{- toYaml . | nindent 4 }}
6796
{{- end }}

resources/charts/bitcoincore/charts/lnd/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,12 @@ config: ""
132132
defaultConfig: ""
133133

134134
channels: []
135+
136+
# Controls whether the initContainers should be included
137+
enableInitContainers: true
138+
139+
# Shared volume configuration for storing shared data (e.g., macaroons or other files)
140+
# This volume is mounted at the specified mountPath and can be used for inter-container communication.
141+
sharedVolume:
142+
name: shared-data
143+
mountPath: /shared-data

resources/networks/hello/network.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,23 @@ nodes:
3232
target: tank-0004-ln
3333
capacity: 100000
3434
push_amt: 50000
35-
35+
extraContainers:
36+
- name: circuitbreaker
37+
image: camillarhi/circuitbreaker:latest
38+
imagePullPolicy: IfNotPresent
39+
args:
40+
- "--network=regtest"
41+
- "--rpcserver=localhost:10009"
42+
- "--tlscertpath=/tls.cert"
43+
- "--macaroonpath=/shared-data/admin.macaroon"
44+
- "--httplisten=0.0.0.0:9235"
45+
volumeMounts:
46+
- name: shared-data
47+
mountPath: /shared-data
48+
- name: config
49+
mountPath: /tls.cert
50+
subPath: tls.cert
51+
3652
- name: tank-0004
3753
addnode:
3854
- tank-0000
@@ -84,4 +100,4 @@ plugins: # Each plugin section has a number of hooks available (preDeploy, post
84100
hello:
85101
entrypoint: "../../plugins/hello"
86102
helloTo: "postNetwork!"
87-
podName: "hello-post-network"
103+
podName: "hello-post-network"

0 commit comments

Comments
 (0)