Documentation ¶
Overview ¶
Package k8s provides common functionalities for interacting with a Kubernetes cluster in the context of infrastructure testing.
Index ¶
- func AreAllNodesReady(t *testing.T) bool
- func AreAllNodesReadyE(t *testing.T) (bool, error)
- func DeleteConfigContextE(t *testing.T, contextName string) error
- func DeleteConfigContextWithPathE(t *testing.T, kubeConfigPath string, contextName string) error
- func GetKubeConfigPathE(t *testing.T) (string, error)
- func GetKubernetesClientE(t *testing.T) (*kubernetes.Clientset, error)
- func GetNodes(t *testing.T) []corev1.Node
- func GetNodesE(t *testing.T) ([]corev1.Node, error)
- func GetReadyNodes(t *testing.T) []corev1.Node
- func GetReadyNodesE(t *testing.T) ([]corev1.Node, error)
- func IsNodeReady(node corev1.Node) bool
- func LoadConfigFromPath(path string) clientcmd.ClientConfig
- func RemoveOrphanedClusterAndAuthInfoConfig(config *api.Config)
- func WaitUntilAllNodesReady(t *testing.T, retries int, sleepBetweenRetries time.Duration)
- func WaitUntilAllNodesReadyE(t *testing.T, retries int, sleepBetweenRetries time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreAllNodesReady ¶
AreAllNodesReady checks if all nodes are ready in the Kubernetes cluster targeted by the current config context
func AreAllNodesReadyE ¶
AreAllNodesReadyE checks if all nodes are ready in the Kubernetes cluster targeted by the current config context. If false, returns an error indicating the reason.
func DeleteConfigContextE ¶
DeleteConfigContextE will remove the context specified at the provided name, and remove any clusters and authinfos that are orphaned as a result of it. The config path is either specified in the environment variable KUBECONFIG or at the user's home directory under `.kube/config`.
func DeleteConfigContextWithPathE ¶
DeleteConfigContextWithPathE will remove the context specified at the provided name, and remove any clusters and authinfos that are orphaned as a result of it.
func GetKubeConfigPathE ¶
GetKubeConfigPathE determines which file path to use as the kubectl config path
func GetKubernetesClientE ¶
func GetKubernetesClientE(t *testing.T) (*kubernetes.Clientset, error)
GetKubernetesClientE returns a Kubernetes API client that can be used to make requests.
func GetNodes ¶
GetNodes queries Kubernetes for information about the worker nodes registered to the cluster. If anything goes wrong, the function will automatically fail the test.
func GetNodesE ¶
GetNodesE queries Kubernetes for information about the worker nodes registered to the cluster.
func GetReadyNodes ¶
GetReadyNodes queries Kubernetes for information about the worker nodes registered to the cluster and only returns those that are in the ready state. If anything goes wrong, the function will automatically fail the test.
func GetReadyNodesE ¶
GetReadyNodesE queries Kubernetes for information about the worker nodes registered to the cluster and only returns those that are in the ready state.
func IsNodeReady ¶
IsNodeReady takes a Kubernetes Node information object and checks if the Node is in the ready state.
func LoadConfigFromPath ¶
func LoadConfigFromPath(path string) clientcmd.ClientConfig
LoadConfigFromPath will load a ClientConfig object from a file path that points to a location on disk containing a kubectl config.
func RemoveOrphanedClusterAndAuthInfoConfig ¶
RemoveOrphanedClusterAndAuthInfoConfig will remove all configurations related to clusters and users that have no contexts associated with it
func WaitUntilAllNodesReady ¶
WaitUntilAllNodesReady continuously polls the Kubernetes cluster until all nodes in the cluster reach the ready state, or runs out of retries. Will fail the test immediately if it times out.
Types ¶
This section is empty.