From 23dd5f86247d06021a0cc9faa24372cc75e0cfcb Mon Sep 17 00:00:00 2001 From: Tim Birkett <57101177+js-timbirkett@users.noreply.github.com> Date: Tue, 1 Jun 2021 18:19:08 +0100 Subject: [PATCH 1/4] feat: add STARTUP_DELAY to entrypoint.sh --- runner/entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runner/entrypoint.sh b/runner/entrypoint.sh index 86b5357171..138558bbc9 100755 --- a/runner/entrypoint.sh +++ b/runner/entrypoint.sh @@ -1,5 +1,10 @@ #!/bin/bash +if [ -z "${STARTUP_DELAY}" ]; then + echo "Delaying startup by ${STARTUP_DELAY} seconds" 1>&2 + sleep ${STARTUP_DELAY} +fi + if [ -z "${GITHUB_URL}" ]; then echo "Working with public GitHub" 1>&2 GITHUB_URL="https://github.com/" From 240a48bc5243601df4cc8be6f2e6d9b9b53e3b4c Mon Sep 17 00:00:00 2001 From: Tim Birkett <57101177+js-timbirkett@users.noreply.github.com> Date: Tue, 1 Jun 2021 20:26:17 +0100 Subject: [PATCH 2/4] fix: missing negation in STARTUP_DELAY test --- runner/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runner/entrypoint.sh b/runner/entrypoint.sh index 138558bbc9..88bd866602 100755 --- a/runner/entrypoint.sh +++ b/runner/entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ -z "${STARTUP_DELAY}" ]; then +if [ ! -z "${STARTUP_DELAY}" ]; then echo "Delaying startup by ${STARTUP_DELAY} seconds" 1>&2 sleep ${STARTUP_DELAY} fi From b792c89fb31046ed187ff5083fc15b25959dec44 Mon Sep 17 00:00:00 2001 From: Tim Birkett Date: Wed, 2 Jun 2021 11:14:28 +0100 Subject: [PATCH 3/4] docs: Add use case and examples for STARTUP_DELAY --- README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/README.md b/README.md index f924dbc44c..ec76f0a56d 100644 --- a/README.md +++ b/README.md @@ -938,6 +938,55 @@ Your base64'ed PAT token has a new line at the end, it needs to be created witho * `echo -n $TOKEN | base64` * Create the secret as described in the docs using the shell and documeneted flags +#### Runner coming up before network available + +If you're running your action runners on a service mesh like Istio, you might +have problems with runner configuration accompanied by logs like: + +``` +.... +runner Starting Runner listener with startup type: service +runner Started listener process +runner An error occurred: Not configured +runner Runner listener exited with error code 2 +runner Runner listener exit with retryable error, re-launch runner in 5 seconds. +.... +``` + +This is because the `istio-proxy` has not completed configuring itself when the +configuration script tries to communicate with the network. + +**Solution**
+You can add a delay to the entrypoint script by setting the `STARTUP_DELAY` environment +variable. This will cause the script to sleep `STARTUP_DELAY` seconds. + +*Example `Runner` with a 2 second startup delay:* +```yaml +apiVersion: actions.summerwind.dev/v1alpha1 +kind: Runner +metadata: + name: example-runner-with-sleep +spec: + env: + - name: STARTUP_DELAY + value: "2" # Remember! env var values must be strings. +``` + +*Example `RunnerDeployment` with a 2 second startup delay:* +```yaml +apiVersion: actions.summerwind.dev/v1alpha1 +kind: RunnerDeployment +metadata: + name: example-runnerdeployment-with-sleep +spec: + template: + spec: + env: + - name: STARTUP_DELAY + value: "2" # Remember! env var values must be strings. +``` + + # Contributing For more details about any requirements or process, please check out [Getting Started with Contributing](CONTRIBUTING.md). From 4c7a448b7d020c489729887542bc270a83e797c5 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Thu, 3 Jun 2021 23:50:20 +0000 Subject: [PATCH 4/4] fixup! docs: Add use case and examples for STARTUP_DELAY --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index ec76f0a56d..26c7e76497 100644 --- a/README.md +++ b/README.md @@ -957,6 +957,12 @@ This is because the `istio-proxy` has not completed configuring itself when the configuration script tries to communicate with the network. **Solution**
+ +> This feature is experimental and will be dropped once maintainers think that +> everyone has already migrated to ues Istio's `holdApplicationUntilProxyStarts` ([istio/istio#11130](https://github.com/istio/istio/issues/11130)). +> +> Please read the discussion in #592 for more information. + You can add a delay to the entrypoint script by setting the `STARTUP_DELAY` environment variable. This will cause the script to sleep `STARTUP_DELAY` seconds.