Documentation ¶
Overview ¶
Package util contains all the utility methods to execute the test (APIServer interaction, wait for condition, etc.).
Index ¶
- Constants
- func ArePodsUp(ctx context.Context, clientset kubernetes.Interface, namespace string) (ready, notReady []string, retErr error)
- func CheckIfTestIsSkipped(t *testing.T, clustersRequired int, testName string)
- func CheckVirtualNodes(ctx context.Context, homeClusterClient kubernetes.Interface, clusterNumber int) (ready bool)
- func CreateNamespaceOffloading(ctx context.Context, cl client.Client, namespace string, ...) error
- func DescribeTableArgs(itBody interface{}, entries ...ginkgo.TableEntry) []interface{}
- func EnforceNamespace(ctx context.Context, cl kubernetes.Interface, ...) (*corev1.Namespace, error)
- func EnsureNamespaceDeletion(ctx context.Context, cl kubernetes.Interface, labelSelector map[string]string) error
- func ExecCmd(config *rest.Config, client kubernetes.Interface, ...) (stdOut, stdErr string, retErr error)
- func ExecLiqoctl(kubeconfig string, args []string, output io.Writer) error
- func GetClusterLabels(index int) map[string]string
- func GetControllerClient(scheme *runtime.Scheme, config *rest.Config) client.Client
- func GetEnvironmentVariableOrDie(key string) string
- func GetNodes(ctx context.Context, client kubernetes.Interface, ...) (*v1.NodeList, error)
- func GetRestConfigOrDie(kubeconfig string) *rest.Config
- func IsPodUp(ctx context.Context, client kubernetes.Interface, namespace, podName string, ...) bool
- func OffloadNamespace(kubeconfig, namespace string, args ...string) error
- func ResourceRequirements() corev1.ResourceRequirements
- func TriggerCheckNodeConnectivity(localNodes *v1.NodeList, command string, nodePortValue int) error
- func UnoffloadNamespace(kubeconfig, namespace string) error
- type PodType
Constants ¶
const ( // PodLocal -> the pod is local. PodLocal = "local" // PodRemote -> the pod is remote. PodRemote = "remote" )
Variables ¶
This section is empty.
Functions ¶
func ArePodsUp ¶
func ArePodsUp(ctx context.Context, clientset kubernetes.Interface, namespace string) (ready, notReady []string, retErr error)
ArePodsUp check if all the pods of a specific namespace are ready. It returns a list of ready pods, a list of unready pods and occurred errors.
func CheckIfTestIsSkipped ¶ added in v0.3.1
CheckIfTestIsSkipped checks if the number of clusters required by the test is less than the number of cluster really present.
func CheckVirtualNodes ¶
func CheckVirtualNodes(ctx context.Context, homeClusterClient kubernetes.Interface, clusterNumber int) (ready bool)
CheckVirtualNodes checks if the Liqo virtual nodes of cluster C.
func CreateNamespaceOffloading ¶ added in v0.3.1
func CreateNamespaceOffloading(ctx context.Context, cl client.Client, namespace string, nms offloadingv1alpha1.NamespaceMappingStrategyType, pof offloadingv1alpha1.PodOffloadingStrategyType) error
CreateNamespaceOffloading creates a new NamespaceOffloading resource, with the given parameters.
func DescribeTableArgs ¶ added in v0.6.0
func DescribeTableArgs(itBody interface{}, entries ...ginkgo.TableEntry) []interface{}
DescribeTableArgs is an helper function to pack the arguments for DescribeTable, when entries are generated by an external function.
func EnforceNamespace ¶
func EnforceNamespace(ctx context.Context, cl kubernetes.Interface, cluster discoveryv1alpha1.ClusterIdentity, name string) (*corev1.Namespace, error)
EnforceNamespace creates and returns a namespace. If it already exists, it just returns the namespace.
func EnsureNamespaceDeletion ¶ added in v0.3.1
func EnsureNamespaceDeletion(ctx context.Context, cl kubernetes.Interface, labelSelector map[string]string) error
EnsureNamespaceDeletion wrap the deletion of a namespace.
func ExecCmd ¶
func ExecCmd(config *rest.Config, client kubernetes.Interface, podName, namespace, command string) (stdOut, stdErr string, retErr error)
ExecCmd executes a command inside a pod.
func ExecLiqoctl ¶ added in v0.5.0
ExecLiqoctl runs a liqoctl command targeting the cluster specified by the given kubeconfig.
func GetClusterLabels ¶ added in v0.3.1
GetClusterLabels provides the labels which characterize the indexed cluster when exposed remotely as a virtual node.
func GetControllerClient ¶ added in v0.3.1
GetControllerClient creates a new controller runtime client for the given config. If there is an error calls klog.Fatal().
func GetEnvironmentVariableOrDie ¶ added in v0.3.1
GetEnvironmentVariableOrDie retrieves the value of the environment variable named by the key. If the variable is not present calls klog.Fatal().
func GetNodes ¶
func GetNodes(ctx context.Context, client kubernetes.Interface, clusterID, labelSelector string) (*v1.NodeList, error)
GetNodes returns the list of nodes of the cluster matching the given labels.
func GetRestConfigOrDie ¶ added in v0.3.1
GetRestConfigOrDie retrieves the rest.Config from the kubeconfig variable. If there is an error calls klog.Fatal().
func IsPodUp ¶
func IsPodUp(ctx context.Context, client kubernetes.Interface, namespace, podName string, podType PodType) bool
IsPodUp waits for a specific namespace/podName to be ready. It returns true if the pod within the timeout, false otherwise.
func OffloadNamespace ¶ added in v0.5.0
OffloadNamespace offloads a namespace using liqoctl.
func ResourceRequirements ¶ added in v0.6.0
func ResourceRequirements() corev1.ResourceRequirements
ResourceRequirements returns the default resource requirements for a pod during tests.
func TriggerCheckNodeConnectivity ¶
TriggerCheckNodeConnectivity checks nodePort service connectivity, executing a command for every node in the target cluster.
func UnoffloadNamespace ¶ added in v0.5.0
UnoffloadNamespace unoffloads a namespace using liqoctl.