Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions examples/networks/6_node_btcd/network.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
nodes:
- name: tank-0001
implementation: btcd
image:
repository: lucasdbr05/btcd
tag: "latest"
addnode:
- tank-0002
- tank-0003
- name: tank-0002
implementation: btcd
image:
repository: lucasdbr05/btcd
tag: "latest"
addnode:
- tank-0003
- tank-0004
- name: tank-0003
implementation: btcd
image:
repository: lucasdbr05/btcd
tag: "latest"
addnode:
- tank-0004
- tank-0005
- name: tank-0004
implementation: btcd
image:
repository: lucasdbr05/btcd
tag: "latest"
addnode:
- tank-0005
- tank-0006
- name: tank-0005
implementation: btcd
image:
repository: lucasdbr05/btcd
tag: "latest"
addnode:
- tank-0006
- name: tank-0006
implementation: btcd
image:
repository: lucasdbr05/btcd
tag: "latest"
caddy:
enabled: true
18 changes: 18 additions & 0 deletions examples/networks/6_node_btcd/node-defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
chain: regtest

implementation: btcd
restartPolicy: OnFailure

# TODO: find a better approach to can mine blocks (this address is just for tests)
config: |
miningaddr=Sh6VJ4TabWtfBm9kvLWPzj8WGNsMmtyaGF

collectLogs: true
metricsExport: false

resources: {}

image:
repository: lucasdbr05/btcd
pullPolicy: IfNotPresent
tag: "latest"
23 changes: 23 additions & 0 deletions resources/charts/btcd/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
9 changes: 9 additions & 0 deletions resources/charts/btcd/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
name: btcd
description: A Helm chart for btcd (alternative Bitcoin full node in Go)

# Application chart
type: application

