diff --git a/beelocal.sh b/beelocal.sh index d34bed0..61e5d8f 100755 --- a/beelocal.sh +++ b/beelocal.sh @@ -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 @@ -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..." } @@ -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" @@ -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 diff --git a/config/k3d.yaml b/config/k3d.yaml index aa6f4a5..3b01e44 100644 --- a/config/k3d.yaml +++ b/config/k3d.yaml @@ -1,4 +1,4 @@ -apiVersion: k3d.io/v1alpha4 +apiVersion: k3d.io/v1alpha5 kind: Simple metadata: name: bee diff --git a/config/traefik-config.yaml b/config/traefik-config.yaml new file mode 100644 index 0000000..9912867 --- /dev/null +++ b/config/traefik-config.yaml @@ -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"