const poll … const singleCallTimeout … const sshPort … var unreachableTaintTemplate … var notReadyTaintTemplate … var updateTaintBackOff … type PodNode … // FirstAddress returns the first address of the given type of each node. func FirstAddress(nodelist *v1.NodeList, addrType v1.NodeAddressType) string { … } func isNodeConditionSetAsExpected(node *v1.Node, conditionType v1.NodeConditionType, wantTrue, silent bool) bool { … } // IsConditionSetAsExpected returns a wantTrue value if the node has a match to the conditionType, otherwise returns an opposite value of the wantTrue with detailed logging. func IsConditionSetAsExpected(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool { … } // IsConditionSetAsExpectedSilent returns a wantTrue value if the node has a match to the conditionType, otherwise returns an opposite value of the wantTrue. func IsConditionSetAsExpectedSilent(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool { … } // isConditionUnset returns true if conditions of the given node do not have a match to the given conditionType, otherwise false. func isConditionUnset(node *v1.Node, conditionType v1.NodeConditionType) bool { … } // Filter filters nodes in NodeList in place, removing nodes that do not // satisfy the given condition func Filter(nodeList *v1.NodeList, fn func(node v1.Node) bool) { … } // TotalRegistered returns number of schedulable Nodes. func TotalRegistered(ctx context.Context, c clientset.Interface) (int, error) { … } // TotalReady returns number of ready schedulable Nodes. func TotalReady(ctx context.Context, c clientset.Interface) (int, error) { … } // GetSSHExternalIP returns node external IP concatenated with port 22 for ssh // e.g. 1.2.3.4:22 func GetSSHExternalIP(node *v1.Node) (string, error) { … } // GetSSHInternalIP returns node internal IP concatenated with port 22 for ssh func GetSSHInternalIP(node *v1.Node) (string, error) { … } // FirstAddressByTypeAndFamily returns the first address that matches the given type and family of the list of nodes func FirstAddressByTypeAndFamily(nodelist *v1.NodeList, addrType v1.NodeAddressType, family v1.IPFamily) string { … } // GetAddressesByTypeAndFamily returns a list of addresses of the given addressType for the given node // and filtered by IPFamily func GetAddressesByTypeAndFamily(node *v1.Node, addressType v1.NodeAddressType, family v1.IPFamily) (ips []string) { … } // GetAddresses returns a list of addresses of the given addressType for the given node func GetAddresses(node *v1.Node, addressType v1.NodeAddressType) (ips []string) { … } // CollectAddresses returns a list of addresses of the given addressType for the given list of nodes func CollectAddresses(nodes *v1.NodeList, addressType v1.NodeAddressType) []string { … } // PickIP picks one public node IP func PickIP(ctx context.Context, c clientset.Interface) (string, error) { … } // GetPublicIps returns a public IP list of nodes. func GetPublicIps(ctx context.Context, c clientset.Interface) ([]string, error) { … } // GetReadySchedulableNodes 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. // If there are no nodes that are both ready and schedulable, this will return an error. func GetReadySchedulableNodes(ctx context.Context, c clientset.Interface) (nodes *v1.NodeList, err error) { … } // GetBoundedReadySchedulableNodes is like GetReadySchedulableNodes except that it returns // at most maxNodes nodes. Use this to keep your test case from blowing up when run on a // large cluster. func GetBoundedReadySchedulableNodes(ctx context.Context, c clientset.Interface, maxNodes int) (nodes *v1.NodeList, err error) { … } // GetRandomReadySchedulableNode gets a single randomly-selected node which is available for // running pods on. If there are no available nodes it will return an error. func GetRandomReadySchedulableNode(ctx context.Context, c clientset.Interface) (*v1.Node, error) { … } // GetReadyNodesIncludingTainted returns all ready nodes, even those which are tainted. // There are cases when we care about tainted nodes // E.g. in tests related to nodes with gpu we care about nodes despite // presence of nvidia.com/gpu=present:NoSchedule taint func GetReadyNodesIncludingTainted(ctx context.Context, c clientset.Interface) (nodes *v1.NodeList, err error) { … } // isNodeUntainted tests whether a fake pod can be scheduled on "node", given its current taints. // TODO: need to discuss wether to return bool and error type func isNodeUntainted(node *v1.Node) bool { … } // isNodeUntaintedWithNonblocking tests whether a fake pod can be scheduled on "node" // but allows for taints in the list of non-blocking taints. func isNodeUntaintedWithNonblocking(node *v1.Node, nonblockingTaints string) bool { … } func toleratesTaintsWithNoScheduleNoExecuteEffects(taints []v1.Taint, tolerations []v1.Toleration) bool { … } // IsNodeSchedulable returns true if: // 1) doesn't have "unschedulable" field set // 2) it also returns true from IsNodeReady func IsNodeSchedulable(node *v1.Node) bool { … } // IsNodeReady returns true if: // 1) it's Ready condition is set to true // 2) doesn't have NetworkUnavailable condition set to true func IsNodeReady(node *v1.Node) bool { … } // isNodeSchedulableWithoutTaints returns true if: // 1) doesn't have "unschedulable" field set // 2) it also returns true from IsNodeReady // 3) it also returns true from isNodeUntainted func isNodeSchedulableWithoutTaints(node *v1.Node) bool { … } // hasNonblockingTaint returns true if the node contains at least // one taint with a key matching the regexp. func hasNonblockingTaint(node *v1.Node, nonblockingTaints string) bool { … } // GetNodeHeartbeatTime returns the timestamp of the last status update of the node. func GetNodeHeartbeatTime(node *v1.Node) metav1.Time { … } // PodNodePairs return podNode pairs for all pods in a namespace func PodNodePairs(ctx context.Context, c clientset.Interface, ns string) ([]PodNode, error) { … } // GetClusterZones returns the values of zone label collected from all nodes. func GetClusterZones(ctx context.Context, c clientset.Interface) (sets.String, error) { … } // GetSchedulableClusterZones returns the values of zone label collected from all nodes which are schedulable. func GetSchedulableClusterZones(ctx context.Context, c clientset.Interface) (sets.Set[string], error) { … } // CreatePodsPerNodeForSimpleApp creates pods w/ labels. Useful for tests which make a bunch of pods w/o any networking. func CreatePodsPerNodeForSimpleApp(ctx context.Context, c clientset.Interface, namespace, appName string, podSpec func(n v1.Node) v1.PodSpec, maxCount int) map[string]string { … } // RemoveTaintsOffNode removes a list of taints from the given node // It is simply a helper wrapper for RemoveTaintOffNode func RemoveTaintsOffNode(ctx context.Context, c clientset.Interface, nodeName string, taints []v1.Taint) { … } // RemoveTaintOffNode removes the given taint from the given node. func RemoveTaintOffNode(ctx context.Context, c clientset.Interface, nodeName string, taint v1.Taint) { … } // AddOrUpdateTaintOnNode adds the given taint to the given node or updates taint. func AddOrUpdateTaintOnNode(ctx context.Context, c clientset.Interface, nodeName string, taint v1.Taint) { … } // addOrUpdateTaintOnNode add taints to the node. If taint was added into node, it'll issue API calls // to update nodes; otherwise, no API calls. Return error if any. // copied from pkg/controller/controller_utils.go AddOrUpdateTaintOnNode() func addOrUpdateTaintOnNode(ctx context.Context, c clientset.Interface, nodeName string, taints ...*v1.Taint) error { … } // addOrUpdateTaint tries to add a taint to annotations list. Returns a new copy of updated Node and true if something was updated // false otherwise. // copied from pkg/util/taints/taints.go AddOrUpdateTaint() func addOrUpdateTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error) { … } var semantic … // removeNodeTaint is for cleaning up taints temporarily added to node, // won't fail if target taint doesn't exist or has been removed. // If passed a node it'll check if there's anything to be done, if taint is not present it won't issue // any API calls. func removeNodeTaint(ctx context.Context, c clientset.Interface, nodeName string, node *v1.Node, taints ...*v1.Taint) error { … } // patchNodeTaints patches node's taints. func patchNodeTaints(ctx context.Context, c clientset.Interface, nodeName string, oldNode *v1.Node, newNode *v1.Node) error { … } // removeTaint tries to remove a taint from annotations list. Returns a new copy of updated Node and true if something was updated // false otherwise. func removeTaint(node *v1.Node, taint *v1.Taint) (*v1.Node, bool, error) { … } // deleteTaint removes all the taints that have the same key and effect to given taintToDelete. func deleteTaint(taints []v1.Taint, taintToDelete *v1.Taint) ([]v1.Taint, bool) { … } func verifyThatTaintIsGone(ctx context.Context, c clientset.Interface, nodeName string, taint *v1.Taint) { … }