Skip to content

Commit

Permalink
add autoNeighborhood, remove clef, bump versions (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
Иван Vandot authored Oct 25, 2023
1 parent 1339aec commit 03e55e9
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 203 deletions.
4 changes: 2 additions & 2 deletions charts/bee/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
appVersion: 1.13.0
appVersion: 1.17.5
name: bee
version: 0.13.0
version: 0.14.0
kubeVersion: ">=1.19.0-0"
description: Ethereum Swarm Bee Helm chart for Kubernetes
home: https://www.ethswarm.org
Expand Down
2 changes: 1 addition & 1 deletion charts/bee/ci/ct-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
probesEnable: false

beeConfig:
swap-endpoint: https://rpc.gnosischain.com/
blockchain-rpc-endpoint: https://rpc.gnosischain.com/
67 changes: 0 additions & 67 deletions charts/bee/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -187,73 +187,6 @@ Get the swarm key to be retrieved from the secret.
{{- end -}}
{{- end -}}

{{/*
Create clef image name combining repository and tag or digest.
Digest takes presedance over tag.
*/}}
{{- define "clef.image" -}}
{{- if .Values.clefSettings.image.digest -}}
{{- printf "%s@%s" .Values.clefSettings.image.repository .Values.clefSettings.image.digest -}}
{{- else -}}
{{- printf "%s:%s" .Values.clefSettings.image.repository .Values.clefSettings.image.tag -}}
{{- end -}}
{{- end -}}

{{/*
Get the clef password secret.
*/}}
{{- define "bee.clefSecretName" -}}
{{- if .Values.clefSettings.existingPasswordSecret -}}
{{- printf "%s" .Values.clefSettings.existingPasswordSecret -}}
{{- else -}}
{{- printf "%s-clefpassword" (include "bee.fullname" .) -}}
{{- end -}}
{{- end -}}

{{/*
Get the clef password key to be retrieved from the secret.
*/}}
{{- define "bee.clefSecretPasswordKey" -}}
{{- if and .Values.clefSettings.existingPasswordSecret .Values.clefSettings.existingClefSecretPasswordKey -}}
{{- printf "%s" .Values.clefSettings.existingClefSecretPasswordKey -}}
{{- else -}}
{{- printf "password" -}}
{{- end -}}
{{- end -}}

{{/*
Return Clef password.
*/}}
{{- define "bee.clefPassword" -}}
{{- if not (empty .Values.clefSettings.password) }}
{{- .Values.clefSettings.password -}}
{{- else -}}
{{- randAlphaNum 10 -}}
{{- end -}}
{{- end -}}

{{/*
Get the clefKeys secret.
*/}}
{{- define "bee.clefKeysSecretName" -}}
{{- if .Values.clefSettings.existingSecret -}}
{{- printf "%s" .Values.clefSettings.existingSecret -}}
{{- else -}}
{{- printf "%s-clef" (include "bee.fullname" .) -}}
{{- end -}}
{{- end -}}

{{/*
Get the clef key to be retrieved from the secret.
*/}}
{{- define "bee.clefKeysSecretKey" -}}
{{- if and .Values.clefSettings.existingSecret .Values.clefSettings.existingSecretClefKey -}}
{{- printf "%s" .Values.clefSettings.existingSecretClefKey -}}
{{- else -}}
{{- printf "clefKeys" -}}
{{- end -}}
{{- end -}}

{{/*
Create gatewayProxy image name combining repository and tag or digest.
Digest takes presedance over tag.
Expand Down
17 changes: 0 additions & 17 deletions charts/bee/templates/secret-clefkeys.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions charts/bee/templates/secret-clefpassword.yaml

This file was deleted.

105 changes: 28 additions & 77 deletions charts/bee/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or .Values.libp2pSettings.enabled .Values.p2pFixedPort.enabled .Values.swarmSettings.enabled .Values.clefSettings.enabled .Values.extraInitContainers }}
{{- if or .Values.libp2pSettings.enabled .Values.p2pFixedPort.enabled .Values.swarmSettings.enabled .Values.extraInitContainers .Values.autoNeighborhood.enabled }}
initContainers:
{{- if .Values.libp2pSettings.enabled }}
- name: init-libp2p
image: ethersphere/busybox:1.33
image: ethersphere/busybox:1.36
command:
- sh
- -c
Expand All @@ -74,7 +74,7 @@ spec:
{{- end }}
{{- if .Values.swarmSettings.enabled }}
- name: init-swarm
image: ethersphere/busybox:1.33
image: ethersphere/busybox:1.36
command:
- sh
- -c
Expand All @@ -91,34 +91,9 @@ spec:
- name: bee-swarm
mountPath: /tmp/bee
{{- end }}
{{- if .Values.clefSettings.enabled }}
- name: init-clef
image: ethersphere/clef:0.6.0
command:
- sh
- -c
- >
mkdir -p /app/data/keystore;
chown -R nobody:nogroup /app/data/keystore;
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';
volumeMounts:
- name: clef
mountPath: /app/data
- name: bee-clef
mountPath: /tmp/bee
{{- if .Values.clefSettings.password }}
- name: clef-secret
mountPath: /app/data/password
subPath: password
readOnly: true
{{- end }}
{{- end }}
{{- if .Values.p2pFixedPort.enabled }}
- name: init-natport
image: ethersphere/busybox:1.33
image: ethersphere/busybox:1.36
command:
- sh
- -c
Expand All @@ -136,6 +111,29 @@ spec:
mountPath: /tmp/.bee.yaml
subPath: .bee.yaml
{{- end }}
{{- if .Values.autoNeighborhood.enabled }}
- name: init-neighborhood
image: ethersphere/busybox:1.36
command:
- sh
- -c
- >
if [ -f /home/bee/.bee/keys/swarm.key ]; then echo 'initial overlay already mined'; exit 0; fi;
NEIGH=$(wget --header="Accept: text/plain" -T 2 https://api.swarmscan.io/v1/network/neighborhoods/suggestion -q -O -);
printf 'swarmscan suggestion: %s\n' "${NEIGH}";
if [[ ! -n "${NEIGH}" ]] [[ ! "${NEIGH}" =~ ^[0,1]+$ ]]; then echo 'bad neighborhood value ' "${NEIGH}" ; exit 1; fi;
if ! [ -f /home/bee/.bee.yaml ]; then cp -p /tmp/.bee.yaml /home/bee/.bee.yaml; fi;
printf 'target-neighborhood: %s\n' "${NEIGH}" >> /home/bee/.bee.yaml;
echo 'node initialization done';
volumeMounts:
- name: config-file
mountPath: /home/bee
- name: config
mountPath: /tmp/.bee.yaml
subPath: .bee.yaml
- name: data
mountPath: /home/bee/.bee
{{- end }}
{{- if .Values.extraInitContainers }}
{{- toYaml .Values.extraInitContainers | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -210,7 +208,7 @@ spec:
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumeMounts:
{{- if .Values.p2pFixedPort.enabled }}
{{- if or .Values.p2pFixedPort.enabled .Values.autoNeighborhood.enabled }}
- name: config-file
mountPath: /home/bee
{{- else }}
Expand All @@ -233,35 +231,6 @@ spec:
mountPath: /home/bee/.secret/password
subPath: password
readOnly: true
{{- if .Values.clefSettings.enabled }}
- name: clef
image: "{{ include "clef.image" . }}"
imagePullPolicy: {{ .Values.clefSettings.image.pullPolicy }}
{{- if .Values.clefSettings.chainId }}
env:
- name: CLEF_CHAINID
value: {{ .Values.clefSettings.chainId | quote }}
{{- end }}
command:
- /entrypoint.sh
- run
ports:
- containerPort: 8550
name: api
protocol: TCP
resources:
{{- toYaml .Values.clefSettings.resources | nindent 12 }}
volumeMounts:
- name: clef
mountPath: /app/data
readOnly: false
{{- if .Values.clefSettings.password }}
- name: clef-secret
mountPath: /app/data/password
subPath: password
readOnly: true
{{- end }}
{{- end }}
{{- if .Values.gatewayProxy.enabled }}
- name: gateway-proxy
image: "{{ include "gatewayProxy.image" . }}"
Expand Down Expand Up @@ -333,24 +302,6 @@ spec:
- key: {{ template "bee.swarmKeysSecretKey" . }}
path: swarm.map
{{- end }}
{{- if .Values.clefSettings.enabled }}
- name: clef
emptyDir: {}
- name: bee-clef
secret:
secretName: {{ template "bee.clefKeysSecretName" . }}
items:
- key: {{ template "bee.clefKeysSecretKey" . }}
path: clef.map
{{- if .Values.clefSettings.password }}
- name: clef-secret
secret:
secretName: {{ template "bee.clefSecretName" . }}
items:
- key: {{ template "bee.clefSecretPasswordKey" . }}
path: password
{{- end }}
{{- end }}
{{- if and .Values.persistence.enabled .Values.persistence.existingClaim }}
- name: data
persistentVolumeClaim:
Expand Down
29 changes: 4 additions & 25 deletions charts/bee/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ affinity: {}

tolerations: []

## Auto obtain neighborhood to target in binary format for mining the initial overlay
autoNeighborhood:
enabled: false

beeCommand: ["bee", "start", "--config=.bee.yaml"]

beeConfig:
Expand Down Expand Up @@ -266,31 +270,6 @@ swarmSettings:
## Use existing secret (ignores previous swarmKeys)
# existingSecret:

## If enabled it will start clef sidecar container that will auto approve every request
## Clef keys are pregenerated examples and can be replaced with other values
clefSettings:
enabled: false
image:
repository: ethersphere/clef
tag: 0.10.0
# digest: sha256:508a6bc1d3f45acaf98b746d521ee2cb11a895d8334446d2205fe4053b9e3667
pullPolicy: IfNotPresent
clefKeys:
bee-0: '{"address":"fd50ede4954655b993ed69238c55219da7e81acf","crypto":{"cipher":"aes-128-ctr","ciphertext":"1c0f603b0dffe53294c7ca02c1a2800d81d855970db0df1a84cc11bc1d6cf364","cipherparams":{"iv":"11c9ac512348d7ccfe5ee59d9c9388d3"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"f6d7a0947da105fa5ef70fa298f65409d12967108c0e6260f847dc2b10455b89"},"mac":"fc6585e300ad3cb21c5f648b16b8a59ca33bcf13c58197176ffee4786628eaeb"},"id":"4911f965-b425-4011-895d-a2008f859859","version":3}'
chainId: 12345
## Use existing secret (ignores previous clefKeys)
# existingSecret:
## Password for decrypting key (please change it for production deployments)
password: clefbeesecret
## Use existing password (ignores previous keyPassword)
# existingPasswordSecret:
resources: {}
# limits:
# cpu: 1
# memory: 1Gi
# requests:
# cpu: 100m
# memory: 128Mi
## If enabled it will start gateway-proxy sidecar container that will be publicly exposed
## It is used by gateway app
gatewayProxy:
Expand Down

0 comments on commit 03e55e9

Please sign in to comment.