Skip to content

Commit 2ef3f68

Browse files
authored
Merge pull request #110 from deric/timeout
Support configuration of waiting times
2 parents 707863b + b828b8c commit 2ef3f68

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

Diff for: REFERENCE.md

+32
Original file line numberDiff line numberDiff line change
@@ -1720,6 +1720,38 @@ Default value: `$k8s::etcd_version`
17201720

17211721
Creates a dummy exec to allow deferring applies until the Kubernetes API server has started
17221722

1723+
#### Parameters
1724+
1725+
The following parameters are available in the `k8s::server::wait_online` class:
1726+
1727+
* [`tries`](#-k8s--server--wait_online--tries)
1728+
* [`try_sleep`](#-k8s--server--wait_online--try_sleep)
1729+
* [`timeout`](#-k8s--server--wait_online--timeout)
1730+
1731+
##### <a name="-k8s--server--wait_online--tries"></a>`tries`
1732+
1733+
Data type: `Integer`
1734+
1735+
Number of retries
1736+
1737+
Default value: `15`
1738+
1739+
##### <a name="-k8s--server--wait_online--try_sleep"></a>`try_sleep`
1740+
1741+
Data type: `Integer`
1742+
1743+
Sleep time in seconds
1744+
1745+
Default value: `2`
1746+
1747+
##### <a name="-k8s--server--wait_online--timeout"></a>`timeout`
1748+
1749+
Data type: `Integer`
1750+
1751+
Execution timeout in seconds (0 to disable)
1752+
1753+
Default value: `5`
1754+
17231755
## Defined types
17241756

17251757
### <a name="k8s--binary"></a>`k8s::binary`

Diff for: manifests/server/wait_online.pp

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
# @summary Creates a dummy exec to allow deferring applies until the Kubernetes API server has started
22
#
3-
class k8s::server::wait_online {
4-
# Wait up to 30 seconds for kube-apiserver to start
3+
# @param tries Number of retries
4+
# @param try_sleep Sleep time in seconds
5+
# @param timeout Execution timeout in seconds (0 to disable)
6+
class k8s::server::wait_online (
7+
Integer $tries = 15,
8+
Integer $timeout = 5,
9+
Integer $try_sleep = 2,
10+
) {
11+
# Wait up to $tries * ( $timeout + $try_sleep) seconds for kube-apiserver to start
512
exec { 'k8s apiserver wait online':
613
command => 'kubectl --kubeconfig /root/.kube/config version',
714
path => $facts['path'],
815
refreshonly => true,
9-
tries => 15,
10-
try_sleep => 2,
16+
tries => $tries,
17+
try_sleep => $try_sleep,
18+
timeout => $timeout,
1119
}
1220

1321
# Require possibly managed components before checking online state

0 commit comments

Comments
 (0)