util

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GotNot means that the attempt to list Deployments failed
	GotNoList int = -1
	// GotNotExactly1 means that the number of Deployments is more or less than 1
	GotNotExactly1 int = -2
	// GotNoReplicas means that the Deployment does not specify a number of replicas.
	GotNoReplicas int = -3
)

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(ctx context.Context)

func CleanupWDS

func CleanupWDS(ctx context.Context, wds *kubernetes.Clientset, ksWds *ksClient.Clientset, ns string)

CleanupWDS: removes all deployments and services from ns and all bindingPolicies from cluster

func CreateBindingPolicy

func CreateBindingPolicy(ctx context.Context, wds *ksClient.Clientset, name string,
	clusterSelector []metav1.LabelSelector, testAndStatusCollection []ksapi.DownsyncPolicyClause,
	mutators ...func(*ksapi.BindingPolicy) error)

func CreateCustomTransform added in v0.22.0

func CreateCustomTransform(ctx context.Context, wds *ksClient.Clientset, name, apiGroup, resource string, remove ...string)

func CreateDeployment

func CreateDeployment(ctx context.Context, wds *kubernetes.Clientset, ns string, name string, labels map[string]string)

func CreateDynamicClient

func CreateDynamicClient(config *rest.Config) *dynamic.DynamicClient

func CreateJob added in v0.21.1

func CreateJob(ctx context.Context, wds *kubernetes.Clientset, ns string, name string, appName string)

func CreateKSClient

func CreateKSClient(config *rest.Config) *ksClient.Clientset

func CreateKubeClient

func CreateKubeClient(config *rest.Config) *kubernetes.Clientset

func CreateNS

func CreateNS(ctx context.Context, client *kubernetes.Clientset, name string)

func CreateOcmWorkClient

func CreateOcmWorkClient(config *rest.Config) *ocmWorkClient.Clientset

func CreateService

func CreateService(ctx context.Context, wds *kubernetes.Clientset, ns string, name string, appName string)

func CreateStatusCollector added in v0.24.0

func CreateStatusCollector(ctx context.Context, wds *ksClient.Clientset, name string, spec ksapi.StatusCollectorSpec)

func Delete1By1 added in v0.21.2

func Delete1By1[ObjectListType metav1.ListInterface](ctx context.Context, kind string, client ResourceInterface[ObjectListType], listNames func(ObjectListType) []string)

func DeleteAll added in v0.21.2

func DeleteAll[ObjectListType metav1.ListInterface](ctx context.Context, client ResourceCollectionInterface[ObjectListType], listNames func(ObjectListType) []string)

func DeleteBindingPolicy

func DeleteBindingPolicy(ctx context.Context, wds *ksClient.Clientset, name string)

func DeleteDeployment

func DeleteDeployment(ctx context.Context, wds *kubernetes.Clientset, ns string, name string)

func DeletePods added in v0.21.2

func DeletePods(ctx context.Context, client *kubernetes.Clientset, ns string, namePrefix string)

func DeleteWECDeployments

func DeleteWECDeployments(ctx context.Context, wec *kubernetes.Clientset, ns string)

func Expect1PodOfEach added in v0.21.2

func Expect1PodOfEach(ctx context.Context, client *kubernetes.Clientset, ns string, namePrefixes ...string)

func GetBindingTime added in v0.24.0

func GetBindingTime(ctx context.Context, clientset *ksClient.Clientset, name string) time.Time

func GetConfig

func GetConfig(context string) *rest.Config

func GetDeployment added in v0.26.0

func GetDeployment(ctx context.Context, wec *kubernetes.Clientset, ns, name string) *appsv1.Deployment

func GetDeploymentTime added in v0.24.0

func GetDeploymentTime(ctx context.Context, clientset *kubernetes.Clientset, ns string, name string) time.Time

func GetManifestworkTime added in v0.24.0

func GetManifestworkTime(ctx context.Context, ocmWorkImbs *ocmWorkClient.Clientset, ns string, name string) time.Time

func GetNumDeploymentReplicas added in v0.25.0

func GetNumDeploymentReplicas(ctx context.Context, wec *kubernetes.Clientset, ns string) int

GetNumDeploymentReplicas returns the number of replicas of the one and only Deployment in the given namespace, or one of the values above that explain what went wrong.

func ReadContainerArgsInDeployment added in v0.24.0

func ReadContainerArgsInDeployment(ctx context.Context, client *kubernetes.Clientset, ns string, deploymentName string, containerName string) []string

func ScaleDeployment added in v0.24.0

func ScaleDeployment(ctx context.Context, client *kubernetes.Clientset, ns string, name string, target int32)

func SetupKubestellar

func SetupKubestellar(ctx context.Context, releasedFlag bool, otherFlags ...string)

func ValidateBinding added in v0.24.0

func ValidateBinding(ctx context.Context, wds ksClient.Interface, name string, validate func(*ksapi.Binding) bool)

func ValidateNumDeploymentReplicas

func ValidateNumDeploymentReplicas(ctx context.Context, wec *kubernetes.Clientset, ns string, numReplicas int)

func ValidateNumDeployments

func ValidateNumDeployments(ctx context.Context, where string, wec *kubernetes.Clientset, ns string, num int, problemFuncs ...func(*appsv1.Deployment) string)

ValidateNumDeployments waits a limited amount of time for the number of Deployment objects to equal the given count and all the problemFuncs to return the empty string for every Deployment.

func ValidateNumJobs added in v0.21.1

func ValidateNumJobs(ctx context.Context, wec *kubernetes.Clientset, ns string, num int)

func ValidateNumManifestworks

func ValidateNumManifestworks(ctx context.Context, ocmWorkIts *ocmWorkClient.Clientset, ns string, num int)

func ValidateNumServices

func ValidateNumServices(ctx context.Context, wec *kubernetes.Clientset, ns string, num int)

func ValidateSingletonStatus

func ValidateSingletonStatus(ctx context.Context, wds *kubernetes.Clientset, ns string, name string)

func ValidateSingletonStatusNonZeroValue added in v0.24.0

func ValidateSingletonStatusNonZeroValue(ctx context.Context, wds *kubernetes.Clientset, ns string, name string)

func ValidateSingletonStatusZeroValue added in v0.22.0

func ValidateSingletonStatusZeroValue(ctx context.Context, wds *kubernetes.Clientset, ns string, name string)

func WaitForCombinedStatus added in v0.25.0

func WaitForCombinedStatus(ctx context.Context, ksClient *ksClient.Clientset, kubeClient *kubernetes.Clientset, ns, objectName, policyName string, validate func(*ksapi.CombinedStatus) error)

WaitForCombinedStatus is a helper func which expects the workload object to be a Deployment. CombinedStatus name is the concatenation of: - the UID of the workload object - the string "." - the UID of the BindingPolicy object.

func WaitForDepolymentAvailability added in v0.24.0

func WaitForDepolymentAvailability(ctx context.Context, client kubernetes.Interface, ns string, name string)

Types

type ResourceCollectionInterface added in v0.21.2

type ResourceCollectionInterface[ObjectListType metav1.ListInterface] interface {
	DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error
	List(ctx context.Context, opts metav1.ListOptions) (ObjectListType, error)
}

type ResourceInterface added in v0.21.2

type ResourceInterface[ObjectListType metav1.ListInterface] interface {
	Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error
	List(ctx context.Context, opts metav1.ListOptions) (ObjectListType, error)
}

Jump to

Keyboard shortcuts

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