From d98edc78facb2a7d43bfb42cd2769eafadc63919 Mon Sep 17 00:00:00 2001 From: Matthew Zipkin Date: Fri, 4 Oct 2024 10:03:23 -0400 Subject: [PATCH 1/2] chart: set rpcpassword as a value, add to labels for scenarios --- resources/charts/bitcoincore/templates/configmap.yaml | 1 + resources/charts/bitcoincore/templates/pod.yaml | 1 + resources/charts/bitcoincore/values.yaml | 3 ++- src/warnet/control.py | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/charts/bitcoincore/templates/configmap.yaml b/resources/charts/bitcoincore/templates/configmap.yaml index e666d0ed5..7d540bee3 100644 --- a/resources/charts/bitcoincore/templates/configmap.yaml +++ b/resources/charts/bitcoincore/templates/configmap.yaml @@ -11,6 +11,7 @@ data: {{ template "bitcoincore.check_semver" . }} {{- .Values.baseConfig | nindent 4 }} rpcport={{ index .Values .Values.chain "RPCPort" }} + rpcpassword={{ .Values.rpcpassword }} zmqpubrawblock=tcp://0.0.0.0:{{ .Values.ZMQBlockPort }} zmqpubrawtx=tcp://0.0.0.0:{{ .Values.ZMQTxPort }} {{- .Values.defaultConfig | nindent 4 }} diff --git a/resources/charts/bitcoincore/templates/pod.yaml b/resources/charts/bitcoincore/templates/pod.yaml index bde1c9ea6..b63ecb409 100644 --- a/resources/charts/bitcoincore/templates/pod.yaml +++ b/resources/charts/bitcoincore/templates/pod.yaml @@ -9,6 +9,7 @@ metadata: {{- end }} chain: {{ .Values.chain }} RPCPort: "{{ index .Values .Values.chain "RPCPort" }}" + rpcpassword: {{ .Values.rpcpassword }} app: {{ include "bitcoincore.fullname" . }} {{- if .Values.collectLogs }} collect_logs: "true" diff --git a/resources/charts/bitcoincore/values.yaml b/resources/charts/bitcoincore/values.yaml index 1ffb8f5e5..4736d6415 100644 --- a/resources/charts/bitcoincore/values.yaml +++ b/resources/charts/bitcoincore/values.yaml @@ -124,12 +124,13 @@ baseConfig: | fallbackfee=0.00001000 listen=1 rpcuser=user - rpcpassword=password + # rpcpassword MUST be set as a chart value rpcallowip=0.0.0.0/0 rpcbind=0.0.0.0 rest=1 # rpcport and zmq endpoints are configured by chain in configmap.yaml +rpcpassword: gn0cchi config: "" diff --git a/src/warnet/control.py b/src/warnet/control.py index 6db4aec1a..43c895cfb 100644 --- a/src/warnet/control.py +++ b/src/warnet/control.py @@ -205,7 +205,7 @@ def run(scenario_file: str, debug: bool, source_dir, additional_args: tuple[str] "rpc_host": tank.status.pod_ip, "rpc_port": int(tank.metadata.labels["RPCPort"]), "rpc_user": "user", - "rpc_password": "password", + "rpc_password": tank.metadata.labels["rpcpassword"], "init_peers": [], } for tank in tankpods From 228c674bf29f5af0ae14171c24fa577b3d1dcdec Mon Sep 17 00:00:00 2001 From: Matthew Zipkin Date: Fri, 4 Oct 2024 10:39:00 -0400 Subject: [PATCH 2/2] chart: get configured rpcpassword from chart for prometheus exporter --- resources/charts/bitcoincore/templates/pod.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/charts/bitcoincore/templates/pod.yaml b/resources/charts/bitcoincore/templates/pod.yaml index b63ecb409..f65807320 100644 --- a/resources/charts/bitcoincore/templates/pod.yaml +++ b/resources/charts/bitcoincore/templates/pod.yaml @@ -90,7 +90,7 @@ spec: - name: BITCOIN_RPC_USER value: user - name: BITCOIN_RPC_PASSWORD - value: password + value: {{ .Values.rpcpassword }} {{- if .Values.metrics }} - name: METRICS value: {{ .Values.metrics }}