Puppet Class: k8s::server::wait_online

Defined in:
manifests/server/wait_online.pp

Summary

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

Overview



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'manifests/server/wait_online.pp', line 2

class k8s::server::wait_online {
  # Wait up to 30 seconds for kube-apiserver to start
  exec { 'k8s apiserver wait online':
    command     => 'kubectl --kubeconfig /root/.kube/config version',
    path        => $facts['path'],
    refreshonly => true,
    tries       => 15,
    try_sleep   => 2,
  }

  # Require possibly managed components before checking online state
  Kubeconfig <| title == '/root/.kube/config' |> -> Exec['k8s apiserver wait online']
  K8s::Binary <| title == 'kubectl' |> -> Exec['k8s apiserver wait online']
  Service <| title == 'kube-apiserver' |> ~> Exec['k8s apiserver wait online']
}