Skip to content

Commit 8d2c71e

Browse files
committed
bee: add iplookup fallbacks
1 parent 7b35a95 commit 8d2c71e

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

charts/bee/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
appVersion: 2.5.0
33
name: bee
4-
version: 0.17.2
4+
version: 0.17.3
55
kubeVersion: ">=1.19.0-0"
66
description: Ethereum Swarm Bee Helm chart for Kubernetes
77
home: https://www.ethswarm.org

charts/bee/templates/statefulset.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,22 @@ spec:
110110
if ! [ -f /home/bee/.bee.yaml ]; then cp -p /tmp/.bee.yaml /home/bee/.bee.yaml; fi;
111111
export INDEX=$(echo $(hostname) | rev | cut -d'-' -f 1 | rev);
112112
{{- if .Values.p2pFixedPort.enabled }}
113-
PUBLIC_IP=$(wget -T 10 {{ .Values.p2pFixedPort.publicIpUrl }} -q -O -);
114-
NAT_PORT=$(( {{ .Values.p2pFixedPort.nodePortStart }} + INDEX ));
115-
printf 'nat-addr: %s:%s\n' "${PUBLIC_IP}" "${NAT_PORT}" >> /home/bee/.bee.yaml;
113+
for url in {{ .Values.p2pFixedPort.publicIpUrls | join " " }}; do
114+
PUBLIC_IP=$(wget -T 10 $url -q -O -) && [ -n "$PUBLIC_IP" ] && break
115+
done;
116+
if [ -n "${PUBLIC_IP}" ]; then
117+
NAT_PORT=$(( {{ .Values.p2pFixedPort.nodePortStart }} + INDEX ));
118+
printf 'nat-addr: %s:%s\n' "${PUBLIC_IP}" "${NAT_PORT}" >> /home/bee/.bee.yaml;
119+
fi;
116120
{{- end }}
117121
{{- if .Values.p2pWssFixedPort.enabled }}
118-
PUBLIC_IP=$(wget -T 10 {{ .Values.p2pWssFixedPort.publicIpUrl }} -q -O -);
119-
NAT_PORT=$(( {{ .Values.p2pWssFixedPort.nodePortStart }} + INDEX ));
120-
printf 'nat-wss-addr: %s:%s\n' "${PUBLIC_IP}" "${NAT_PORT}" >> /home/bee/.bee.yaml;
122+
for url in {{ .Values.p2pWssFixedPort.publicIpUrls | join " " }}; do
123+
PUBLIC_IP=$(wget -T 10 $url -q -O -) && [ -n "$PUBLIC_IP" ] && break
124+
done;
125+
if [ -n "${PUBLIC_IP}" ]; then
126+
NAT_PORT=$(( {{ .Values.p2pWssFixedPort.nodePortStart }} + INDEX ));
127+
printf 'nat-wss-addr: %s:%s\n' "${PUBLIC_IP}" "${NAT_PORT}" >> /home/bee/.bee.yaml;
128+
fi;
121129
{{- end }}
122130
echo 'node initialization done';
123131
volumeMounts:

charts/bee/values.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ singlePodSts:
5858
p2pFixedPort:
5959
enabled: false
6060
nodePortStart: 31000
61-
publicIpUrl: http://ifconfig.me/ip
61+
publicIpUrls:
62+
- http://ifconfig.me/ip
63+
- http://icanhazip.com
64+
- http://ifconfig.co/ip
6265

6366
## If enabled, creates ingress for HTTP api
6467
## Creates one ingress per pod and additionally one common ingress for all pods
@@ -212,7 +215,10 @@ beeConfig:
212215
p2pWssFixedPort:
213216
enabled: false
214217
nodePortStart: 31001
215-
publicIpUrl: http://ifconfig.me/ip
218+
publicIpUrls:
219+
- http://ifconfig.me/ip
220+
- http://icanhazip.com
221+
- http://ifconfig.co/ip
216222

217223

218224
## Password for decrypting bee keys (please set it for production deployments)

0 commit comments

Comments
 (0)