Skip to content

Commit

Permalink
Fix rpcuser and rpcpassword mismatch on restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
chubmann committed Sep 7, 2022
1 parent 6b78abe commit 298c85d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions chart/bitcoind/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -16,4 +16,4 @@ maintainers:
email: [email protected]
url: https://chrisrun.github.io/bitcoind-chart/
sources:
- https://github.com/chrisrun/bitcoind-chart/
- https://github.com/chrisrun/bitcoind-chart/
4 changes: 3 additions & 1 deletion chart/bitcoind/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 0 additions & 1 deletion chart/bitcoind/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 3 additions & 3 deletions chart/bitcoind/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
6 changes: 3 additions & 3 deletions chart/bitcoind/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 298c85d

Please sign in to comment.