feat: add STARTUP_DELAY to entrypoint.sh (#592)
Ref #591 Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
parent
7523ea44f1
commit
a93fd21f21
55
README.md
55
README.md
|
|
@ -944,6 +944,61 @@ Your base64'ed PAT token has a new line at the end, it needs to be created witho
|
||||||
* `echo -n $TOKEN | base64`
|
* `echo -n $TOKEN | base64`
|
||||||
* Create the secret as described in the docs using the shell and documeneted flags
|
* 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**<br />
|
||||||
|
|
||||||
|
> 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.
|
||||||
|
|
||||||
|
*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
|
# Contributing
|
||||||
|
|
||||||
For more details about any requirements or process, please check out [Getting Started with Contributing](CONTRIBUTING.md).
|
For more details about any requirements or process, please check out [Getting Started with Contributing](CONTRIBUTING.md).
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
#!/bin/bash
|
#!/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
|
if [ -z "${GITHUB_URL}" ]; then
|
||||||
echo "Working with public GitHub" 1>&2
|
echo "Working with public GitHub" 1>&2
|
||||||
GITHUB_URL="https://github.com/"
|
GITHUB_URL="https://github.com/"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue