validation

package
v0.0.0-...-7a4df5e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// How often to Poll pods, nodes and claims.
	Poll = 2 * time.Second

	// How long to try single API calls (like 'get' or 'list'). Used to prevent
	// transient failures
	// TODO: client should not apply this timeout to Watch calls. Increased from 30s until that is fixed.
	SingleCallTimeout = 5 * time.Minute
)

Variables

This section is empty.

Functions

func FilterNodes

func FilterNodes(nodeList *v1.NodeList, fn func(node *v1.Node) bool) []*v1.Node

func GetNodeConditionStatus

func GetNodeConditionStatus(node *v1.Node) v1.ConditionStatus

Get The Status of a Node

func IsNodeOrMasterReady

func IsNodeOrMasterReady(node *v1.Node) bool

Node is ready if: 1) its Ready condition is set to true 2) doesn't have NetworkUnavailable condition set to true

Types

type NodeAPIAdapter

type NodeAPIAdapter struct {
	// contains filtered or unexported fields
}

TODO: Rename to NodeValidator; probably just convert to utility functions NodeAPIAdapter used to retrieve information about Nodes in K8s TODO: should we pool the api client connection? My initial thought is no.

func NewNodeAPIAdapter

func NewNodeAPIAdapter(client kubernetes.Interface, timeout time.Duration) (*NodeAPIAdapter, error)

func (*NodeAPIAdapter) GetAllNodes

func (nodeAA *NodeAPIAdapter) GetAllNodes() (nodes *v1.NodeList, err error)

GetAllNodes is a access to get all nodes from a cluster api

func (*NodeAPIAdapter) GetReadySchedulableNodes

func (nodeAA *NodeAPIAdapter) GetReadySchedulableNodes() ([]*v1.Node, error)

GetReadySchedulableNodesOrDie addresses the common use case of getting nodes you can do work on. 1) Needs to be schedulable. 2) Needs to be ready. If EITHER 1 or 2 is not true, most tests will want to ignore the node entirely.

func (*NodeAPIAdapter) WaitForNodeToBe

func (nodeAA *NodeAPIAdapter) WaitForNodeToBe(nodeName string, conditionType v1.NodeConditionType, expected ...v1.ConditionStatus) (bool, error)

WaitForNodeToBe returns whether the names node condition state matches one of the expected values, within timeout.

func (*NodeAPIAdapter) WaitForNodeToBeNotReady

func (nodeAA *NodeAPIAdapter) WaitForNodeToBeNotReady(nodeName string) (bool, error)

WaitForNodeToBeNotReady returns whether node is not ready (i.e. the readiness condition is anything but ready, e.g false or unknown) within timeout.

func (*NodeAPIAdapter) WaitForNodeToBeReady

func (nodeAA *NodeAPIAdapter) WaitForNodeToBeReady(nodeName string) (bool, error)

WaitForNodeToBeReady returns whether node name is ready within timeout.

type ValidationCluster

type ValidationCluster struct {
	MastersReady         bool              `json:"mastersReady,omitempty"`
	MastersReadyArray    []*ValidationNode `json:"mastersReadyArray,omitempty"`
	MastersNotReadyArray []*ValidationNode `json:"mastersNotReadyArray,omitempty"`
	MastersCount         int               `json:"mastersCount,omitempty"`

	NodesReady         bool              `json:"nodesReady,omitempty"`
	NodesReadyArray    []*ValidationNode `json:"nodesReadyArray,omitempty"`
	NodesNotReadyArray []*ValidationNode `json:"nodesNotReadyArray,omitempty"`
	NodesCount         int               `json:"nodesCount,omitempty"`

	NodeList *v1.NodeList `json:"nodeList,omitempty"`

	ComponentFailures []string `json:"componentFailures,omitempty"`
	PodFailures       []string `json:"podFailures,omitempty"`
}

A cluster to validate

func ValidateCluster

func ValidateCluster(clusterName string, instanceGroupList *kops.InstanceGroupList, clusterKubernetesClient kubernetes.Interface) (*ValidationCluster, error)

ValidateCluster validate a k8s cluster with a provided instance group list

type ValidationNode

type ValidationNode struct {
	Zone     string             `json:"zone,omitempty"`
	Role     string             `json:"role,omitempty"`
	Hostname string             `json:"hostname,omitempty"`
	Status   v1.ConditionStatus `json:"status,omitempty"`
}

A K8s node to be validated

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL