Skip to content

Commit c635f10

Browse files
authored
Ethereum clients: move cmd templates to values.yaml and don't set p2p IP announcment flags if they're manually set via extraArgs (ethpandaops#157)
* geth: dont set --nat or --port flags if they exist in extraArgs * geth: move default command template to values * ethereum clients: dont set IP announcement flags when used as extraVars + move cmd template to values * besu: don't show values for defautlCommandTemplate in readme * besu: don't show values for defautlCommandTemplate in readme
1 parent 893be75 commit c635f10

36 files changed

+592
-408
lines changed

charts/besu/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ icon: https://launchpad.ethereum.org/static/media/hyperledger-besu-circle.b96368
88
sources:
99
- https://github.com/hyperledger/besu
1010
type: application
11-
version: 1.0.0
11+
version: 1.0.1
1212
maintainers:
1313
- name: skylenet
1414

charts/besu/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# besu
33

4-
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
4+
![Version: 1.0.1](https://img.shields.io/badge/Version-1.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
55

66
An Ethereum execution layer client designed to be enterprise-friendly for both public and private, permissioned network use cases. Besu is written in Java and released under the Apache 2.0 Licence.
77

@@ -19,7 +19,8 @@ An Ethereum execution layer client designed to be enterprise-friendly for both p
1919
| annotations | object | `{}` | Annotations for the StatefulSet |
2020
| authPort | int | `8551` | Engine Port (Auth Port) |
2121
| containerSecurityContext | object | See `values.yaml` | The security context for containers |
22-
| customCommand | list | `[]` | Command replacement for the besu container |
22+
| customCommand | list | `[]` | Legacy way of overwriting the default command. You may prefer to change defaultCommandTemplate instead. |
23+
| defaultCommandTemplate | string | See `values.yaml` | Template used for the default command |
2324
| extraArgs | list | `[]` | Extra args for the besu container |
2425
| extraContainers | list | `[]` | Additional containers |
2526
| extraEnv | list | `[]` | Additional env variables |

charts/besu/templates/_cmd.tpl

+1-33
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,5 @@
22
# Default command
33
*/}}
44
{{- define "besu.defaultCommand" -}}
5-
- sh
6-
- -ac
7-
- >
8-
{{- if .Values.p2pNodePort.enabled }}
9-
. /env/init-nodeport;
10-
{{- end }}
11-
exec besu
12-
--data-path=/data
13-
--nat-method=NONE
14-
{{- if .Values.p2pNodePort.enabled }}
15-
--p2p-host=$EXTERNAL_IP
16-
--p2p-port=$EXTERNAL_PORT
17-
{{- else }}
18-
--p2p-host=$(POD_IP)
19-
--p2p-port={{ include "besu.p2pPort" . }}
20-
{{- end }}
21-
--rpc-http-enabled
22-
--rpc-http-host=0.0.0.0
23-
--rpc-http-port={{ .Values.httpPort }}
24-
--rpc-http-cors-origins=*
25-
--rpc-ws-enabled
26-
--rpc-ws-host=0.0.0.0
27-
--rpc-ws-port={{ .Values.wsPort }}
28-
--host-allowlist=*
29-
--engine-jwt-secret=/data/jwt.hex
30-
--engine-rpc-port={{ .Values.authPort }}
31-
--engine-host-allowlist=*
32-
--metrics-enabled
33-
--metrics-host=0.0.0.0
34-
--metrics-port={{ .Values.metricsPort }}
35-
{{- range .Values.extraArgs }}
36-
{{ . }}
37-
{{- end }}
5+
{{- tpl .Values.defaultCommandTemplate . }}
386
{{- end }}

charts/besu/values.yaml

+47-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,53 @@ extraArgs: []
2222
# -- JWT secret used by client as a secret. Change this value.
2323
jwt: ecb22bc24e7d4061f7ed690ccd5846d7d73f5d2b9733267e12f56790398d908a
2424

25-
# -- Command replacement for the besu container
26-
customCommand: [] # Only change this if you need to change the default command
25+
# -- Template used for the default command
26+
# @default -- See `values.yaml`
27+
defaultCommandTemplate: |
28+
- sh
29+
- -ac
30+
- >
31+
{{- if .Values.p2pNodePort.enabled }}
32+
. /env/init-nodeport;
33+
{{- end }}
34+
exec besu
35+
--data-path=/data
36+
--nat-method=NONE
37+
{{- if .Values.p2pNodePort.enabled }}
38+
{{- if not (contains "--p2p-host=" (.Values.extraArgs | join ",")) }}
39+
--p2p-host=$EXTERNAL_IP
40+
{{- end }}
41+
{{- if not (contains "--p2p-port=" (.Values.extraArgs | join ",")) }}
42+
--p2p-port=$EXTERNAL_PORT
43+
{{- end }}
44+
{{- else }}
45+
{{- if not (contains "--p2p-host=" (.Values.extraArgs | join ",")) }}
46+
--p2p-host=$(POD_IP)
47+
{{- end }}
48+
{{- if not (contains "--p2p-port=" (.Values.extraArgs | join ",")) }}
49+
--p2p-port={{ include "besu.p2pPort" . }}
50+
{{- end }}
51+
{{- end }}
52+
--rpc-http-enabled
53+
--rpc-http-host=0.0.0.0
54+
--rpc-http-port={{ .Values.httpPort }}
55+
--rpc-http-cors-origins=*
56+
--rpc-ws-enabled
57+
--rpc-ws-host=0.0.0.0
58+
--rpc-ws-port={{ .Values.wsPort }}
59+
--host-allowlist=*
60+
--engine-jwt-secret=/data/jwt.hex
61+
--engine-rpc-port={{ .Values.authPort }}
62+
--engine-host-allowlist=*
63+
--metrics-enabled
64+
--metrics-host=0.0.0.0
65+
--metrics-port={{ .Values.metricsPort }}
66+
{{- range .Values.extraArgs }}
67+
{{ . }}
68+
{{- end }}
69+
70+
# -- Legacy way of overwriting the default command. You may prefer to change defaultCommandTemplate instead.
71+
customCommand: []
2772

2873
# When p2pNodePort is enabled, your P2P port will be exposed via service type NodePort.
2974
# This is useful if you want to expose and announce your node to the Internet.

charts/erigon/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ icon: https://pbs.twimg.com/profile_images/1420080204148576274/-4OFIs2x_400x400.
66
sources:
77
- https://github.com/ledgerwatch/erigon
88
type: application
9-
version: 1.0.0
9+
version: 1.0.1
1010
maintainers:
1111
- name: skylenet
1212

charts/erigon/README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# erigon
33

4-
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
4+
![Version: 1.0.1](https://img.shields.io/badge/Version-1.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
55

66
Erigon, formerly known as Turbo‐Geth, is a fork of Go Ethereum (geth) oriented toward speed and disk‐space efficiency. Erigon is a completely re-architected implementation of Ethereum, currently written in Go but with implementations in other languages planned. Erigon's goal is to provide a faster, more modular, and more optimized implementation of Ethereum.
77

@@ -19,8 +19,10 @@ Erigon, formerly known as Turbo‐Geth, is a fork of Go Ethereum (geth) oriented
1919
| annotations | object | `{}` | Annotations for the StatefulSet |
2020
| authPort | int | `8551` | Engine Port (Auth Port) |
2121
| containerSecurityContext | object | See `values.yaml` | The security context for containers |
22-
| customCommand | list | `[]` | Command replacement for the erigon container |
23-
| customCommandRPCDaemon | list | `[]` | Command replacement for the rpcdaemon container |
22+
| customCommand | list | `[]` | Legacy way of overwriting the default command. You may prefer to change defaultCommandTemplate instead. |
23+
| customCommandRPCDaemon | list | `[]` | Legacy way of overwriting the default command. You may prefer to change defaultCommandRPCDaemonTemplate instead. |
24+
| defaultCommandRPCDaemonTemplate | string | See `values.yaml` | Template used for the default command |
25+
| defaultCommandTemplate | string | See `values.yaml` | Template used for the default command |
2426
| extraArgs | list | `[]` | Extra args for the erigon container |
2527
| extraArgsRPCDaemon | list | `[]` | Extra args for the rpcdaemon container |
2628
| extraContainers | list | `[]` | Additional containers |

charts/erigon/templates/_cmd.tpl

+2-44
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,13 @@
22
# Default command
33
*/}}
44
{{- define "erigon.defaultCommand" -}}
5-
- sh
6-
- -ac
7-
- >
8-
{{- if .Values.p2pNodePort.enabled }}
9-
. /env/init-nodeport;
10-
{{- end }}
11-
exec erigon
12-
--datadir=/data
13-
{{- if .Values.p2pNodePort.enabled }}
14-
--nat=extip:$EXTERNAL_IP
15-
--port=$EXTERNAL_PORT
16-
{{- else }}
17-
--nat=extip:$(POD_IP)
18-
--port={{ include "erigon.p2pPort" . }}
19-
{{- end }}
20-
--http=false
21-
--private.api.addr=127.0.0.1:9090
22-
--authrpc.jwtsecret=/data/jwt.hex
23-
--authrpc.addr=0.0.0.0
24-
--authrpc.port={{ .Values.authPort }}
25-
--authrpc.vhosts=*
26-
--metrics
27-
--metrics.addr=0.0.0.0
28-
--metrics.port={{ .Values.metricsPort }}
29-
{{- range .Values.extraArgs }}
30-
{{ . }}
31-
{{- end }}
5+
{{- tpl .Values.defaultCommandTemplate . }}
326
{{- end }}
337

348

359
{{/*
3610
# Default command
3711
*/}}
3812
{{- define "erigon.defaultCommandRPCDaemon" -}}
39-
- sh
40-
- -ac
41-
- >
42-
while ! nc -z 127.0.0.1 9090; do sleep 1; done;
43-
exec rpcdaemon
44-
--datadir=/data
45-
--private.api.addr=127.0.0.1:9090
46-
--txpool.api.addr=127.0.0.1:9090
47-
--http.addr=0.0.0.0
48-
--http.port={{ .Values.httpPort }}
49-
--http.vhosts=*
50-
--metrics
51-
--metrics.addr=0.0.0.0
52-
--metrics.port={{ .Values.metricsPortRPCDaemon }}
53-
{{- range .Values.extraArgsRPCDaemon }}
54-
{{ . }}
55-
{{- end }}
13+
{{- tpl .Values.defaultCommandRPCDaemonTemplate . }}
5614
{{- end }}

charts/erigon/values.yaml

+64-4
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,70 @@ extraArgsRPCDaemon: []
2727
#- --http.corsdomain=yourdomain.tld
2828
#- --http.api=eth,erigon,web3,net,debug,trace,txpool,db
2929

30-
# -- Command replacement for the erigon container
31-
customCommand: [] # Only change this if you need to change the default command
32-
33-
# -- Command replacement for the rpcdaemon container
30+
# -- Template used for the default command
31+
# @default -- See `values.yaml`
32+
defaultCommandTemplate: |
33+
- sh
34+
- -ac
35+
- >
36+
{{- if .Values.p2pNodePort.enabled }}
37+
. /env/init-nodeport;
38+
{{- end }}
39+
exec erigon
40+
--datadir=/data
41+
{{- if .Values.p2pNodePort.enabled }}
42+
{{- if not (contains "--nat=" (.Values.extraArgs | join ",")) }}
43+
--nat=extip:$EXTERNAL_IP
44+
{{- end }}
45+
{{- if not (contains "--port=" (.Values.extraArgs | join ",")) }}
46+
--port=$EXTERNAL_PORT
47+
{{- end }}
48+
{{- else }}
49+
{{- if not (contains "--nat=" (.Values.extraArgs | join ",")) }}
50+
--nat=extip:$(POD_IP)
51+
{{- end }}
52+
{{- if not (contains "--port=" (.Values.extraArgs | join ",")) }}
53+
--port={{ include "erigon.p2pPort" . }}
54+
{{- end }}
55+
{{- end }}
56+
--http=false
57+
--private.api.addr=127.0.0.1:9090
58+
--authrpc.jwtsecret=/data/jwt.hex
59+
--authrpc.addr=0.0.0.0
60+
--authrpc.port={{ .Values.authPort }}
61+
--authrpc.vhosts=*
62+
--metrics
63+
--metrics.addr=0.0.0.0
64+
--metrics.port={{ .Values.metricsPort }}
65+
{{- range .Values.extraArgs }}
66+
{{ . }}
67+
{{- end }}
68+
69+
# -- Template used for the default command
70+
# @default -- See `values.yaml`
71+
defaultCommandRPCDaemonTemplate: |
72+
- sh
73+
- -ac
74+
- >
75+
while ! nc -z 127.0.0.1 9090; do sleep 1; done;
76+
exec rpcdaemon
77+
--datadir=/data
78+
--private.api.addr=127.0.0.1:9090
79+
--txpool.api.addr=127.0.0.1:9090
80+
--http.addr=0.0.0.0
81+
--http.port={{ .Values.httpPort }}
82+
--http.vhosts=*
83+
--metrics
84+
--metrics.addr=0.0.0.0
85+
--metrics.port={{ .Values.metricsPortRPCDaemon }}
86+
{{- range .Values.extraArgsRPCDaemon }}
87+
{{ . }}
88+
{{- end }}
89+
90+
# -- Legacy way of overwriting the default command. You may prefer to change defaultCommandTemplate instead.
91+
customCommand: []
92+
93+
# -- Legacy way of overwriting the default command. You may prefer to change defaultCommandRPCDaemonTemplate instead.
3494
customCommandRPCDaemon: [] # Only change this if you need to change the default command
3595

3696
# When p2pNodePort is enabled, your P2P port will be exposed via service type NodePort.

charts/geth/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ icon: https://launchpad.ethereum.org/static/media/gethereum-mascot-circle.75cbd3
99
sources:
1010
- https://github.com/ethereum/go-ethereum
1111
type: application
12-
version: 1.0.0
12+
version: 1.0.1
1313
maintainers:
1414
- name: skylenet
1515

charts/geth/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# geth
33

4-
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
4+
![Version: 1.0.1](https://img.shields.io/badge/Version-1.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
55

66
Go Ethereum (Geth for short) is one of the original implementations of the Ethereum protocol. Currently, it is the most widespread client with the biggest user base and variety of tooling for users and developers. It is written in Go, fully open source and licensed under the GNU LGPL v3
77

@@ -20,7 +20,8 @@ Go Ethereum (Geth for short) is one of the original implementations of the Ether
2020
| authPort | int | `8551` | Engine Port (Auth Port) |
2121
| config | string | See `values.yaml` for example | TOML config file |
2222
| containerSecurityContext | object | See `values.yaml` | The security context for containers |
23-
| customCommand | list | `[]` | Command replacement for the geth container |
23+
| customCommand | list | `[]` | Legacy way of overwriting the default command. You may prefer to change defaultCommandTemplate instead. |
24+
| defaultCommandTemplate | string | See `values.yaml` | Template used for the default command |
2425
| extraArgs | list | `[]` | Extra args for the geth container |
2526
| extraContainerPorts | list | `[]` | Additional ports for the main container |
2627
| extraContainers | list | `[]` | Additional containers |

charts/geth/templates/_cmd.tpl

+1-35
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,5 @@
22
# Default command
33
*/}}
44
{{- define "geth.defaultCommand" -}}
5-
- sh
6-
- -ac
7-
- >
8-
{{- if .Values.p2pNodePort.enabled }}
9-
. /env/init-nodeport;
10-
{{- end }}
11-
exec geth
12-
--datadir=/data
13-
--config=/config/geth.toml
14-
{{- if .Values.p2pNodePort.enabled }}
15-
--nat=extip:$EXTERNAL_IP
16-
--port=$EXTERNAL_PORT
17-
{{- else }}
18-
--nat=extip:$(POD_IP)
19-
--port={{ include "geth.p2pPort" . }}
20-
{{- end }}
21-
--http
22-
--http.addr=0.0.0.0
23-
--http.port={{ .Values.httpPort }}
24-
--http.vhosts=*
25-
--http.corsdomain=*
26-
--ws
27-
--ws.addr=0.0.0.0
28-
--ws.port={{ .Values.wsPort }}
29-
--ws.origins=*
30-
--authrpc.jwtsecret=/data/jwt.hex
31-
--authrpc.addr=0.0.0.0
32-
--authrpc.port={{ .Values.authPort }}
33-
--authrpc.vhosts=*
34-
--metrics
35-
--metrics.addr=0.0.0.0
36-
--metrics.port={{ .Values.metricsPort }}
37-
{{- range .Values.extraArgs }}
38-
{{ . }}
39-
{{- end }}
5+
{{- tpl .Values.defaultCommandTemplate . }}
406
{{- end }}

0 commit comments

Comments
 (0)