Documentation ¶
Overview ¶
Package kverify verifies a running Kubernetes cluster is healthy
Package kverify verifies a running Kubernetes cluster is healthy ¶
Package kverify verifies a running Kubernetes cluster is healthy ¶
Package kverify verifies a running Kubernetes cluster is healthy ¶
Package kverify verifies a running Kubernetes cluster is healthy ¶
Package kverify verifies a running Kubernetes cluster is healthy ¶
Package kverify verifies a running Kubernetes cluster is healthy ¶
Package kverify verifies a running Kubernetes cluster is healthy
Index ¶
- Constants
- Variables
- func APIServerPID(cr command.Runner) (int, error)
- func APIServerStatus(cr command.Runner, hostname string, port int) (state.State, error)
- func APIServerVersionMatch(client *kubernetes.Clientset, expected string) error
- func ExpectAppsRunning(cs *kubernetes.Clientset, expected []string) error
- func IsPodReady(pod *core.Pod) (ready bool, reason string)
- func NodePressure(cs *kubernetes.Clientset) error
- func ServiceStatus(cr command.Runner, svc string) state.State
- func ShouldWait(wcs map[string]bool) bool
- func WaitExtra(cs *kubernetes.Clientset, labels []string, timeout time.Duration) error
- func WaitForAPIServerProcess(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, ...) error
- func WaitForAPIServerStatus(cr command.Runner, to time.Duration, hostname string, port int) (state.State, error)
- func WaitForAppsRunning(cs *kubernetes.Clientset, expected []string, timeout time.Duration) error
- func WaitForDefaultSA(cs *kubernetes.Clientset, timeout time.Duration) error
- func WaitForHealthyAPIServer(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, ...) error
- func WaitForService(cr command.Runner, svc string, timeout time.Duration) error
- func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, ...) error
- func WaitNodeCondition(cs *kubernetes.Clientset, name string, condition core.NodeConditionType, ...) error
- type ErrDiskPressure
- type ErrMemoryPressure
- type ErrNetworkNotReady
- type ErrPIDPressure
- type NodeCondition
Constants ¶
const ( // APIServerWaitKey is the name used in the flags for k8s api server APIServerWaitKey = "apiserver" // SystemPodsWaitKey is the name used in the flags for pods in the kube system SystemPodsWaitKey = "system_pods" // DefaultSAWaitKey is the name used in the flags for default service account DefaultSAWaitKey = "default_sa" // AppsRunningKey is the name used in the flags for waiting for k8s-apps to be running AppsRunningKey = "apps_running" // NodeReadyKey is the name used in the flags for waiting for the node status to be ready NodeReadyKey = "node_ready" // KubeletKey is the name used in the flags for waiting for the kubelet status to be ready KubeletKey = "kubelet" // ExtraKey is the name used for extra waiting for pods in CorePodsLabels to be Ready ExtraKey = "extra" )
Variables ¶
var ( // DefaultComponents is map of the the default components to wait for DefaultComponents = map[string]bool{APIServerWaitKey: true, SystemPodsWaitKey: true} // NoWaitComponents is map of componets to wait for if specified 'none' or 'false' NoComponents = map[string]bool{APIServerWaitKey: false, SystemPodsWaitKey: false, DefaultSAWaitKey: false, AppsRunningKey: false, NodeReadyKey: false, KubeletKey: false, ExtraKey: false} // AllComponents is map for waiting for all components. AllComponents = map[string]bool{APIServerWaitKey: true, SystemPodsWaitKey: true, DefaultSAWaitKey: true, AppsRunningKey: true, NodeReadyKey: true, KubeletKey: true, ExtraKey: true} // DefaultWaitList is list of all default components to wait for. only names to be used for start flags. DefaultWaitList = []string{APIServerWaitKey, SystemPodsWaitKey} // AllComponentsList list of all valid components keys to wait for. only names to be used used for start flags. AllComponentsList = []string{APIServerWaitKey, SystemPodsWaitKey, DefaultSAWaitKey, AppsRunningKey, NodeReadyKey, KubeletKey} // AppsRunningList running list are valid k8s-app components to wait for them to be running AppsRunningList = []string{ "kube-dns", "etcd", "kube-apiserver", "kube-controller-manager", "kube-proxy", "kube-scheduler", } // CorePodsLabels is a list of essential, in addition to any other system-critical, pods for running kurnetes to extra wait for them to be Ready CorePodsLabels = []string{ "k8s-app=kube-dns", "component=etcd", "component=kube-apiserver", "component=kube-controller-manager", "k8s-app=kube-proxy", "component=kube-scheduler", } )
vars related to the --wait flag
Functions ¶
func APIServerPID ¶ added in v1.17.0
APIServerPID returns our best guess to the apiserver pid
func APIServerStatus ¶
APIServerStatus returns apiserver status in libmachine style state.State
func APIServerVersionMatch ¶ added in v1.9.0
func APIServerVersionMatch(client *kubernetes.Clientset, expected string) error
APIServerVersionMatch checks if the server version matches the expected
func ExpectAppsRunning ¶ added in v1.10.0
func ExpectAppsRunning(cs *kubernetes.Clientset, expected []string) error
ExpectAppsRunning returns whether or not all expected k8s-apps are running. (without waiting for them)
func IsPodReady ¶ added in v1.18.0
IsPodReady returns if pod is Ready and verbose reason.
func NodePressure ¶ added in v1.10.0
func NodePressure(cs *kubernetes.Clientset) error
NodePressure verfies that node is not under disk, memory, pid or network pressure.
func ServiceStatus ¶ added in v1.14.1
ServiceStatus checks the status of a systemd or init.d service
func ShouldWait ¶ added in v1.9.2
ShouldWait will return true if the config says need to wait
func WaitExtra ¶ added in v1.18.0
WaitExtra calls waitPodCondition for all system-critical pods including those with specified labels.
func WaitForAPIServerProcess ¶ added in v1.9.0
func WaitForAPIServerProcess(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, cr command.Runner, start time.Time, timeout time.Duration) error
WaitForAPIServerProcess waits for api server to be healthy returns error if it doesn't
func WaitForAPIServerStatus ¶ added in v1.22.0
func WaitForAPIServerStatus(cr command.Runner, to time.Duration, hostname string, port int) (state.State, error)
WaitForAPIServerStatus waits for 'to' duration to get apiserver pod running or stopped this functions is intended to use in situations where apiserver process can be recreated by container runtime restart for example and there is a gap before it comes back
func WaitForAppsRunning ¶ added in v1.10.0
WaitForAppsRunning waits for expected Apps To be running
func WaitForDefaultSA ¶ added in v1.9.2
func WaitForDefaultSA(cs *kubernetes.Clientset, timeout time.Duration) error
WaitForDefaultSA waits for the default service account to be created.
func WaitForHealthyAPIServer ¶ added in v1.9.0
func WaitForHealthyAPIServer(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, cr command.Runner, client *kubernetes.Clientset, start time.Time, hostname string, port int, timeout time.Duration) error
WaitForHealthyAPIServer waits for api server status to be running
func WaitForService ¶ added in v1.14.1
WaitForService will wait for a "systemd" or "init.d" service to be running on the node... not to be confused with Kubernetes Services
func WaitForSystemPods ¶ added in v1.9.0
func WaitForSystemPods(r cruntime.Manager, bs bootstrapper.Bootstrapper, cfg config.ClusterConfig, cr command.Runner, client *kubernetes.Clientset, start time.Time, timeout time.Duration) error
WaitForSystemPods verifies essential pods for running kurnetes is running
func WaitNodeCondition ¶ added in v1.19.0
func WaitNodeCondition(cs *kubernetes.Clientset, name string, condition core.NodeConditionType, timeout time.Duration) error
WaitNodeCondition waits for specified condition of node name.
Types ¶
type ErrDiskPressure ¶ added in v1.10.0
type ErrDiskPressure struct {
NodeCondition
}
ErrDiskPressure is thrown when there is node disk pressure condition
func (*ErrDiskPressure) Error ¶ added in v1.10.0
func (e *ErrDiskPressure) Error() string
type ErrMemoryPressure ¶ added in v1.10.0
type ErrMemoryPressure struct {
NodeCondition
}
ErrMemoryPressure is thrown when there is node memory pressure condition
func (*ErrMemoryPressure) Error ¶ added in v1.10.0
func (e *ErrMemoryPressure) Error() string
type ErrNetworkNotReady ¶ added in v1.10.0
type ErrNetworkNotReady struct {
NodeCondition
}
ErrNetworkNotReady is thrown when there is node condition is network not ready
func (*ErrNetworkNotReady) Error ¶ added in v1.10.0
func (e *ErrNetworkNotReady) Error() string
type ErrPIDPressure ¶ added in v1.10.0
type ErrPIDPressure struct {
NodeCondition
}
ErrPIDPressure is thrown when there is node PID pressure condition
func (*ErrPIDPressure) Error ¶ added in v1.10.0
func (e *ErrPIDPressure) Error() string
type NodeCondition ¶ added in v1.10.0
type NodeCondition struct { Type v1.NodeConditionType Status v1.ConditionStatus Reason string Message string }
NodeCondition represents a favorable or unfavorable node condition.
func (*NodeCondition) DiskPressure ¶ added in v1.10.0
func (pc *NodeCondition) DiskPressure() bool
DiskPressure detects if the condition is disk pressure
func (*NodeCondition) MemoryPressure ¶ added in v1.10.0
func (pc *NodeCondition) MemoryPressure() bool
MemoryPressure detects if the condition is memory pressure
func (*NodeCondition) NetworkUnavailable ¶ added in v1.10.0
func (pc *NodeCondition) NetworkUnavailable() bool
NetworkUnavailable detects if the condition is PID pressure
func (*NodeCondition) PIDPressure ¶ added in v1.10.0
func (pc *NodeCondition) PIDPressure() bool
PIDPressure detects if the condition is PID pressure