Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion beelocal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ config() {
trap 'rm -rf ${BEE_TEMP}' EXIT
curl -sSL https://raw.githubusercontent.com/ethersphere/beelocal/"${BEELOCAL_BRANCH}"/config/k3d.yaml -o "${BEE_TEMP}"/k3d.yaml
curl -sSL https://raw.githubusercontent.com/ethersphere/beelocal/"${BEELOCAL_BRANCH}"/config/geth-swap.yaml -o "${BEE_TEMP}"/geth-swap.yaml
curl -sSL https://raw.githubusercontent.com/ethersphere/beelocal/"${BEELOCAL_BRANCH}"/config/traefik-config.yaml -o "${BEE_TEMP}"/traefik-config.yaml
if [[ -n $CI ]]; then
curl -sSL https://raw.githubusercontent.com/ethersphere/beelocal/"${BEELOCAL_BRANCH}"/hack/registries.yaml -o "${BEE_TEMP}"/registries.yaml
sudo cp "${BEE_TEMP}"/registries.yaml /etc/rancher/k3s/registries.yaml
Expand Down Expand Up @@ -189,6 +190,7 @@ k8s-local() {
until kubectl get svc traefik -n kube-system &> /dev/null; do sleep 1; done
# Wait for geth
wait
configure-traefik
echo "cluster running..."
}

Expand Down Expand Up @@ -257,6 +259,39 @@ geth() {
fi
}

configure-traefik() {
if [[ -z $BEE_CONFIG ]]; then
config
fi
echo "configuring Traefik with custom timeouts..."

local config_file=""

if [[ -f "./config/traefik-config.yaml" ]] && grep -q "apiVersion:" "./config/traefik-config.yaml"; then
config_file="./config/traefik-config.yaml"
echo "Using local traefik-config.yaml"
elif [[ -f "${BEE_CONFIG}/traefik-config.yaml" ]] && grep -q "apiVersion:" "${BEE_CONFIG}/traefik-config.yaml"; then
config_file="${BEE_CONFIG}/traefik-config.yaml"
echo "Using downloaded traefik-config.yaml"
fi

if [[ -n "$config_file" ]]; then
kubectl apply -f "$config_file" || echo "Warning: Failed to apply Traefik config"
echo "waiting for Traefik to restart with new configuration..."
kubectl rollout restart deployment/traefik -n kube-system || echo "Warning: Failed to restart Traefik"
kubectl rollout status deployment/traefik -n kube-system --timeout=120s || echo "Warning: Traefik rollout status check failed"
echo "Traefik configuration applied successfully"
echo "Current Traefik timeout settings:"
kubectl describe deployment traefik -n kube-system | grep -E "entryPoints.*Timeout" || echo "No timeout settings found in deployment description"
else
echo "Info: No valid Traefik config file found, using default timeouts"
echo "Looked for valid configs in: ${BEE_CONFIG}/traefik-config.yaml and ./config/traefik-config.yaml"
if [[ "${FUNCNAME[1]}" != "k8s-local" ]]; then
exit 1
fi
fi
}

stop() {
if [[ -n $CI ]]; then
echo "action not supported for CI"
Expand Down Expand Up @@ -338,7 +373,7 @@ for OPT in $OPTS; do
fi
done

ACTIONS=(build check destroy geth install k8s-local uninstall start stop run prepare add-hosts del-hosts)
ACTIONS=(build check destroy geth install k8s-local uninstall start stop run prepare add-hosts del-hosts configure-traefik)
if [[ " ${ACTIONS[*]} " == *"$ACTION"* ]]; then
if [[ $ACTION == "run" ]]; then
check
Expand Down
2 changes: 1 addition & 1 deletion config/k3d.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: k3d.io/v1alpha4
apiVersion: k3d.io/v1alpha5
kind: Simple
metadata:
name: bee
Expand Down
14 changes: 14 additions & 0 deletions config/traefik-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
additionalArguments:
- "--entryPoints.web.transport.respondingTimeouts.readTimeout=300s"
- "--entryPoints.web.transport.respondingTimeouts.writeTimeout=300s"
- "--entryPoints.web.transport.respondingTimeouts.idleTimeout=300s"
- "--entryPoints.websecure.transport.respondingTimeouts.readTimeout=300s"
- "--entryPoints.websecure.transport.respondingTimeouts.writeTimeout=300s"
- "--entryPoints.websecure.transport.respondingTimeouts.idleTimeout=300s"