version: 0.1.0
appVersion: 0.1.0
1 change: 1 addition & 0 deletions resources/charts/btcd/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Thank you for installing {{ include "btcd.fullname" . }}.
59 changes: 59 additions & 0 deletions resources/charts/btcd/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "btcd.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
*/}}
{{- define "btcd.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s" .Release.Name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "btcd.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "btcd.labels" -}}
helm.sh/chart: {{ include "btcd.chart" . }}
{{ include "btcd.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "btcd.selectorLabels" -}}
app.kubernetes.io/name: {{ include "btcd.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Map chain name to btcd config file flag
*/}}
{{- define "btcd.chainFlag" -}}
{{- if eq .Values.global.chain "regtest" -}}
simnet=1
{{- else if eq .Values.global.chain "signet" -}}
signet=1
{{- else if eq .Values.global.chain "testnet" -}}
testnet=1
{{- else -}}
{{/* mainnet: no flag needed */}}
{{- end -}}
{{- end -}}
20 changes: 20 additions & 0 deletions resources/charts/btcd/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "btcd.fullname" . }}
labels:
{{- include "btcd.labels" . | nindent 4 }}
data:
btcd.conf: |
{{ include "btcd.chainFlag" . }}
rpclisten=0.0.0.0:{{ index .Values.global .Values.global.chain "RPCListenPort" }}
rpcuser={{ .Values.global.rpcuser }}
rpcpass={{ .Values.global.rpcpassword }}
listen=0.0.0.0:{{ index .Values.global .Values.global.chain "P2PPort" }}
debuglevel=info
txindex=1
{{- $p2pPort := index .Values.global .Values.global.chain "P2PPort" }}
{{- range .Values.addnode }}
{{- printf "addpeer=%s:%v" . $p2pPort | nindent 4 }}
{{- end }}
{{- .Values.config | nindent 4 }}
133 changes: 133 additions & 0 deletions resources/charts/btcd/templates/pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
apiVersion: v1
kind: Pod
metadata:
name: {{ include "btcd.fullname" . }}
labels:
{{- include "btcd.labels" . | nindent 4 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
chain: {{ .Values.global.chain }}
P2PPort: "{{ index .Values.global .Values.global.chain "P2PPort" }}"
RPCPort: "{{ index .Values.global .Values.global.chain "RPCListenPort" }}"
rpcpassword: {{ .Values.global.rpcpassword }}
app: {{ include "btcd.fullname" . }}
implementation: btcd
{{- if .Values.collectLogs }}
collect_logs: "true"
{{- end }}
annotations:
init_peers: "{{ .Values.addnode | len }}"
spec:
restartPolicy: "{{ .Values.restartPolicy }}"
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 4 }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 4 }}
{{- if .Values.loadSnapshot.enabled }}
initContainers:
- name: download-blocks
image: alpine:latest
command: ["/bin/sh", "-c"]
args:
- |
apk add --no-cache curl
mkdir -p /root/.btcd/data
curl -L {{ .Values.loadSnapshot.url }} | tar -xz -C /root/.btcd/data
volumeMounts:
- name: data
mountPath: /root/.btcd
{{- end }}
containers:
- name: btcd
securityContext:
{{- toYaml .Values.securityContext | nindent 8 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command:
- "/bin/linux_amd64/btcd"
args:
- "--configfile=/root/.btcd/btcd.conf"
{{- if .Values.extraArgs }}
{{- range (split " " .Values.extraArgs) }}
- {{ . | quote }}
{{- end }}
{{- end }}
ports:
- name: rpc
containerPort: {{ index .Values.global .Values.global.chain "RPCListenPort" }}
protocol: TCP
- name: p2p
containerPort: {{ index .Values.global .Values.global.chain "P2PPort" }}
protocol: TCP
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 8 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 8 }}
tcpSocket:
port: {{ index .Values.global .Values.global.chain "RPCListenPort" }}
resources:
{{- toYaml .Values.resources | nindent 8 }}
volumeMounts:
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
- mountPath: /root/.btcd
name: data
- mountPath: /root/.btcd/btcd.conf
name: config
subPath: btcd.conf
{{- if .Values.metricsExport }}
- name: prometheus
image: bitcoindevproject/bitcoin-exporter:latest
imagePullPolicy: IfNotPresent
ports:
- name: prom-metrics
containerPort: {{ .Values.prometheusMetricsPort }}
protocol: TCP
env:
- name: BITCOIN_RPC_HOST
value: "127.0.0.1"
- name: BITCOIN_RPC_PORT
value: "{{ index .Values.global .Values.global.chain "RPCListenPort" }}"
- name: BITCOIN_RPC_USER
value: {{ .Values.global.rpcuser }}
- name: BITCOIN_RPC_PASSWORD
value: {{ .Values.global.rpcpassword }}
{{- end }}
{{- with .Values.extraContainers }}
{{- toYaml . | nindent 4 }}
{{- end }}
volumes:
{{- with .Values.volumes }}
{{- toYaml . | nindent 4 }}
{{- end }}
- name: data
{{- if .Values.persistence.enabled }}
{{- if .Values.persistence.existingClaim }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim }}
{{- else }}
persistentVolumeClaim:
claimName: {{ include "btcd.fullname" . }}.{{ .Release.Namespace }}-btcd-data
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
- name: config
configMap:
name: {{ include "btcd.fullname" . }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 4 }}
{{- end }}
19 changes: 19 additions & 0 deletions resources/charts/btcd/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "btcd.fullname" . }}.{{ .Release.Namespace }}-btcd-data
labels:
{{- include "btcd.labels" . | nindent 4 }}
annotations:
"helm.sh/resource-policy": keep
spec:
accessModes:
- {{ .Values.persistence.accessMode }}
resources:
requests:
storage: {{ .Values.persistence.size }}
{{- if .Values.persistence.storageClass }}
storageClassName: {{ .Values.persistence.storageClass }}
{{- end }}
{{- end }}
24 changes: 24 additions & 0 deletions resources/charts/btcd/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "btcd.fullname" . }}
labels:
{{- include "btcd.labels" . | nindent 4 }}
app: {{ include "btcd.fullname" . }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ index .Values.global .Values.global.chain "RPCListenPort" }}
targetPort: rpc
protocol: TCP
name: rpc
- port: {{ index .Values.global .Values.global.chain "P2PPort" }}
targetPort: p2p
protocol: TCP
name: p2p
- port: {{ .Values.prometheusMetricsPort }}
targetPort: prom-metrics
protocol: TCP
name: prometheus-metrics
selector:
{{- include "btcd.selectorLabels" . | nindent 4 }}
16 changes: 16 additions & 0 deletions resources/charts/btcd/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.metricsExport }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "btcd.fullname" . }}
labels:
app.kubernetes.io/name: btcd-metrics
release: prometheus
spec:
endpoints:
- port: prometheus-metrics
interval: {{ .Values.metricsScrapeInterval | default "15s" }}
selector:
matchLabels:
app: {{ include "btcd.fullname" . }}
{{- end }}
Loading
Loading