Skip to content

Commit

Permalink
feat: retry external IP fetch (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
cjorge-graphops committed Aug 14, 2024
1 parent 92d2425 commit 5dfd4f5
Show file tree
Hide file tree
Showing 10 changed files with 1,347 additions and 1,368 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/make-chart-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ jobs:
- name: Yarn install
run: |
set -x -e
yarn install
corepack enable
corepack yarn install
- name: Get chart name
id: chart_name
Expand All @@ -68,7 +68,7 @@ jobs:
export GIT_CLIFF__GIT__TAG_PATTERN="$CHART-*"
GIT_CLIFF__GIT__IGNORE_TAGS="$CHART-v?[0-9]+.[0-9]+.[0-9]+-.*"
yarn git-cliff -c ".cliff.toml" --include-path "charts/$CHART/**" --strip all -l -t "${{ needs.init.outputs.tag }}" -o "RELEASE-NOTES.md"
corepack yarn git-cliff -c ".cliff.toml" --include-path "charts/$CHART/**" --strip all -l -t "${{ needs.init.outputs.tag }}" -o "RELEASE-NOTES.md"
- uses: actions/upload-artifact@v3
with:
Expand Down
22 changes: 20 additions & 2 deletions charts/celo/templates/celo/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,32 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SITES
value: "https://v4.ident.me https://api.ipify.org https://ifconfig.me"
command:
- sh
- -c
- >
- |
set -ex;
export EXTERNAL_PORT=$(kubectl get services -l "pod in (${POD_NAME}), type in (p2p)" -o jsonpath='{.items[0].spec.ports[0].nodePort}');
export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}');
export EXTERNAL_IP=${EXTERNAL_IP:-$(curl --silent v4.ident.me)};
until [ -n "$EXTERNAL_IP" ]; do
for SITE in $SITES; do
if [ -z "$EXTERNAL_IP" ]; then
# Attempt to retrieve the external IP using the current site
EXTERNAL_IP=$(curl --silent --max-time 5 "$SITE")
# If a valid IP is retrieved, exit the loop
if [ -n "$EXTERNAL_IP" ]; then
break
fi
fi
done
# Sleep for a second before retrying if EXTERNAL_IP is still not set
if [ -z "$EXTERNAL_IP" ]; then
sleep 1
fi
done
export EXTERNAL_IP=${EXTERNAL_IP:-"UNAVAILABLE"};
echo "EXTERNAL_PORT=$EXTERNAL_PORT" > /env/init-nodeport;
echo "EXTERNAL_IP=$EXTERNAL_IP" >> /env/init-nodeport;
cat /env/init-nodeport;
Expand Down
24 changes: 21 additions & 3 deletions charts/erigon/templates/stateful-node/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,32 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SITES
value: "https://v4.ident.me https://api.ipify.org https://ifconfig.me"
command:
- sh
- -c
- >
- |
set -ex;
export EXTERNAL_PORT=$(kubectl get services {{ include "erigon.fullname" . }}-{{ $componentName }}-p2p-0 -o jsonpath='{.spec.ports[0].nodePort}');
export EXTERNAL_PORT=$(kubectl get services -l "pod in (${POD_NAME}), type in (p2p)" -o jsonpath='{.items[0].spec.ports[0].nodePort}');
export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}');
export EXTERNAL_IP=${EXTERNAL_IP:-$(curl --silent v4.ident.me)};
until [ -n "$EXTERNAL_IP" ]; do
for SITE in $SITES; do
if [ -z "$EXTERNAL_IP" ]; then
# Attempt to retrieve the external IP using the current site
EXTERNAL_IP=$(curl --silent --max-time 5 "$SITE")
# If a valid IP is retrieved, exit the loop
if [ -n "$EXTERNAL_IP" ]; then
break
fi
fi
done
# Sleep for a second before retrying if EXTERNAL_IP is still not set
if [ -z "$EXTERNAL_IP" ]; then
sleep 1
fi
done
export EXTERNAL_IP=${EXTERNAL_IP:-"UNAVAILABLE"};
echo "EXTERNAL_PORT=$EXTERNAL_PORT" > /env/init-nodeport;
echo "EXTERNAL_IP=$EXTERNAL_IP" >> /env/init-nodeport;
cat /env/init-nodeport;
Expand Down
20 changes: 18 additions & 2 deletions charts/lighthouse/templates/lighthouse/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,24 @@ spec:
- -c
- |
set -ex;
#export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}');
export EXTERNAL_IP=${EXTERNAL_IP:-$(curl --silent v4.ident.me)};
export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}');
until [ -n "$EXTERNAL_IP" ]; do
for SITE in $SITES; do
if [ -z "$EXTERNAL_IP" ]; then
# Attempt to retrieve the external IP using the current site
EXTERNAL_IP=$(curl --silent --max-time 5 "$SITE")
# If a valid IP is retrieved, exit the loop
if [ -n "$EXTERNAL_IP" ]; then
break
fi
fi
done
# Sleep for a second before retrying if EXTERNAL_IP is still not set
if [ -z "$EXTERNAL_IP" ]; then
sleep 1
fi
done
export EXTERNAL_IP=${EXTERNAL_IP:-"UNAVAILABLE"};
echo "EXTERNAL_IP=$EXTERNAL_IP" > /env/init-external-endpoint;
cat /env/init-external-endpoint;
volumeMounts:
Expand Down
26 changes: 22 additions & 4 deletions charts/listener-radio/templates/listener-radio/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,33 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SITES
value: "https://v4.ident.me https://api.ipify.org https://ifconfig.me"
command:
- sh
- -c
- >
- |
set -ex;
export EXTERNAL_PORT_WAKU=$(kubectl get services {{ include "listener-radio.fullname" . }}-p2p-0 -o=jsonpath='{.spec.ports[?(@.name=="waku-port")].nodePort}');
export EXTERNAL_PORT_DISCV5=$(kubectl get services {{ include "listener-radio.fullname" . }}-p2p-0 -o=jsonpath='{.spec.ports[?(@.name=="discv5-port")].nodePort}');
export EXTERNAL_PORT_WAKU=$(kubectl get services -l "pod in (${POD_NAME}), type in (p2p)" -o=jsonpath='{.spec.ports[?(@.name=="waku-port")].nodePort}');
export EXTERNAL_PORT_DISCV5=$(kubectl get services -l "pod in (${POD_NAME}), type in (p2p)" -o=jsonpath='{.spec.ports[?(@.name=="discv5-port")].nodePort}');
export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}');
export EXTERNAL_IP=${EXTERNAL_IP:-$(curl --silent v4.ident.me)};
until [ -n "$EXTERNAL_IP" ]; do
for SITE in $SITES; do
if [ -z "$EXTERNAL_IP" ]; then
# Attempt to retrieve the external IP using the current site
EXTERNAL_IP=$(curl --silent --max-time 5 "$SITE")
# If a valid IP is retrieved, exit the loop
if [ -n "$EXTERNAL_IP" ]; then
break
fi
fi
done
# Sleep for a second before retrying if EXTERNAL_IP is still not set
if [ -z "$EXTERNAL_IP" ]; then
sleep 1
fi
done
export EXTERNAL_IP=${EXTERNAL_IP:-"UNAVAILABLE"};
echo "EXTERNAL_PORT_WAKU=$EXTERNAL_PORT_WAKU" > /env/init-nodeport;
echo "EXTERNAL_PORT_DISCV5=$EXTERNAL_PORT_DISCV5" >> /env/init-nodeport;
echo "EXTERNAL_IP=$EXTERNAL_IP" >> /env/init-nodeport;
Expand Down
24 changes: 21 additions & 3 deletions charts/nethermind/templates/nethermind/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,32 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SITES
value: "https://v4.ident.me https://api.ipify.org https://ifconfig.me"
command:
- sh
- -c
- >
- |
set -ex;
export EXTERNAL_PORT=$(kubectl get services {{ include "nethermind.fullname" . }}-{{ $componentName }}-p2p-0 -o jsonpath='{.spec.ports[0].nodePort}');
export EXTERNAL_PORT=$(kubectl get services -l "pod in (${POD_NAME}), type in (p2p)" -o jsonpath='{.spec.ports[0].nodePort}');
export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}');
export EXTERNAL_IP=${EXTERNAL_IP:-$(curl --silent v4.ident.me)};
until [ -n "$EXTERNAL_IP" ]; do
for SITE in $SITES; do
if [ -z "$EXTERNAL_IP" ]; then
# Attempt to retrieve the external IP using the current site
EXTERNAL_IP=$(curl --silent --max-time 5 "$SITE")
# If a valid IP is retrieved, exit the loop
if [ -n "$EXTERNAL_IP" ]; then
break
fi
fi
done
# Sleep for a second before retrying if EXTERNAL_IP is still not set
if [ -z "$EXTERNAL_IP" ]; then
sleep 1
fi
done
export EXTERNAL_IP=${EXTERNAL_IP:-"UNAVAILABLE"};
echo "EXTERNAL_PORT=$EXTERNAL_PORT" > /env/init-nodeport;
echo "EXTERNAL_IP=$EXTERNAL_IP" >> /env/init-nodeport;
cat /env/init-nodeport;
Expand Down
24 changes: 21 additions & 3 deletions charts/nimbus/templates/nimbus/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,32 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SITES
value: "https://v4.ident.me https://api.ipify.org https://ifconfig.me"
command:
- sh
- -c
- >
- |
set -ex;
export EXTERNAL_PORT=$(kubectl get services {{ include "nimbus.fullname" . }}-{{ $componentName }}-p2p-0 -o jsonpath='{.spec.ports[0].nodePort}');
export EXTERNAL_PORT=$(kubectl get services -l "pod in (${POD_NAME}), type in (p2p)" -o jsonpath='{.spec.ports[0].nodePort}');
export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}');
export EXTERNAL_IP=${EXTERNAL_IP:-$(curl --silent v4.ident.me)};
until [ -n "$EXTERNAL_IP" ]; do
for SITE in $SITES; do
if [ -z "$EXTERNAL_IP" ]; then
# Attempt to retrieve the external IP using the current site
EXTERNAL_IP=$(curl --silent --max-time 5 "$SITE")
# If a valid IP is retrieved, exit the loop
if [ -n "$EXTERNAL_IP" ]; then
break
fi
fi
done
# Sleep for a second before retrying if EXTERNAL_IP is still not set
if [ -z "$EXTERNAL_IP" ]; then
sleep 1
fi
done
export EXTERNAL_IP=${EXTERNAL_IP:-"UNAVAILABLE"};
echo "EXTERNAL_PORT=$EXTERNAL_PORT" > /env/init-nodeport;
echo "EXTERNAL_IP=$EXTERNAL_IP" >> /env/init-nodeport;
cat /env/init-nodeport;
Expand Down
26 changes: 22 additions & 4 deletions charts/subgraph-radio/templates/subgraph-radio/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,33 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: SITES
value: "https://v4.ident.me https://api.ipify.org https://ifconfig.me"
command:
- sh
- -c
- >
- |
set -ex;
export EXTERNAL_PORT_WAKU=$(kubectl get services {{ include "subgraph-radio.fullname" . }}-p2p-0 -o=jsonpath='{.spec.ports[?(@.name=="waku-port")].nodePort}');
export EXTERNAL_PORT_DISCV5=$(kubectl get services {{ include "subgraph-radio.fullname" . }}-p2p-0 -o=jsonpath='{.spec.ports[?(@.name=="discv5-port")].nodePort}');
export EXTERNAL_PORT_WAKU=$(kubectl get services -l "pod in (${POD_NAME}), type in (p2p)" -o=jsonpath='{.spec.ports[?(@.name=="waku-port")].nodePort}');
export EXTERNAL_PORT_DISCV5=$(kubectl get services -l "pod in (${POD_NAME}), type in (p2p)" -o=jsonpath='{.spec.ports[?(@.name=="discv5-port")].nodePort}');
export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}');
export EXTERNAL_IP=${EXTERNAL_IP:-$(curl --silent v4.ident.me)};
until [ -n "$EXTERNAL_IP" ]; do
for SITE in $SITES; do
if [ -z "$EXTERNAL_IP" ]; then
# Attempt to retrieve the external IP using the current site
EXTERNAL_IP=$(curl --silent --max-time 5 "$SITE")
# If a valid IP is retrieved, exit the loop
if [ -n "$EXTERNAL_IP" ]; then
break
fi
fi
done
# Sleep for a second before retrying if EXTERNAL_IP is still not set
if [ -z "$EXTERNAL_IP" ]; then
sleep 1
fi
done
export EXTERNAL_IP=${EXTERNAL_IP:-"UNAVAILABLE"};
echo "EXTERNAL_PORT_WAKU=$EXTERNAL_PORT_WAKU" > /env/init-nodeport;
echo "EXTERNAL_PORT_DISCV5=$EXTERNAL_PORT_DISCV5" >> /env/init-nodeport;
echo "EXTERNAL_IP=$EXTERNAL_IP" >> /env/init-nodeport;
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
"license": "Apache 2",
"private": true,
"devDependencies": {
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"git-cliff": "^1.2.0",
"husky": "^8.0.3"
"@commitlint/cli": "^19.4.0",
"@commitlint/config-conventional": "^19.2.2",
"git-cliff": "^2.4.0",
"husky": "^9.1.4"
},
"scripts": {
"prepare": "husky install",
"lint": "./scripts/lint.sh"
}
},
"packageManager": "yarn@3.6.0+sha256.6da0a4bdb4de78399dd577ff72273ca46152c61399574ffc8e9a5a3c36eab270"
}
Loading

0 comments on commit 5dfd4f5

Please sign in to comment.