Documentation
¶
Index ¶
- func AddNode(clusterName, nodeName string, extraArgs ...string)
- func ApplyDaemonSet(client *kubernetes.Clientset, namespace, manifest string) *appsv1.DaemonSet
- func ApplyDeployment(client *kubernetes.Clientset, namespace, manifest string) *appsv1.Deployment
- func BinkCmd(args ...string) *exec.Cmd
- func CleanupAllTestClusters()
- func CleanupCluster(name string)
- func CleanupKubeconfig(kubeconfigPath string)
- func CollectFailureLogs(clusterNames ...string)
- func ContainerExists(name string) bool
- func CreateCluster(name string)
- func CreatePod(client *kubernetes.Clientset, namespace string, pod *corev1.Pod, ...)
- func CreateService(client *kubernetes.Clientset, namespace string, service *corev1.Service) *corev1.Service
- func DNSContainerName(clusterName string) string
- func DeletePod(client *kubernetes.Clientset, namespace, name string)
- func ExposeAPI(clusterName, kubeconfigPath string)
- func GenerateTestClusterName() string
- func GetContainerID(name string) string
- func GetNodeCount(client *kubernetes.Clientset) int
- func GetPodNodes(client *kubernetes.Clientset, namespace, labelSelector string) []string
- func GetVolume(name string) bool
- func ImagePull(image string)
- func ImagePush(source, destination string)
- func ImageRemove(names ...string)
- func ImageTag(nameOrID, tag, repo string)
- func NewKubeClient(kubeconfigPath string) *kubernetes.Clientset
- func NodeContainerName(clusterName, nodeName string) string
- func PodExec(kubeconfigPath, namespace, podName string, command []string) (string, error)
- func PodmanCmd(args ...string) string
- func PodmanExec(container, command string) string
- func RemoveControlPlaneTaint(client *kubernetes.Clientset, nodeName string)
- func RemoveNode(clusterName, nodeName string, extraArgs ...string)
- func RequireBink()
- func RequireCommand(cmd string)
- func RequireImage(image string)
- func RunCommand(cmd *exec.Cmd, timeout ...time.Duration) *gexec.Session
- func SSHExec(clusterName, nodeName, command string) string
- func SSHExecQuiet(clusterName, nodeName, command string) (string, error)
- func SetupKubeClient(clusterName string) (*kubernetes.Clientset, string)
- func StopCluster(name string)
- func WaitForDaemonSetReady(client *kubernetes.Clientset, namespace, name string, expectedReady int32, ...)
- func WaitForNodeReady(client *kubernetes.Clientset, targetNodeName string, timeout time.Duration)
- func WaitForPodReady(client *kubernetes.Clientset, namespace, labelSelector string, ...)
- func WaitForServiceAccount(client *kubernetes.Clientset, namespace, name string, timeout time.Duration)
- type ContainerInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyDaemonSet ¶
func ApplyDaemonSet(client *kubernetes.Clientset, namespace, manifest string) *appsv1.DaemonSet
ApplyDaemonSet parses a YAML string into a DaemonSet and creates it.
func ApplyDeployment ¶
func ApplyDeployment(client *kubernetes.Clientset, namespace, manifest string) *appsv1.Deployment
ApplyDeployment parses a YAML string into a Deployment and creates it.
func CleanupAllTestClusters ¶
func CleanupAllTestClusters()
CleanupAllTestClusters removes all test clusters (containers with label bink.cluster-name=test-bink-*)
func CleanupCluster ¶
func CleanupCluster(name string)
CleanupCluster performs full cleanup of a cluster including data
func CleanupKubeconfig ¶
func CleanupKubeconfig(kubeconfigPath string)
CleanupKubeconfig removes the kubeconfig file.
func CollectFailureLogs ¶
func CollectFailureLogs(clusterNames ...string)
func ContainerExists ¶
ContainerExists checks if a container exists
func CreateCluster ¶
func CreateCluster(name string)
CreateCluster creates a cluster with the given name This is a high-level helper that expects success Uses auto-assigned ports (--api-port 0) to avoid port conflicts in tests
func CreatePod ¶
func CreatePod(client *kubernetes.Clientset, namespace string, pod *corev1.Pod, timeout time.Duration)
CreatePod creates a pod from the given spec and waits for it to be Running.
func CreateService ¶
func CreateService(client *kubernetes.Clientset, namespace string, service *corev1.Service) *corev1.Service
CreateService creates a Service from a Go struct.
func DNSContainerName ¶
DNSContainerName returns the DNS container name for a cluster.
func DeletePod ¶
func DeletePod(client *kubernetes.Clientset, namespace, name string)
DeletePod deletes a pod. Does not fail if already gone.
func ExposeAPI ¶
func ExposeAPI(clusterName, kubeconfigPath string)
ExposeAPI exposes the API server and generates kubeconfig
func GenerateTestClusterName ¶
func GenerateTestClusterName() string
GenerateTestClusterName creates a unique cluster name for testing
func GetContainerID ¶
GetContainerID returns the ID of a container by name
func GetNodeCount ¶
func GetNodeCount(client *kubernetes.Clientset) int
GetNodeCount returns the number of Kubernetes nodes in the cluster. Returns -1 on error so callers using Eventually can retry.
func GetPodNodes ¶
func GetPodNodes(client *kubernetes.Clientset, namespace, labelSelector string) []string
GetPodNodes returns a list of node names where pods with the given label are running.
func ImagePush ¶
func ImagePush(source, destination string)
ImagePush pushes an image to a registry with TLS verification disabled.
func NewKubeClient ¶
func NewKubeClient(kubeconfigPath string) *kubernetes.Clientset
NewKubeClient creates a Kubernetes clientset from a kubeconfig file.
func NodeContainerName ¶
NodeContainerName returns the container name for a node in a cluster.
func PodmanCmd ¶
PodmanCmd executes a podman command and returns output Note: This is deprecated - prefer using podman.Client directly in tests
func PodmanExec ¶
PodmanExec executes a command inside a container
func RemoveControlPlaneTaint ¶
func RemoveControlPlaneTaint(client *kubernetes.Clientset, nodeName string)
RemoveControlPlaneTaint removes the NoSchedule taint from a control-plane node so that workloads can be scheduled on single-node clusters.
func RemoveNode ¶
RemoveNode removes a node from the cluster
func RequireBink ¶
func RequireBink()
RequireBink verifies that the bink binary exists in the project root
func RequireCommand ¶
func RequireCommand(cmd string)
RequireCommand verifies that a command exists on the system
func RequireImage ¶
func RequireImage(image string)
RequireImage verifies that a container image exists
func RunCommand ¶
RunCommand executes a command and waits for it to complete Returns the gexec session for assertions
func SSHExecQuiet ¶
SSHExecQuiet executes a command but doesn't fail on errors Returns output and error
func SetupKubeClient ¶
func SetupKubeClient(clusterName string) (*kubernetes.Clientset, string)
SetupKubeClient exposes the API for a cluster and returns a clientset and the kubeconfig path.
func WaitForDaemonSetReady ¶
func WaitForDaemonSetReady(client *kubernetes.Clientset, namespace, name string, expectedReady int32, timeout time.Duration)
WaitForDaemonSetReady polls until the DaemonSet has the expected number of ready pods.
func WaitForNodeReady ¶
func WaitForNodeReady(client *kubernetes.Clientset, targetNodeName string, timeout time.Duration)
WaitForNodeReady polls until the target node shows Ready status.
func WaitForPodReady ¶
func WaitForPodReady(client *kubernetes.Clientset, namespace, labelSelector string, timeout time.Duration)
WaitForPodReady polls until a pod matching the label selector is Running with all containers ready.
func WaitForServiceAccount ¶
func WaitForServiceAccount(client *kubernetes.Clientset, namespace, name string, timeout time.Duration)
WaitForServiceAccount polls until the named service account exists in the namespace.
Types ¶
type ContainerInfo ¶
type ContainerInfo struct {
ID string
Name string
State string
Ports []string
Labels map[string]string
}
ContainerInfo holds basic container information
func GetContainer ¶
func GetContainer(name string) *ContainerInfo
GetContainer returns information about a container Returns nil if container doesn't exist For test usage, name should be the full container name (e.g., "k8s-test-bink-abc123-node1")