From 298c85d28a8fb09f545709d2fa2657f982c298b5 Mon Sep 17 00:00:00 2001 From: chubmann Date: Wed, 7 Sep 2022 12:03:23 +0200 Subject: [PATCH] Fix rpcuser and rpcpassword mismatch on restarts --- chart/bitcoind/Chart.yaml | 4 ++-- chart/bitcoind/templates/configmap.yaml | 4 +++- chart/bitcoind/templates/deployment.yaml | 1 - chart/bitcoind/templates/secrets.yaml | 6 +++--- chart/bitcoind/values.yaml | 6 +++--- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/chart/bitcoind/Chart.yaml b/chart/bitcoind/Chart.yaml index 55b87b7..0295b60 100644 --- a/chart/bitcoind/Chart.yaml +++ b/chart/bitcoind/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 appVersion: 22.0 description: Bitcoin node chart name: bitcoind -version: 1.1.2 +version: 1.1.3 home: https://chrisrun.github.io/bitcoind-chart/ icon: https://upload.wikimedia.org/wikipedia/commons/thumb/4/46/Bitcoin.svg/1024px-Bitcoin.svg.png keywords: @@ -16,4 +16,4 @@ maintainers: email: chrisrun@users.noreply.github.com url: https://chrisrun.github.io/bitcoind-chart/ sources: - - https://github.com/chrisrun/bitcoind-chart/ \ No newline at end of file + - https://github.com/chrisrun/bitcoind-chart/ diff --git a/chart/bitcoind/templates/configmap.yaml b/chart/bitcoind/templates/configmap.yaml index aef5ad9..a6709a5 100644 --- a/chart/bitcoind/templates/configmap.yaml +++ b/chart/bitcoind/templates/configmap.yaml @@ -9,15 +9,17 @@ metadata: heritage: {{ .Release.Service }} data: bitcoin.conf: | + {{ if ne .Values.configuration.network "mainnet" }} {{ include "network" . }}=1 [{{ include "network" . }}] + {{ end }} zmqpubrawblock=tcp://0.0.0.0:28332 zmqpubrawtx=tcp://0.0.0.0:28333 txindex={{ .Values.configuration.txindex }} # server=1 tells Bitcoin-Qt and bitcoind to accept JSON-RPC commands server={{ .Values.configuration.server }} rpcbind=0.0.0.0 #this is restricted from within the cluster - rpcallowip=0.0.0.0/0 #this is restricted from within the cluster + rpcallowip={{ .Values.configuration.rpcallowip }} #this is restricted from within the cluster, but can be further restricted by the values.yaml # Print to console (stdout) so that "docker logs bitcoind" prints useful # information. printtoconsole={{ .Values.configuration.printtoconsole | default 1 }} diff --git a/chart/bitcoind/templates/deployment.yaml b/chart/bitcoind/templates/deployment.yaml index b02453f..7d90a8b 100644 --- a/chart/bitcoind/templates/deployment.yaml +++ b/chart/bitcoind/templates/deployment.yaml @@ -36,7 +36,6 @@ spec: {{ else }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" {{ end }} - imagePullPolicy: {{ .Values.image.pullPolicy | quote }} resources: {{ toYaml .Values.resources | nindent 12 }} diff --git a/chart/bitcoind/templates/secrets.yaml b/chart/bitcoind/templates/secrets.yaml index b1e78b1..5db654e 100644 --- a/chart/bitcoind/templates/secrets.yaml +++ b/chart/bitcoind/templates/secrets.yaml @@ -9,18 +9,18 @@ metadata: heritage: {{ .Release.Service }} data: {{- if .Release.IsInstall }} - rpcpassword: {{ randAlphaNum .Values.configuration.passwordLength | b64enc }} + rpcpassword: {{ randAlphaNum (int .Values.configuration.passwordLength) | b64enc }} {{ else }} # `index` function is necessary because the property name contains a dash. # Otherwise (...).data.db_password would have worked too. rpcpassword: {{ index (lookup "v1" "Secret" .Release.Namespace "bitcoind").data "rpcpassword" }} {{ end }} {{- if .Release.IsInstall }} - rpcuser: {{ .Values.configuration.rpcuser | default randAlphaNum 8 | b64enc }} + rpcuser: {{ .Values.configuration.rpcuser | default (randAlphaNum 8) | b64enc }} {{ else }} {{ if (.Values.configuration.rpcuser) }} rpcuser: {{ .Values.configuration.rpcuser | b64enc}} {{ else }} - rpcuser: {{ index (lookup "v1" "Secret" .Release.Namespace "bitcoind").data "rpcpassword" }} + rpcuser: {{ index (lookup "v1" "Secret" .Release.Namespace "bitcoind").data "rpcuser" }} {{ end }} {{ end }} \ No newline at end of file diff --git a/chart/bitcoind/values.yaml b/chart/bitcoind/values.yaml index 2b8cb42..1a44f80 100644 --- a/chart/bitcoind/values.yaml +++ b/chart/bitcoind/values.yaml @@ -9,12 +9,12 @@ image: # bitcoin.conf configuration file configuration: rpcuser: #optional, if not quoted it will be generated - txindex: 1 + txindex: 0 server: 1 - #can be any of mainnet, regtest, signet or testnet, if omitted mainnet will be used only a single network per deployment is supported - network: mainnet + network: mainnet #can be any of mainnet, regtest, signet or testnet, if omitted mainnet will be used only a single network per deployment is supported prune: 12000 #Reduce storage requirements by enabling pruning (deleting) of old blocks. This allows the pruneblockchain RPC to be called to delete specific blocks, and enables automatic pruning of old blocks if a target size in MiB is provided. This mode is incompatible with -txindex and -rescan. Warning: Reverting this setting requires re-downloading the entire blockchain. (default: 0 = disable pruning blocks, 1 = allow manual pruning via RPC, 550 = automatically prune block files to stay under the specified target size in MiB) passwordLength: 50 #the rpc password length + rpcallowip: 0.0.0.0/0 #use the cluster private ip range to further restrict connection attempts # persistent volume settings persistence: