Skip to content

Commit

Permalink
add simpler management of ports and node configs
Browse files Browse the repository at this point in the history
  • Loading branch information
coutug committed Sep 14, 2024
1 parent b891e36 commit b21820f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 225 deletions.
33 changes: 5 additions & 28 deletions charts/geth/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,12 @@ metadata:
spec:
type: {{ .Values.service.type }}
ports:
{{- if .Values.geth.http.enabled }}
# HTTP RPC
- name: http-rpc
port: {{ .Values.geth.http.port }}
targetPort: {{ .Values.geth.http.port }}
{{- range $key, $value := .Values.geth.ports }}
{{- if or $value.enabled (eq $key "authrpc") }}
- name: {{ $key }}
port: {{ $value.port }}
targetPort: {{ $value.port }}
{{- end }}
{{- if .Values.geth.ws.enabled }}
# WS RPC
- name: ws-rpc
port: {{ .Values.geth.ws.port }}
targetPort: {{ .Values.geth.ws.port }}
{{- end }}
{{- if .Values.geth.authrpc.enabled }}
# AuthRPC
- name: auth-rpc
port: {{ .Values.geth.authrpc.port }}
targetPort: {{ .Values.geth.authrpc.port }}
{{- end }}
{{- if .Values.geth.metrics.enabled }}
# Metrics
- name: metrics
port: {{ .Values.geth.metrics.port }}
targetPort: {{ .Values.geth.metrics.port }}
{{- end }}
{{- if .Values.geth.pprof.enabled }}
# pprof
- name: pprof
port: {{ .Values.geth.pprof.port }}
targetPort: {{ .Values.geth.pprof.port }}
{{- end }}
selector:
{{- include "geth.selectorLabels" . | nindent 4 }}
71 changes: 14 additions & 57 deletions charts/geth/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,74 +56,31 @@ spec:
image: {{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
{{- if .Values.geth.http.enabled }}
# HTTP RPC
- name: http-rpc
containerPort: {{ .Values.geth.http.port }}
{{- range $key, $value := .Values.geth.ports }}
{{- if or $value.enabled (eq $key "authrpc") }}
- name: {{ $key }}
containerPort: {{ $value.port }}
{{- end }}
{{- if .Values.geth.ws.enabled }}
# WS RPC
- name: ws-rpc
containerPort: {{ .Values.geth.ws.port }}
{{- end }}
{{- if .Values.geth.authrpc.enabled }}
# AuthRPC
- name: auth-rpc
containerPort: {{ .Values.geth.authrpc.port }}
{{- end }}
{{- if .Values.geth.metrics.enabled }}
# Metrics
- name: metrics
containerPort: {{ .Values.geth.metrics.port }}
{{- end }}
{{- if .Values.geth.pprof.enabled }}
# pprof
- name: pprof
containerPort: {{ .Values.geth.pprof.port }}
{{- end }}
command: ["/usr/local/bin/geth"]
args:
# Basic geth configs
- --op-network={{ .Values.geth.network }}
- --datadir={{ .Values.geth.datadir }}
- --syncmode={{ .Values.geth.syncmode }}
- --rollup.sequencerhttp={{ .Values.geth.rollup.sequencerhttp }}

{{- if .Values.geth.http.enabled }}
# HTTP RPC
- --http
- --http.addr={{ .Values.geth.http.addr }}
- --http.port={{ .Values.geth.http.port }}
- --http.vhosts={{ .Values.geth.http.vhosts }}
- --http.corsdomain={{ .Values.geth.http.corsDomain }}
{{- end }}

{{- if .Values.geth.ws.enabled }}
# WS RPC
- --ws
- --ws.addr={{ .Values.geth.ws.addr }}
- --ws.port={{.Values.geth.ws.port }}
- --ws.origins={{.Values.geth.ws.origins}}
# Loop through geth.ports values to set configs
{{- range $key, $value := .Values.geth.ports }}
{{- if or $value.enabled (eq $key "authrpc") }}
{{- range $config, $configValue := $value }}
{{- if eq $config "enabled" }}
- --{{ $key }}
{{- else }}
- --{{ $key }}.{{ $config }}={{ $configValue }}
{{- end }}

{{- if .Values.geth.authrpc.enabled }}
# Auth RPC
- --authrpc.addr={{ .Values.geth.authrpc.addr }}
- --authrpc.port={{ .Values.geth.authrpc.port }}
- --authrpc.vhosts={{.Values.geth.authrpc.vhosts}}
- --authrpc.jwtsecret=/jwt/{{ .Values.geth.jwt.existingSecret.key | default "jwtSecret" }}
{{- end }}

{{- if .Values.geth.pprof.enabled }}
# pprof
- --pprof
- --pprof.addr={{ .Values.geth.pprof.addr }}
- --pprof.port={{ .Values.geth.pprof.port }}
{{- end }}

{{- if .Values.geth.metrics.enabled }}
# metrics
- --metrics
- --metrics.addr={{ .Values.geth.metrics.addr }}
- --metrics.port={{ .Values.geth.metrics.port }}
{{- end }}

{{- if .Values.importTarURL }}
Expand Down
113 changes: 0 additions & 113 deletions charts/geth/values-old.yaml

This file was deleted.

53 changes: 26 additions & 27 deletions charts/geth/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ geth:
network: op-mainnet
datadir: /data
syncmode: snap
rollup.sequencerhttp: https://mainnet-sequencer.optimism.io/
# JWT for clients to authenticate with the authrpc. Specify either `existingSecret` OR `fromLiteral`.
jwt:
# Load the JWT from an existing Kubernetes Secret. Takes precedence over `fromLiteral` if set.
Expand All @@ -74,33 +75,31 @@ geth:
key: null
# Use this literal value for the JWT
fromLiteral: null
http:
enabled: true
addr: 0.0.0.0
port: 8545
vhosts: "*"
corsDomain: "*"
ws:
enabled: false
addr: 0.0.0.0
port: 8546
origins: "*"
authrpc:
enabled: true
addr: 0.0.0.0
port: 8551
vhosts: "*"
rollup:
disabletxpoolgossip: true
sequencerhttp: https://mainnet-sequencer.optimism.io/
metrics:
enabled: false
addr: 0.0.0.0
port: 7300
pprof:
enabled: false
addr: 0.0.0.0
port: 6060
ports:
# authrpc is required
authrpc:
addr: 0.0.0.0
port: 8551
vhosts: "*"
http:
enabled: true
port: 8545
addr: 0.0.0.0
vhosts: "*"
corsDomain: "*"
ws:
enabled: false
addr: 0.0.0.0
port: 8546
origins: "*"
metrics:
enabled: false
addr: 0.0.0.0
port: 7300
pprof:
enabled: false
addr: 0.0.0.0
port: 6060

# Additional CLI arguments
extraArgs: []
Expand Down

0 comments on commit b21820f

Please sign in to comment.