utils

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 22 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePldStatus

func GeneratePldStatus(
	_ string, _ string, clusters ...string,
) *clusterv1beta1.PlacementDecisionStatus

GeneratePldStatus generate pld status with given clusters

func GeneratePlrStatus

func GeneratePlrStatus(clusters ...string) *appsv1.PlacementRuleStatus

GeneratePlrStatus generate plr status with given clusters

func GetClusterLevelWithTimeout

func GetClusterLevelWithTimeout(
	clientHubDynamic dynamic.Interface,
	gvr schema.GroupVersionResource,
	name string,
	wantFound bool,
	timeout int,
) *unstructured.Unstructured

GetClusterLevelWithTimeout keeps polling to get the object for timeout seconds until wantFound is met (true for found, false for not found)

func GetMatchingEvents added in v0.12.0

func GetMatchingEvents(
	client kubernetes.Interface, namespace, objName, reasonRegex, msgRegex string, timeout int,
) []corev1.Event

func GetMetrics

func GetMetrics(metricPatterns ...string) []string

GetMetrics execs into the propagator pod and curls the metrics endpoint, filters the response with the given patterns, and returns the value(s) for the matching metric(s).

func GetWithTimeout

func GetWithTimeout(
	clientHubDynamic dynamic.Interface,
	gvr schema.GroupVersionResource,
	name, namespace string,
	wantFound bool,
	timeout int,
) *unstructured.Unstructured

GetWithTimeout keeps polling to get the object for timeout seconds until wantFound is met (true for found, false for not found)

func Kubectl

func Kubectl(args ...string)

Kubectl execute kubectl cli

func KubectlWithOutput

func KubectlWithOutput(args ...string) (string, error)

KubectlWithOutput execute kubectl cli and return output and error

func ListWithTimeout

func ListWithTimeout(
	clientHubDynamic dynamic.Interface,
	gvr schema.GroupVersionResource,
	opts metav1.ListOptions,
	size int,
	wantFound bool,
	timeout int,
) *unstructured.UnstructuredList

ListWithTimeout keeps polling to list the object for timeout seconds until wantFound is met (true for found, false for not found)

func ListWithTimeoutByNamespace

func ListWithTimeoutByNamespace(
	clientHubDynamic dynamic.Interface,
	gvr schema.GroupVersionResource,
	opts metav1.ListOptions,
	ns string,
	size int,
	wantFound bool,
	timeout int,
) *unstructured.UnstructuredList

ListWithTimeoutByNamespace keeps polling to list the object for timeout seconds until wantFound is met (true for found, false for not found)

func MetricsLines added in v0.12.0

func MetricsLines(pattern string) (string, error)

MetricsLines execs into the propagator pod and curls the metrics endpoint, and returns lines that match the pattern.

func ParseYaml

func ParseYaml(file string) *unstructured.Unstructured

ParseYaml read given yaml file and unmarshal it to &unstructured.Unstructured{}

func Pause

func Pause(s uint)

Pause sleep for given seconds

func RemovePolicyTemplateDBAnnotations added in v0.13.0

func RemovePolicyTemplateDBAnnotations(plc *unstructured.Unstructured) error

func SemanticEqual

func SemanticEqual(expected interface{}) types.GomegaMatcher

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL