Documentation ¶
Index ¶
- Constants
- Variables
- func TryRunCommand(f func() error, failureThreshold int) error
- type KubeWaiter
- func (w *KubeWaiter) SetTimeout(timeout time.Duration)
- func (w *KubeWaiter) WaitForAPI() error
- func (w *KubeWaiter) WaitForHealthyKubelet(initalTimeout time.Duration, healthzEndpoint string) error
- func (w *KubeWaiter) WaitForKubeletAndFunc(f func() error) error
- func (w *KubeWaiter) WaitForPodToDisappear(podName string) error
- func (w *KubeWaiter) WaitForPodsWithLabel(kvLabel string) error
- func (w *KubeWaiter) WaitForStaticPodControlPlaneHashes(nodeName string) (map[string]string, error)
- func (w *KubeWaiter) WaitForStaticPodHashChange(nodeName, component, previousHash string) error
- func (w *KubeWaiter) WaitForStaticPodSingleHash(nodeName string, component string) (string, error)
- type Waiter
Constants ¶
const ( // APICallRetryInterval defines how long kubeadm should wait before retrying a failed API operation APICallRetryInterval = 500 * time.Millisecond // KubeletHealthzPort is the port of the kubelet healthz endpoint KubeletHealthzPort = 10248 // Etcd defines variable used internally when referring to etcd component Etcd = "etcd" // KubeAPIServer defines variable used internally when referring to kube-apiserver component KubeAPIServer = "kube-apiserver" // KubeControllerManager defines variable used internally when referring to kube-controller-manager component KubeControllerManager = "kube-controller-manager" // KubeScheduler defines variable used internally when referring to kube-scheduler component KubeScheduler = "kube-scheduler" // KubeProxy defines variable used internally when referring to kube-proxy component KubeProxy = "kube-proxy" // HyperKube defines variable used internally when referring to the hyperkube image HyperKube = "hyperkube" ConfigSourceAnnotationKey = "kubernetes.io/config.source" ConfigMirrorAnnotationKey = v1.MirrorPodAnnotationKey ConfigFirstSeenAnnotationKey = "kubernetes.io/config.seen" ConfigHashAnnotationKey = "kubernetes.io/config.hash" CriticalPodAnnotationKey = "scheduler.alpha.kubernetes.io/critical-pod" )
Variables ¶
var ( // ControlPlaneComponents defines the control-plane component names ControlPlaneComponents = []string{KubeAPIServer, KubeControllerManager, KubeScheduler} )
Functions ¶
func TryRunCommand ¶
TryRunCommand runs a function a maximum of failureThreshold times, and retries on error. If failureThreshold is hit; the last error is returned
Types ¶
type KubeWaiter ¶
type KubeWaiter struct {
// contains filtered or unexported fields
}
KubeWaiter is an implementation of Waiter that is backed by a Kubernetes client
func (*KubeWaiter) SetTimeout ¶
func (w *KubeWaiter) SetTimeout(timeout time.Duration)
SetTimeout adjusts the timeout to the specified duration
func (*KubeWaiter) WaitForAPI ¶
func (w *KubeWaiter) WaitForAPI() error
WaitForAPI waits for the API Server's /healthz endpoint to report "ok"
func (*KubeWaiter) WaitForHealthyKubelet ¶
func (w *KubeWaiter) WaitForHealthyKubelet(initalTimeout time.Duration, healthzEndpoint string) error
WaitForHealthyKubelet blocks until the kubelet /healthz endpoint returns 'ok'
func (*KubeWaiter) WaitForKubeletAndFunc ¶
func (w *KubeWaiter) WaitForKubeletAndFunc(f func() error) error
WaitForKubeletAndFunc waits primarily for the function f to execute, even though it might take some time. If that takes a long time, and the kubelet /healthz continuously are unhealthy, kubeadm will error out after a period of exponential backoff
func (*KubeWaiter) WaitForPodToDisappear ¶
func (w *KubeWaiter) WaitForPodToDisappear(podName string) error
WaitForPodToDisappear blocks until it timeouts or gets a "NotFound" response from the API Server when getting the Static Pod in question
func (*KubeWaiter) WaitForPodsWithLabel ¶
func (w *KubeWaiter) WaitForPodsWithLabel(kvLabel string) error
WaitForPodsWithLabel will lookup pods with the given label and wait until they are all reporting status as running.
func (*KubeWaiter) WaitForStaticPodControlPlaneHashes ¶
func (w *KubeWaiter) WaitForStaticPodControlPlaneHashes(nodeName string) (map[string]string, error)
WaitForStaticPodControlPlaneHashes blocks until it timeouts or gets a hash map for all components and their Static Pods
func (*KubeWaiter) WaitForStaticPodHashChange ¶
func (w *KubeWaiter) WaitForStaticPodHashChange(nodeName, component, previousHash string) error
WaitForStaticPodHashChange blocks until it timeouts or notices that the Mirror Pod (for the Static Pod, respectively) has changed This implicitly means this function blocks until the kubelet has restarted the Static Pod in question
func (*KubeWaiter) WaitForStaticPodSingleHash ¶
func (w *KubeWaiter) WaitForStaticPodSingleHash(nodeName string, component string) (string, error)
WaitForStaticPodSingleHash blocks until it timeouts or gets a hash for a single component and its Static Pod
type Waiter ¶
type Waiter interface { // WaitForAPI waits for the API Server's /healthz endpoint to become "ok" WaitForAPI() error // WaitForPodsWithLabel waits for Pods in the kube-system namespace to become Ready WaitForPodsWithLabel(kvLabel string) error // WaitForPodToDisappear waits for the given Pod in the kube-system namespace to be deleted WaitForPodToDisappear(staticPodName string) error // WaitForStaticPodSingleHash fetches sha256 hash for the control plane static pod WaitForStaticPodSingleHash(nodeName string, component string) (string, error) // WaitForStaticPodHashChange waits for the given static pod component's static pod hash to get updated. // By doing that we can be sure that the kubelet has restarted the given Static Pod WaitForStaticPodHashChange(nodeName, component, previousHash string) error // WaitForStaticPodControlPlaneHashes fetches sha256 hashes for the control plane static pods WaitForStaticPodControlPlaneHashes(nodeName string) (map[string]string, error) // WaitForHealthyKubelet blocks until the kubelet /healthz endpoint returns 'ok' WaitForHealthyKubelet(initalTimeout time.Duration, healthzEndpoint string) error // WaitForKubeletAndFunc is a wrapper for WaitForHealthyKubelet that also blocks for a function WaitForKubeletAndFunc(f func() error) error // SetTimeout adjusts the timeout to the specified duration SetTimeout(timeout time.Duration) }
Waiter is an interface for waiting for criteria in Kubernetes to happen