const awsMasterIP … const PodListTimeout … const PodStartTimeout … const PodStartShortTimeout … const PodDeleteTimeout … const PodGetTimeout … const PodEventTimeout … const ServiceStartTimeout … const Poll … const PollShortTimeout … const ServiceAccountProvisionTimeout … const SingleCallTimeout … const NodeReadyInitialTimeout … const PodReadyBeforeTimeout … const ClaimProvisionShortTimeout … const ClaimProvisionTimeout … const RestartNodeReadyAgainTimeout … const RestartPodReadyAgainTimeout … const SnapshotCreateTimeout … const SnapshotDeleteTimeout … const ControlPlaneLabel … var ProvidersWithSSH … var RunID … type CreateTestingNSFn … // APIAddress returns a address of an instance. func APIAddress() string { … } // ProviderIs returns true if the provider is included is the providers. Otherwise false. func ProviderIs(providers ...string) bool { … } // MasterOSDistroIs returns true if the master OS distro is included in the supportedMasterOsDistros. Otherwise false. func MasterOSDistroIs(supportedMasterOsDistros ...string) bool { … } // NodeOSDistroIs returns true if the node OS distro is included in the supportedNodeOsDistros. Otherwise false. func NodeOSDistroIs(supportedNodeOsDistros ...string) bool { … } // NodeOSArchIs returns true if the node OS arch is included in the supportedNodeOsArchs. Otherwise false. func NodeOSArchIs(supportedNodeOsArchs ...string) bool { … } // DeleteNamespaces deletes all namespaces that match the given delete and skip filters. // Filter is by simple strings.Contains; first skip filter, then delete filter. // Returns the list of deleted namespaces or an error. func DeleteNamespaces(ctx context.Context, c clientset.Interface, deleteFilter, skipFilter []string) ([]string, error) { … } // WaitForNamespacesDeleted waits for the namespaces to be deleted. func WaitForNamespacesDeleted(ctx context.Context, c clientset.Interface, namespaces []string, timeout time.Duration) error { … } func waitForConfigMapInNamespace(ctx context.Context, c clientset.Interface, ns, name string, timeout time.Duration) error { … } func waitForServiceAccountInNamespace(ctx context.Context, c clientset.Interface, ns, serviceAccountName string, timeout time.Duration) error { … } // WaitForDefaultServiceAccountInNamespace waits for the default service account to be provisioned // the default service account is what is associated with pods when they do not specify a service account // as a result, pods are not able to be provisioned in a namespace until the service account is provisioned func WaitForDefaultServiceAccountInNamespace(ctx context.Context, c clientset.Interface, namespace string) error { … } // WaitForKubeRootCAInNamespace waits for the configmap kube-root-ca.crt containing the service account // CA trust bundle to be provisioned in the specified namespace so that pods do not have to retry mounting // the config map (which creates noise that hides other issues in the Kubelet). func WaitForKubeRootCAInNamespace(ctx context.Context, c clientset.Interface, namespace string) error { … } // CreateTestingNS should be used by every test, note that we append a common prefix to the provided test name. // Please see NewFramework instead of using this directly. func CreateTestingNS(ctx context.Context, baseName string, c clientset.Interface, labels map[string]string) (*v1.Namespace, error) { … } // CheckTestingNSDeletedExcept checks whether all e2e based existing namespaces are in the Terminating state // and waits until they are finally deleted. It ignores namespace skip. func CheckTestingNSDeletedExcept(ctx context.Context, c clientset.Interface, skip string) error { … } // WaitForServiceEndpointsNum waits until the amount of endpoints that implement service to expectNum. // Some components use EndpointSlices other Endpoints, we must verify that both objects meet the requirements. func WaitForServiceEndpointsNum(ctx context.Context, c clientset.Interface, namespace, serviceName string, expectNum int, interval, timeout time.Duration) error { … } func countEndpointsNum(e *v1.Endpoints) int { … } // isIPv6Endpoint returns true if the Endpoint uses IPv6 addresses func isIPv6Endpoint(e *v1.Endpoints) bool { … } func countEndpointsSlicesNum(epList *discoveryv1.EndpointSliceList, addressType discoveryv1.AddressType) int { … } // restclientConfig returns a config holds the information needed to build connection to kubernetes clusters. func restclientConfig(kubeContext string) (*clientcmdapi.Config, error) { … } type ClientConfigGetter … // LoadConfig returns a config for a rest client with the UserAgent set to include the current test name. func LoadConfig() (config *restclient.Config, err error) { … } // LoadClientset returns clientset for connecting to kubernetes clusters. func LoadClientset() (*clientset.Clientset, error) { … } // RandomSuffix provides a random sequence to append to pods,services,rcs. func RandomSuffix() string { … } // StartCmdAndStreamOutput returns stdout and stderr after starting the given cmd. func StartCmdAndStreamOutput(cmd *exec.Cmd) (stdout, stderr io.ReadCloser, err error) { … } // TryKill is rough equivalent of ctrl+c for cleaning up processes. Intended to be run in defer. func TryKill(cmd *exec.Cmd) { … } // EnsureLoadBalancerResourcesDeleted ensures that cloud load balancer resources that were created // are actually cleaned up. Currently only implemented for GCE/GKE. func EnsureLoadBalancerResourcesDeleted(ctx context.Context, ip, portRange string) error { … } // CoreDump SSHs to the master and all nodes and dumps their logs into dir. // It shells out to cluster/log-dump/log-dump.sh to accomplish this. func CoreDump(dir string) { … } // parseSystemdServices converts services separator from comma to space. func parseSystemdServices(services string) string { … } // RunCmd runs cmd using args and returns its stdout and stderr. It also outputs // cmd's stdout and stderr to their respective OS streams. func RunCmd(command string, args ...string) (string, string, error) { … } // RunCmdEnv runs cmd with the provided environment and args and // returns its stdout and stderr. It also outputs cmd's stdout and // stderr to their respective OS streams. func RunCmdEnv(env []string, command string, args ...string) (string, string, error) { … } // GetNodeExternalIPs returns a list of external ip address(es) if any for a node func GetNodeExternalIPs(node *v1.Node) (ips []string) { … } // getControlPlaneAddresses returns the externalIP, internalIP and hostname fields of control plane nodes. // If any of these is unavailable, empty slices are returned. func getControlPlaneAddresses(ctx context.Context, c clientset.Interface) ([]string, []string, []string) { … } // GetControlPlaneNodes returns a list of control plane nodes func GetControlPlaneNodes(ctx context.Context, c clientset.Interface) *v1.NodeList { … } // GetControlPlaneAddresses returns all IP addresses on which the kubelet can reach the control plane. // It may return internal and external IPs, even if we expect for // e.g. internal IPs to be used (issue #56787), so that we can be // sure to block the control plane fully during tests. func GetControlPlaneAddresses(ctx context.Context, c clientset.Interface) []string { … } // PrettyPrintJSON converts metrics to JSON format. func PrettyPrintJSON(metrics interface{ … } // WatchEventSequenceVerifier ... // manages a watch for a given resource, ensures that events take place in a given order, retries the test on failure // // ctx cancellation signal across API boundaries, e.g: context from Ginkgo // dc sets up a client to the API // resourceType specify the type of resource // namespace select a namespace // resourceName the name of the given resource // listOptions options used to find the resource, recommended to use listOptions.labelSelector // expectedWatchEvents array of events which are expected to occur // scenario the test itself // retryCleanup a function to run which ensures that there are no dangling resources upon test failure // // this tooling relies on the test to return the events as they occur // the entire scenario must be run to ensure that the desired watch events arrive in order (allowing for interweaving of watch events) // // if an expected watch event is missing we elect to clean up and run the entire scenario again // // we try the scenario three times to allow the sequencing to fail a couple of times func WatchEventSequenceVerifier(ctx context.Context, dc dynamic.Interface, resourceType schema.GroupVersionResource, namespace string, resourceName string, listOptions metav1.ListOptions, expectedWatchEvents []watch.Event, scenario func(*watchtools.RetryWatcher) []watch.Event, retryCleanup func() error) { … }