utils

package
v0.0.0-...-ea83631 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AfterAllCleanupLabels  = map[string]string{"dpf-operator-e2e-test-cleanup": "true"}
	AfterEachCleanupLabels = map[string]string{"between-tests-cleanup": "true"}
)

Cleanup labels used across e2e tests

Functions

func CleanupAndWait

func CleanupAndWait(ctx context.Context, c client.Client, objs ...client.Object) error

CleanupAndWait deletes an object and waits for it to be removed before exiting.

func CleanupWithFinalizerRemovalAndWait

func CleanupWithFinalizerRemovalAndWait(ctx context.Context, c client.Client, resources ...client.Object) error

CleanupWithFinalizerRemovalAndWait removes finalizers from resources then deletes them. After deletion, it waits for them to be removed Note: this should be used when such a "force" deletion is ok and leads to no side-effects. e.g. no controllers need to take action as a result of a resource removal.

func CleanupWithLabelAndWait

func CleanupWithLabelAndWait(ctx context.Context, c client.Client, labelSelector labels.Selector, resources ...client.ObjectList) error

CleanupWithLabelAndWait creates a list ob objects with certain labels and deletes them. After deletion, it waits to be removed.

func CreateMTLSCerts

func CreateMTLSCerts(dmsIP string) (caCrtBytes, clientCrtBytes, clientKeyBytes, srvCrtBytes, srvKeyBytes []byte)

CreateMTLSCerts creates mTLS certificates for testing purposes. Returns CA certificate, client certificate, client key, server certificate, and server key as PEM-encoded bytes.

func CreateResourceIfNotExist

func CreateResourceIfNotExist(ctx context.Context, c client.Client, obj client.Object) error

CreateResourceIfNotExist creates a resource if it doesn't exist

func ForceObjectReconcileWithAnnotation

func ForceObjectReconcileWithAnnotation(ctx context.Context, c client.Client, obj client.Object) error

ForceObjectReconcileWithAnnotation adds patches the passed object with an annotation to force it to be reconciled.

func GenerateDPUObj

func GenerateDPUObj[T client.Object](name, ns string, obj T, customLabels ...map[string]string) T

GenerateDPUObj sets the name, namespace, and labels on a given client.Object. Optionally, customLabels can be provided to override the default cleanup labels. AfterAllCleanupLabels are always merged into the final label set.

func GetFakeKamajiClusterSecretFromEnvtest

func GetFakeKamajiClusterSecretFromEnvtest(cluster provisioningv1.DPUCluster, cfg *rest.Config) (*corev1.Secret, error)

GetFakeKamajiClusterSecretFromEnvtest creates a kamaji secret using the envtest information to simulate that we have a kamaji cluster. In reality, this is the same envtest Kubernetes API.

func GetTestDPUCluster

func GetTestDPUCluster(ns, name string) provisioningv1.DPUCluster

func GetTestLabels

func GetTestLabels() map[string]string

func ResolveBFBImageURL

func ResolveBFBImageURL(bfbURL string) (string, error)

ResolveBFBImageURL resolves a BFB image URL to a real file path. On our test environment, we can access NFS files via HTTP. To be able to test the latest BFB image, we need to resolve the URL to a real file path.

func ResolveHBNImageURL

func ResolveHBNImageURL(hbnURL string) (string, error)

ResolveHBNImageURL processes the HBN image URL and returns it if valid.

Types

This section is empty.

Directories

Path Synopsis
vpc
ovn

Jump to

Keyboard shortcuts

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