Documentation
¶
Index ¶
- func GetPodCliqueNameFromPodCliqueFQN(pclqObjectMeta metav1.ObjectMeta) (string, error)
- func GetPodCliqueSetReplicaIndexFromPodCliqueFQN(pcsName, pclqFQNName string) (int, error)
- func IsEmptyStringType[T ~string](val T) bool
- func OnlyOneIsNil[T any](objA, objB *T) bool
- type RunResult
- func RunConcurrently(ctx context.Context, logger logr.Logger, tasks []Task) RunResult
- func RunConcurrentlyWithBounds(ctx context.Context, logger logr.Logger, tasks []Task, bound int) RunResult
- func RunConcurrentlyWithSlowStart(ctx context.Context, logger logr.Logger, initialBatchSize int, tasks []Task) RunResult
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPodCliqueNameFromPodCliqueFQN ¶
func GetPodCliqueNameFromPodCliqueFQN(pclqObjectMeta metav1.ObjectMeta) (string, error)
GetPodCliqueNameFromPodCliqueFQN get unqualified PodClique name from FQN.
func GetPodCliqueSetReplicaIndexFromPodCliqueFQN ¶
GetPodCliqueSetReplicaIndexFromPodCliqueFQN extracts the PodCliqueSet replica index from a Pod Clique FQN name.
func IsEmptyStringType ¶
IsEmptyStringType returns true if value (which is a string or has an underline type string) is empty or contains only whitespace characters.
func OnlyOneIsNil ¶
OnlyOneIsNil returns true if only one of the Objects is nil else it will return false.
Types ¶
type RunResult ¶
type RunResult struct {
// SuccessfulTasks holds the names of taskConfigs that were executed successfully.
SuccessfulTasks []string
// FailedTasks holds the names of taskConfigs that failed during execution.
FailedTasks []string
// SkippedTasks holds the names of taskConfigs that were skipped (not executed).
SkippedTasks []string
// Errors holds the errors encountered during the execution of taskConfigs.
Errors []error
}
RunResult is a structure that holds the results of running taskConfigs concurrently.
func RunConcurrently ¶
RunConcurrently executes a slice of Tasks concurrently.
func RunConcurrentlyWithBounds ¶
func RunConcurrentlyWithBounds(ctx context.Context, logger logr.Logger, tasks []Task, bound int) RunResult
RunConcurrentlyWithBounds executes a slice of Tasks with at most `bound` taskConfigs running concurrently.
func RunConcurrentlyWithSlowStart ¶
func RunConcurrentlyWithSlowStart(ctx context.Context, logger logr.Logger, initialBatchSize int, tasks []Task) RunResult
RunConcurrentlyWithSlowStart executes a slice of Tasks by grouping them into batches that double in size each time, starting with `initialBatchSize`. If the whole batch succeeds, the next batch is doubled in size and executed. If there are any errors in the batch, then it fails fast and returns the errors immediately, thus halting the execution of further taskConfigs. kube-apiserver does not provide batching of requests, therefore if there are many resources for which calls are made to kube-apiserver, then this function prevents overwhelming the kube-apiserver with too many requests at once.
func (*RunResult) GetAggregatedError ¶
GetAggregatedError aggregates all errors encountered during the execution of taskConfigs.
func (*RunResult) GetSummary ¶
GetSummary returns a summary of the RunResult, including the number of successful, failed, and skipped taskConfigs.