utils

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TopologySingle is a single cluster running both controller groups.
	TopologySingle = "single"
	// TopologyConfigWorkload is a config and a workload cluster, each running only its controller group.
	TopologyConfigWorkload = "config-workload"
)

Variables

This section is empty.

Functions

func ConnectWithKubeconfig

func ConnectWithKubeconfig(
	t *testing.T,
	ctx context.Context,
	configClient ctrlruntimeclient.Client,
	namespace string,
	kubeconfigName string,
	cluster logicalcluster.Path,
) ctrlruntimeclient.Client

func ConnectWithRootShardProxy added in v0.2.0

func ConnectWithRootShardProxy(
	t *testing.T,
	ctx context.Context,
	configClient ctrlruntimeclient.Client,
	rootShard *operatorv1alpha1.RootShard,
	cluster logicalcluster.Path,
) ctrlruntimeclient.Client

func CreateSelfDestructingNamespace

func CreateSelfDestructingNamespace(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client, name string) *corev1.Namespace

func DeployCacheServer added in v0.5.0

func DeployCacheServer(ctx context.Context, t *testing.T, configClient, workloadClient ctrlruntimeclient.Client, namespace string, patches ...func(*operatorv1alpha1.CacheServer)) operatorv1alpha1.CacheServer

func DeployCacheServerWithExternalEtcd added in v0.5.0

func DeployCacheServerWithExternalEtcd(ctx context.Context, t *testing.T, configClient, workloadClient ctrlruntimeclient.Client, namespace string, replicas int32, patches ...func(*operatorv1alpha1.CacheServer)) operatorv1alpha1.CacheServer

func DeployEtcd

func DeployEtcd(t *testing.T, name, namespace string) string

DeployEtcd deploys etcd onto the workload cluster, where the kcp pods run.

func DeployFrontProxy

func DeployFrontProxy(ctx context.Context, t *testing.T, configClient, workloadClient ctrlruntimeclient.Client, namespace string, rootShardName string, externalHostname string, patches ...func(*operatorv1alpha1.FrontProxy)) operatorv1alpha1.FrontProxy

func DeployRootShard

func DeployRootShard(ctx context.Context, t *testing.T, configClient, workloadClient ctrlruntimeclient.Client, namespace string, externalHostname string, patches ...func(*operatorv1alpha1.RootShard)) operatorv1alpha1.RootShard

func DeployShard

func DeployShard(ctx context.Context, t *testing.T, configClient, workloadClient ctrlruntimeclient.Client, namespace, name, rootShard string, patches ...func(*operatorv1alpha1.Shard)) operatorv1alpha1.Shard

func DeployVirtualWorkspace added in v0.7.0

func DeployVirtualWorkspace(ctx context.Context, t *testing.T, configClient, workloadClient ctrlruntimeclient.Client, namespace, name string, waitForReady bool, patches ...func(*operatorv1alpha1.VirtualWorkspace)) operatorv1alpha1.VirtualWorkspace

func GetConfigKubeClient added in v0.9.0

func GetConfigKubeClient(t *testing.T) ctrlruntimeclient.Client

GetConfigKubeClient returns a client for the config cluster.

func GetKcpRelease added in v0.5.0

func GetKcpRelease() *semver.Version

func GetSelfSignedIssuerRef

func GetSelfSignedIssuerRef() *operatorv1alpha1.ObjectReference

func GetWorkloadKubeClient added in v0.9.0

func GetWorkloadKubeClient(t *testing.T) ctrlruntimeclient.Client

GetWorkloadKubeClient returns a client for the workload cluster.

func NewScheme added in v0.2.0

func NewScheme(t *testing.T) *runtime.Scheme

func SelfDestuctingPortForward

func SelfDestuctingPortForward(
	t *testing.T,
	ctx context.Context,
	namespace string,
	target string,
	targetPort int,
	localPort int,
)

SelfDestuctingPortForward forwards a port on the workload cluster, where the kcp pods run, to a local port.

func SkipUnlessTopology added in v0.9.0

func SkipUnlessTopology(t *testing.T, topology string)

func Topology added in v0.9.0

func Topology() string

func WaitForObjectDeletion added in v0.5.0

func WaitForObjectDeletion(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client, obj ctrlruntimeclient.Object, key types.NamespacedName)

func WaitForPods

func WaitForPods(t *testing.T, ctx context.Context, client ctrlruntimeclient.Client, listOpts ...ctrlruntimeclient.ListOption)

Types

type ClusterClient added in v0.7.0

type ClusterClient interface {
	// Cluster returns the client for the given cluster.
	Cluster(cluster logicalcluster.Path) ctrlruntimeclient.Client
}

ClusterClient is a cluster-aware client.

func KubeconfigClusterClient added in v0.7.0

func KubeconfigClusterClient(
	t *testing.T,
	ctx context.Context,
	configClient ctrlruntimeclient.Client,
	namespace string,
	kubeconfigName string,
) ClusterClient

Jump to

Keyboard shortcuts

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