Skip to content

Commit 09af277

Browse files
authored
Merge pull request #5 from Camillarhi/circuitbreaker4
Circuitbreaker4
2 parents 3359a13 + 85f0dd6 commit 09af277

File tree

3 files changed

+34
-34
lines changed

3 files changed

+34
-34
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@ data:
3838
t6gjQriy90fP8j9OJXBNAjt915kLY4zVvg==
3939
-----END EC PRIVATE KEY-----
4040
41+
MACAROON_HEX: |
42+
0201036c6e6402f801030a1062beabbf2a614b112128afa0c0b4fdd61201301a160a0
43+
761646472657373120472656164120577726974651a130a04696e666f120472656164
44+
120577726974651a170a08696e766f69636573120472656164120577726974651a210
45+
a086d616361726f6f6e120867656e6572617465120472656164120577726974651a16
46+
0a076d657373616765120472656164120577726974651a170a086f6666636861696e1
47+
20472656164120577726974651a160a076f6e636861696e1204726561641205777269
48+
74651a140a057065657273120472656164120577726974651a180a067369676e65721
49+
20867656e657261746512047265616400000620b17be53e367290871681055d0de155
50+
87f6d1cd47d1248fe2662ae27f62cfbdc6
51+
4152
---
4253
apiVersion: v1
4354
kind: ConfigMap

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

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,21 @@ spec:
2626
command:
2727
- sh
2828
- -c
29-
- |
30-
cp /root/.lnd/tls.cert /root/.lnd/tls_copy.cert
31-
chmod 644 /root/.lnd/tls_copy.cert
29+
- |
30+
# Read the hex-encoded macaroon from the ConfigMap
31+
HEX_MACAROON=$(cat /config/MACAROON_HEX)
32+
33+
# Convert the hex-encoded macaroon to binary format
34+
echo "$HEX_MACAROON" | xxd -r -p > /shared-data/admin.macaroon
35+
36+
# Ensure the file has the correct permissions
37+
chmod 644 /shared-data/admin.macaroon
3238
volumeMounts:
33-
- name: lnd-data
34-
mountPath: /root/.lnd
39+
- name: shared-data
40+
mountPath: /shared-data
3541
- name: config
36-
mountPath: /root/.lnd/tls.cert
37-
subPath: tls.cert
38-
{{- end }}
42+
mountPath: /config
43+
3944
containers:
4045
- name: {{ .Chart.Name }}
4146
securityContext:
@@ -61,8 +66,8 @@ spec:
6166
resources:
6267
{{- toYaml .Values.resources | nindent 8 }}
6368
volumeMounts:
64-
- name: lnd-data
65-
mountPath: /root/.lnd
69+
- mountPath: /shared-data
70+
name: shared-data
6671
{{- with .Values.volumeMounts }}
6772
{{- toYaml . | nindent 8 }}
6873
{{- end }}
@@ -79,7 +84,7 @@ spec:
7984
{{- toYaml . | nindent 4 }}
8085
{{- end }}
8186
volumes:
82-
- name: lnd-data
87+
- name: shared-data
8388
emptyDir: {}
8489
{{- with .Values.volumes }}
8590
{{- toYaml . | nindent 4 }}

resources/networks/hello/network.yaml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,36 +34,20 @@ nodes:
3434
push_amt: 50000
3535
extraContainers:
3636
- name: circuitbreaker
37-
securityContext:
38-
privileged: true
39-
capabilities:
40-
add:
41-
- NET_ADMIN
42-
- NET_RAW
4337
image: camillarhi/circuitbreaker:latest
4438
imagePullPolicy: IfNotPresent
4539
args:
4640
- "--network=regtest"
4741
- "--rpcserver=localhost:10009"
48-
- "--tlscertpath=/root/.lnd/tls_copy.cert"
49-
- "--macaroonpath=/root/.lnd/data/chain/bitcoin/regtest/admin.macaroon"
42+
- "--tlscertpath=/tls.cert"
43+
- "--macaroonpath=/shared-data/admin.macaroon"
5044
- "--httplisten=0.0.0.0:9235"
5145
volumeMounts:
52-
- name: lnd-data
53-
mountPath: /root/.lnd
54-
readinessProbe:
55-
exec:
56-
command:
57-
- /bin/sh
58-
- -c
59-
- |
60-
# Check if tls.cert exists and is readable
61-
test -f /root/.lnd/tls.cert && echo "tls.cert found" || exit 1
62-
# Check if admin.macaroon exists and is readable
63-
test -f /root/.lnd/data/chain/bitcoin/regtest/admin.macaroon && echo "macaroon found" || exit 1
64-
initialDelaySeconds: 10
65-
periodSeconds: 5
66-
timeoutSeconds: 1
46+
- name: shared-data
47+
mountPath: /shared-data
48+
- name: config
49+
mountPath: /tls.cert
50+
subPath: tls.cert
6751

6852
- name: tank-0004
6953
addnode:

0 commit comments

Comments
 (0)