From 9951da9ac016e8fb8561b8c53b1ee07d5c983f05 Mon Sep 17 00:00:00 2001 From: Ivan Vandot Date: Fri, 27 May 2022 08:01:32 +0200 Subject: [PATCH 1/3] fix: improve bee and geth-swap chart --- charts/bee/Chart.yaml | 2 +- charts/bee/templates/statefulset.yaml | 9 +++----- charts/geth-swap/Chart.yaml | 2 +- .../geth-swap/templates/setupcontracts.yaml | 2 ++ charts/geth-swap/templates/statefulset.yaml | 23 +++---------------- charts/geth-swap/values.yaml | 2 ++ 6 files changed, 12 insertions(+), 28 deletions(-) diff --git a/charts/bee/Chart.yaml b/charts/bee/Chart.yaml index 8011c70..21660d0 100644 --- a/charts/bee/Chart.yaml +++ b/charts/bee/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 appVersion: 1.6.0 name: bee -version: 0.12.1 +version: 0.12.2 kubeVersion: ">=1.19.0-0" description: Ethereum Swarm Bee Helm chart for Kubernetes home: https://www.ethswarm.org diff --git a/charts/bee/templates/statefulset.yaml b/charts/bee/templates/statefulset.yaml index bc04145..32aceba 100644 --- a/charts/bee/templates/statefulset.yaml +++ b/charts/bee/templates/statefulset.yaml @@ -60,10 +60,9 @@ spec: - sh - -c - > - export INDEX=$(echo $(hostname) | cut -d'-' -f2-); mkdir -p /home/bee/.bee/keys; chown -R 999:999 /home/bee/.bee/keys; - export KEY=$(cat /tmp/bee/libp2p.map | grep bee-${INDEX}: | cut -d' ' -f2); + export KEY=$(cat /tmp/bee/libp2p.map | grep $(hostname): | cut -d' ' -f2); if [ -z "${KEY}" ]; then exit 0; fi; printf '%s' "${KEY}" > /home/bee/.bee/keys/libp2p.key; echo 'node initialization done'; @@ -80,10 +79,9 @@ spec: - sh - -c - > - export INDEX=$(echo $(hostname) | cut -d'-' -f2-); mkdir -p /home/bee/.bee/keys; chown -R 999:999 /home/bee/.bee/keys; - export KEY=$(cat /tmp/bee/swarm.map | grep bee-${INDEX}: | cut -d' ' -f2); + export KEY=$(cat /tmp/bee/swarm.map | grep $(hostname): | cut -d' ' -f2); if [ -z "${KEY}" ]; then exit 0; fi; printf '%s' "${KEY}" > /home/bee/.bee/keys/swarm.key; echo 'node initialization done'; @@ -100,10 +98,9 @@ spec: - sh - -c - > - export INDEX=$(echo $(hostname) | cut -d'-' -f2-); mkdir -p /app/data/keystore; chown -R nobody:nogroup /app/data/keystore; - export KEY=$(cat /tmp/bee/clef.map | grep bee-${INDEX}: | cut -d' ' -f2); + export KEY=$(cat /tmp/bee/clef.map | grep $(hostname): | cut -d' ' -f2); if [ -n "${KEY}" ]; then printf '%s' "${KEY}" > /app/data/keystore/clef.key; fi; /entrypoint.sh init; echo 'clef initialization done'; diff --git a/charts/geth-swap/Chart.yaml b/charts/geth-swap/Chart.yaml index 630b356..c56a989 100644 --- a/charts/geth-swap/Chart.yaml +++ b/charts/geth-swap/Chart.yaml @@ -20,7 +20,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. -version: 0.3.4 +version: 0.3.5 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. diff --git a/charts/geth-swap/templates/setupcontracts.yaml b/charts/geth-swap/templates/setupcontracts.yaml index 5fdbdda..994c95c 100644 --- a/charts/geth-swap/templates/setupcontracts.yaml +++ b/charts/geth-swap/templates/setupcontracts.yaml @@ -1,3 +1,4 @@ +{{- if .Values.gethSetup -}} apiVersion: batch/v1 kind: Job metadata: @@ -34,3 +35,4 @@ spec: sleep 2; bash deploy.sh restartPolicy: Never +{{- end -}} \ No newline at end of file diff --git a/charts/geth-swap/templates/statefulset.yaml b/charts/geth-swap/templates/statefulset.yaml index 175c742..5875716 100644 --- a/charts/geth-swap/templates/statefulset.yaml +++ b/charts/geth-swap/templates/statefulset.yaml @@ -67,26 +67,9 @@ spec: image: "{{ include "geth-swap.image" . }}" imagePullPolicy: {{ .Values.image.pullPolicy }} command: - - geth - - --http - - --http.addr - - "0.0.0.0" - - --allow-insecure-unlock - - --http.api - - 'eth,net,personal,web3' - - --http.vhosts - - "*" - - --ws - - --ws.addr - - "0.0.0.0" - - --ws.api - - 'eth,net,personal,web3' - - --unlock={{ .Values.geth.genesis.validatorAddress }} - - --password=/dev/null - - --mine - - --lightkdf - - --syncmode=full - - --cache={{ .Values.geth.cache }} + {{- range .Values.gethCommand }} + - {{ . }} + {{- end }} ports: - name: rpc containerPort: 8545 diff --git a/charts/geth-swap/values.yaml b/charts/geth-swap/values.yaml index f3d1eb1..c51f0d7 100644 --- a/charts/geth-swap/values.yaml +++ b/charts/geth-swap/values.yaml @@ -33,6 +33,8 @@ geth: - addr: "62cab2b3b55f341f10348720ca18063cdb779ad5" wei: "0xf0000000000000000000000000" +gethCommand: ["geth", "--http", "--http.addr", "'0.0.0.0'", "--allow-insecure-unlock", "--http.api", "'eth,net,personal,web3'", "--http.vhosts", "'*'", "--ws", "--ws.addr", "'0.0.0.0'", "--ws.api", "'eth,net,personal,web3'", "--unlock=62cab2b3b55f341f10348720ca18063cdb779ad5", "--password=/dev/null", "--mine", "--lightkdf", "--syncmode=full", "--cache=512"] + swap: gas: "2000000" bzzaccounts: From 218d87efc7cf26a337be6af54cb294d283cd3691 Mon Sep 17 00:00:00 2001 From: Ivan Vandot Date: Fri, 27 May 2022 10:42:59 +0200 Subject: [PATCH 2/3] fix: add probesEnabled to geth-swap chart --- charts/geth-swap/templates/statefulset.yaml | 2 ++ charts/geth-swap/values.yaml | 1 + 2 files changed, 3 insertions(+) diff --git a/charts/geth-swap/templates/statefulset.yaml b/charts/geth-swap/templates/statefulset.yaml index 5875716..394a9b6 100644 --- a/charts/geth-swap/templates/statefulset.yaml +++ b/charts/geth-swap/templates/statefulset.yaml @@ -77,11 +77,13 @@ spec: - name: ws containerPort: 8546 protocol: TCP + {{- if .Values.probesEnable }} livenessProbe: httpGet: path: / port: rpc initialDelaySeconds: 5 + {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} securityContext: diff --git a/charts/geth-swap/values.yaml b/charts/geth-swap/values.yaml index c51f0d7..6d02aae 100644 --- a/charts/geth-swap/values.yaml +++ b/charts/geth-swap/values.yaml @@ -19,6 +19,7 @@ imageSetupContract: pullPolicy: Always gethSetup: true +probesEnable: true geth: cache: 512 From 8b665145182ec7234108d9a5cae468405c38ab9a Mon Sep 17 00:00:00 2001 From: Ivan Vandot Date: Fri, 27 May 2022 10:45:18 +0200 Subject: [PATCH 3/3] fix: add newline to setupcontracts --- charts/geth-swap/templates/setupcontracts.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/geth-swap/templates/setupcontracts.yaml b/charts/geth-swap/templates/setupcontracts.yaml index 994c95c..a7ca296 100644 --- a/charts/geth-swap/templates/setupcontracts.yaml +++ b/charts/geth-swap/templates/setupcontracts.yaml @@ -35,4 +35,4 @@ spec: sleep 2; bash deploy.sh restartPolicy: Never -{{- end -}} \ No newline at end of file +{{- end -}}