Add lightpush client and getAddress fixes (#133)

* Add lightpush client and getAddress fixes

* Add lightpush client values in command presets

* Combined _getEnr.tpl and _getAddress.tpl into one template

* Fix some indents in nodes.yaml

* Remove unused lightpush.values.yaml

* Rename getEorA to getEnrOrAddress
This commit is contained in:
PearsonWhite
2025-08-22 09:53:24 -04:00
committed by GitHub
parent 71cf504d28
commit eb48287958
7 changed files with 131 additions and 25 deletions

View File

@@ -8,7 +8,7 @@ waku:
getEnr:
repo: "soutullostatus/getenr"
tag: "v0.5.0"
numEnrs: 3
num: 3
serviceName: "zerotesting-bootstrap.zerotesting"
command:
type: "regression"

View File

@@ -1,15 +0,0 @@
waku:
command:
presets:
lightpush:
lightpushnode: $addrs1
relay: false
rest: true
restAdmin: true
restAddress: 0.0.0.0
logLevel: INFO
metricsServer: True
metricsServerAddress: 0.0.0.0
nat: extip:${IP}
clusterId: 2
shard: 0

View File

@@ -0,0 +1,17 @@
waku:
nodes:
command:
presets:
lightpushClient:
relay: false
rest: true
restAdmin: true
restAddress: 0.0.0.0
logLevel: INFO
metricsServer: True
metricsServerAddress: 0.0.0.0
lightpushnode:
- $addrs1
nat: extip:${IP}
clusterId: 2
shard: 0

View File

@@ -0,0 +1,70 @@
{{/*
waku.nodes.getEnrOrAddress
Generates initContainer section for getEnr or getAddress.
Args dict:
"values": .Values.waku.nodes
"type": Either "enr" or "address"
This function also checks that the number of flags match the "num" field of values.
type | flag
--------------
enr | --discv5-bootstrap-node
address | --lightpushnode
If $values.getEnr.num is 5, then there should be 5 --discv5-bootstrap-node flags.
This check is not applied when the full container command is given with $values.command.full).container
Usage:
{{- include "waku.nodes.getEnrOrAddress" ( dict "values" .Values.waku.nodes "type" "address" ) | nindent 8 }}
*/}}
{{- define "waku.nodes.getEnrOrAddress" -}}
{{- $values := .values }}
{{- $type := .type }}
{{- $settings := dict
"address" (dict "shortname" "addrs" "version" "v0.1.0" "image" "soutullostatus/getaddress" "flag" "--lightpushnode")
"enr" (dict "shortname" "enr" "version" "v0.5.0" "image" "soutullostatus/getenr" "flag" "--discv5-bootstrap-node")
}}
{{- $cfg := index $settings $type }}
{{- if not $cfg }}
{{- fail (printf "Unknown type: %s" $type) }}
{{- end }}
# Set subvalues to `$values.getEnr` or `$values.getAddress`.
{{- $key := printf "get%s" ($type | title) }}
{{- $subvalues := index $values $key }}
- name: {{ printf "grab%s" $type }}
image: {{ default $cfg.image $subvalues.repo }}:{{ default $cfg.version $subvalues.tag }}
imagePullPolicy: IfNotPresent
volumeMounts:
- name: {{ printf "%s-data" $type }}
mountPath: {{ printf "/etc/%s" $cfg.shortname }}
command:
- {{ printf "/app/get%s.sh" $type }}
args:
# Check to make sure the number of environment variables matches the numEnrs arg we give to the shell script.
# TODO [waku-regression-nodes sanity checks]: add this same sanity check to getAddress.tpl.
{{- if not ($values.command.full).container }}
{{- if ($values.command.full).waku }}
{{ include "assertFlagCountInCommand" ( dict
"command" $values.command.full.waku
"flag" $cfg.flag
"expectedCount" (default 3 $subvalues.num)) | indent 2 }}
{{ else }}
{{- $preset := $values.command.type | default "basic" }}
{{- $wakuCommand := include "command.genArgs" ( dict
"args" $values.command.args
"presets" $values.command.presets
"preset" $preset) | indent 4 }}
{{- include "assertFlagCountInCommand" ( dict
"command" $wakuCommand
"flag" $cfg.flag
"expectedCount" (default 3 $subvalues.num)) | indent 2}}
{{- end }}
{{- end }}
{{- toYaml (list (toString (default 3 $subvalues.num))) | nindent 4 }}
{{- toYaml (list ( default "" $subvalues.serviceName )) | nindent 4 }}
{{- end }}

View File

@@ -15,8 +15,10 @@ spec:
labels:
app: {{ .Values.waku.nodes.app }}
spec:
{{- if .Values.waku.nodes.dnsConfig }}
dnsConfig:
{{- toYaml .Values.waku.nodes.dnsConfig | nindent 8 }}
{{ end }}
volumes:
{{ with .Values.waku.nodes.volumes }}
{{ toYaml . }}
@@ -38,14 +40,14 @@ spec:
{{ toYaml .Values.waku.nodes.initContainers }}
{{ end }}
{{- if .Values.waku.nodes.includes.getAddress }}
{{- include "waku.nodes.getAddress" ( dict "Values" .Values.waku.nodes ) | nindent 8 }}
{{- include "waku.nodes.getEnrOrAddress" ( dict "values" .Values.waku.nodes "type" "address" ) | nindent 8 }}
{{- end }}
{{- if .Values.waku.nodes.includes.getEnr }}
{{- include "waku.nodes.getEnr" ( dict "Values" .Values.waku.nodes ) | nindent 8 }}
{{- include "waku.nodes.getEnrOrAddress" ( dict "values" .Values.waku.nodes "type" "enr" ) | nindent 8 }}
{{- end }}
containers:
{{- if .Values.waku.nodes.storeNode }}
{{- include "waku.nodes.postgress.container" . | indent 5 }}
{{- include "waku.nodes.postgress.container" . | nindent 8 }}
{{- end }}
- name: waku
image: {{ default "soutullostatus/nwaku-jq-curl" .Values.waku.nodes.image.repository }}:{{ default "v0.34.0-rc1" .Values.waku.nodes.image.tag }}
@@ -91,13 +93,13 @@ spec:
fieldPath: status.podIP
{{- if .Values.waku.nodes.storeNode }}
- name: POSTGRES_URL
value: "postgres://wakuuser:wakupassword@127.0.0.1:5432/wakumessages"
value: "postgres://wakuuser:wakupassword@127.0.0.1:5432/wakumessages"
{{- end }}
command:
{{- include "waku.container.command" ( dict
"includes" (dict
"getEnr" .Values.waku.nodes.getEnr
"getAddress" .Values.waku.nodes.address
"getAddress" .Values.waku.nodes.getAddress
)
"command" .Values.waku.nodes.command
) | nindent 14 }}

View File

@@ -1,4 +0,0 @@
# TODO [lightpush]: incomplete
includes:
getAddress: true

View File

@@ -0,0 +1,36 @@
{{- define "waku.container.command" -}}
{{- $includes := .includes -}}
{{- $command := .command -}}
{{- if ($command.full).container -}}
{{ $command.full.container }}
{{- else -}}
- sh
- -c
- |
{{- if $includes.getAddress }}
. /etc/addrs/addrs.env
echo addrs are{{- range $i, $ := until (int $includes.getAddress.num) }} $addrs{{ add1 $i }}{{- end }}
{{- end }}
{{- if $includes.getEnr }}
. /etc/enr/enr.env
echo ENRs are{{- range $i, $ := until (int $includes.getEnr.num) }} $ENR{{ add1 $i }}{{- end }}
{{- end }}
{{- if ($command.full).waku }}
{{- $command.full.waku | indent 1 }}
{{- else }}
{{- if $command.sleep }}
sleep 10
{{- end }}
{{- if $command.nice }}
{{ printf "nice -n %d \\" (int $command.nice) }}
{{- end }}
/usr/bin/wakunode \
{{- $preset := $command.type | default "basic" -}}
{{- include "command.genArgs" ( dict
"args" $command.args
"presets" $command.presets
"preset" $preset) | nindent 4 -}}
{{- end }}
{{- end }}
{{- end }}