Documentation ¶
Overview ¶
Package util contains all the utility methods to execute the test (APIServer interaction, wait for condition, etc.).
Index ¶
- 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, namespaceName string, ...) error
- func EnforceNamespace(ctx context.Context, cl kubernetes.Interface, clusterID, name string, ...) (*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 GetClusterID(ctx context.Context, cl kubernetes.Interface, namespace string) (string, error)
- func GetClusterLabels(index int) map[string]string
- func GetClusterSelector() *corev1.NodeSelector
- func GetControllerClient(scheme *runtime.Scheme, config *rest.Config) client.Client
- func GetEnvironmentVariableOrDie(key string) string
- func GetNamespaceLabel(enablingLiqo bool) map[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 TriggerCheckNodeConnectivity(localNodes *v1.NodeList, command string, nodePortValue int) error
Constants ¶
This section is empty.
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, namespaceName string, namespaceMappingStrategy offv1alpha1.NamespaceMappingStrategyType, podStrategy offv1alpha1.PodOffloadingStrategyType, clusterSelector *corev1.NodeSelector) error
CreateNamespaceOffloading gets the right NamespaceOffloading according to the specified strategy.
func EnforceNamespace ¶
func EnforceNamespace(ctx context.Context, cl kubernetes.Interface, clusterID, name string, namespaceLabels map[string]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 GetClusterID ¶ added in v0.3.1
GetClusterID provides the clusterID for the cluster associated with the client.
func GetClusterLabels ¶ added in v0.3.1
GetClusterLabels provides the labels which characterize the indexed cluster when exposed remotely as a virtual node.
func GetClusterSelector ¶ added in v0.3.1
func GetClusterSelector() *corev1.NodeSelector
GetClusterSelector returns a cluster selector for a NamespaceOffloading resource.
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 GetNamespaceLabel ¶ added in v0.3.1
GetNamespaceLabel sets the labels on the namespace just created. If "enablingLiqo" is set to true it adds the enabling liqo label to the namespace, so a default NamespaceOffloading resource is created for that namespace.
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().
Types ¶
This section is empty.