util

package
v0.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DeployTimeout   = 5 * time.Minute
	UndeployTimeout = 5 * time.Minute
	EnableTimeout   = 5 * time.Minute

	// Typically less than 90 seconds, but in some cases it can take more than 5 minutes.
	DisableTimeout = 10 * time.Minute
	PurgeTimeout   = 10 * time.Minute

	// With appset deployment may need 2m30s after failover and relocate.
	FailoverTimeout = 15 * time.Minute
	RelocateTimeout = 15 * time.Minute

	// Polling internal during wait.
	RetryInterval = 5 * time.Second
)
View Source
const PlacementDecisionReasonFailoverRetained = "RetainedForFailover"

TODO: Carried over from internal/controllers, this is not part of API, may need a better way to reference it!

Variables

This section is empty.

Functions

func AddVolsyncAnnontationOnManagedClusters

func AddVolsyncAnnontationOnManagedClusters(ctx types.Context, namespace string) error

Problem: currently we must manually add an annotation to application’s namespace to make volsync work. See this link https://volsync.readthedocs.io/en/stable/usage/permissionmodel.html#controlling-mover-permissions Workaround: add volsync annotation on app namespaces on both drclusters

func CreateNamespace

func CreateNamespace(ctx types.Context, cluster *types.Cluster, name string) error

CreateNamespace creates a namespace in the specified cluster with the ramen-e2e managed label. If the namespace already exists, it checks whether it's managed by ramen-e2e and logs a warning if not.

func CreateNamespaceOnMangedClusters

func CreateNamespaceOnMangedClusters(ctx types.Context, namespace string) error

CreateNamespaceOnMangedClusters creates a namespace on both drclusters with ramen-e2e label.

func DeleteNamespace

func DeleteNamespace(ctx types.Context, cluster *types.Cluster, name string) error

DeleteNamespace safely deletes a namespace from the specified cluster. Only deletes namespaces that are managed by ramen-e2e.

func DeleteNamespaceOnManagedClusters

func DeleteNamespaceOnManagedClusters(ctx types.Context, namespace string) error

DeleteNamespaceOnManagedClusters safely deletes a namespace from both drclusters. Only deletes namespaces that were created by ramen-e2e (have the management label). This provides protection against accidentally deleting user or system namespaces.

func EnsureChannel

func EnsureChannel(ctx types.Context) error

func EnsureChannelDeleted

func EnsureChannelDeleted(ctx types.Context) error

func GetCurrentCluster

func GetCurrentCluster(ctx types.Context, namespace string, placementName string) (*types.Cluster, error)

GetCurrentCluster retrieves the cluster object where the workload is currently placed by looking up the cluster name from the PlacementDecision and returning the corresponding cluster from the environment. Requires an existing PlacementDecision with a valid decision. Not applicable for discovered apps before enabling protection, as no Placement exists.

func GetDRPolicy

func GetDRPolicy(ctx types.Context, cluster *types.Cluster, name string) (*ramen.DRPolicy, error)

nolint:unparam

func GetPlacement

func GetPlacement(ctx types.Context, namespace, name string) (*v1beta1.Placement, error)

func RunCommand

func RunCommand(ctx context.Context, command string, args ...string) error

RunCommand runs a command and return the error. The command will be killed when the context is canceled or the deadline is exceeded.

func Sleep

func Sleep(ctx context.Context, d time.Duration) error

Sleep pauses the current goroutine for at least the duration d. If the context was canceled or its deadline has exceeded it will return early with a context.Canceled or a context.DeadlineExceeded error.

func WaitForApplicationSetDelete

func WaitForApplicationSetDelete(ctx types.Context, cluster *types.Cluster, name, namespace string) error

func WaitForConfigMapDelete

func WaitForConfigMapDelete(ctx types.Context, cluster *types.Cluster, name, namespace string) error

func WaitForDRPCDelete

func WaitForDRPCDelete(ctx types.Context, cluster *types.Cluster, name, namespace string) error

func WaitForManagedClusterSetBindingDelete

func WaitForManagedClusterSetBindingDelete(ctx types.Context, cluster *types.Cluster, name, namespace string) error

func WaitForNamespaceDelete

func WaitForNamespaceDelete(ctx types.Context, cluster *types.Cluster, name string) error

func WaitForNamespaceDeleteOnManagedClusters

func WaitForNamespaceDeleteOnManagedClusters(ctx types.Context, name string) error

WaitForNamespaceDeleteOnManagedClusters waits for namespaces on both drclusters with ramen-e2e label.

func WaitForPlacementDelete

func WaitForPlacementDelete(ctx types.Context, cluster *types.Cluster, name, namespace string) error

func WaitForRecipeDelete

func WaitForRecipeDelete(ctx types.Context, cluster *types.Cluster, name, namespace string) error

func WaitForRecipeDeleteOnManagedClusters

func WaitForRecipeDeleteOnManagedClusters(ctx types.Context, name, namespace string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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