utils

package
v0.1.0-alpha.1....-9b31e75 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddEnvVarsToContainers

func AddEnvVarsToContainers(containers []corev1.Container, envVars []corev1.EnvVar)

AddEnvVarsToContainers adds the given environment variables to the Pod containers.

func ComputePCLQPodTemplateHash

func ComputePCLQPodTemplateHash(pclqTemplateSpec *grovecorev1alpha1.PodCliqueTemplateSpec, priorityClassName string) string

ComputePCLQPodTemplateHash computes the pod template hash for the PCLQ pod spec.

func FindScalingGroupConfigForClique

func FindScalingGroupConfigForClique(scalingGroupConfigs []grovecorev1alpha1.PodCliqueScalingGroupConfig, cliqueName string) *grovecorev1alpha1.PodCliqueScalingGroupConfig

FindScalingGroupConfigForClique searches through the scaling group configurations to find the one that contains the specified clique name in its CliqueNames list.

Returns the matching PodCliqueScalingGroupConfig and true if found, or an empty config and false if not found.

func GenerateDependencyNamesForBasePodGang

func GenerateDependencyNamesForBasePodGang(pcs *grovecorev1alpha1.PodCliqueSet, pcsReplicaIndex int, parentCliqueName string) []string

GenerateDependencyNamesForBasePodGang generates the FQNs of all PodCliques that would qualify as a dependency.

func GetExpectedPCLQNamesGroupByOwner

func GetExpectedPCLQNamesGroupByOwner(pcs *grovecorev1alpha1.PodCliqueSet) (expectedPCLQNamesForPCS []string, expectedPCLQNamesForPCSG []string)

GetExpectedPCLQNamesGroupByOwner returns the expected unqualified PodClique names which are either owned by PodCliqueSet or PodCliqueScalingGroup.

func GetExpectedPCLQPodTemplateHash

func GetExpectedPCLQPodTemplateHash(pcs *grovecorev1alpha1.PodCliqueSet, pclqObjectMeta metav1.ObjectMeta) (string, error)

GetExpectedPCLQPodTemplateHash finds the matching PodCliqueTemplateSpec from the PodCliqueSet and computes the pod template hash for the PCLQ pod spec.

func GetExpectedPCSGFQNsForPCS

func GetExpectedPCSGFQNsForPCS(pcs *grovecorev1alpha1.PodCliqueSet) []string

GetExpectedPCSGFQNsForPCS computes the FQNs for all PodCliqueScalingGroups defined in PCS for the given replica.

func GetExpectedPCSGFQNsPerPCSReplica

func GetExpectedPCSGFQNsPerPCSReplica(pcs *grovecorev1alpha1.PodCliqueSet) map[int][]string

GetExpectedPCSGFQNsPerPCSReplica computes the FQNs for all PodCliqueScalingGroups defined in PCS for each replica.

func GetExpectedStandAlonePCLQFQNsPerPCSReplica

func GetExpectedStandAlonePCLQFQNsPerPCSReplica(pcs *grovecorev1alpha1.PodCliqueSet) map[int][]string

GetExpectedStandAlonePCLQFQNsPerPCSReplica computes the FQNs for all standalone PodCliques defined in PCS for each replica.

func GetMinAvailableBreachedPCLQInfo

func GetMinAvailableBreachedPCLQInfo(pclqs []grovecorev1alpha1.PodClique, terminationDelay time.Duration, since time.Time) ([]string, time.Duration)

GetMinAvailableBreachedPCLQInfo filters PodCliques that have grovecorev1alpha1.ConditionTypeMinAvailableBreached set to true. For each such PodClique it returns the name of the PodClique a duration to wait for before terminationDelay is breached.

func GetPCLQPods

func GetPCLQPods(ctx context.Context, cl client.Client, pcsName string, pclq *grovecorev1alpha1.PodClique) ([]*corev1.Pod, error)

GetPCLQPods lists all Pods that belong to a PodClique

func GetPCLQTemplateHashes

GetPCLQTemplateHashes generates the Pod template hash for all PCLQs in a PCSG. Returns a map of [PCLQ Name : PodTemplateHas]

func GetPCLQsByOwner

func GetPCLQsByOwner(ctx context.Context, cl client.Client, ownerKind string, ownerObjectKey client.ObjectKey, selectorLabels map[string]string) ([]grovecorev1alpha1.PodClique, error)

GetPCLQsByOwner retrieves PodClique objects that are owned by the specified owner kind and object key, and match the provided selector labels.

func GetPCLQsByOwnerReplicaIndex

func GetPCLQsByOwnerReplicaIndex(ctx context.Context, cl client.Client, ownerKind string, ownerObjectKey client.ObjectKey, selectorLabels map[string]string) (map[string][]grovecorev1alpha1.PodClique, error)

GetPCLQsByOwnerReplicaIndex retrieves PodClique objects per replica of the owner resource matching provided selector labels.

func GetPCLQsInPCSGPendingUpdate

func GetPCLQsInPCSGPendingUpdate(pcs *grovecorev1alpha1.PodCliqueSet, pcsg *grovecorev1alpha1.PodCliqueScalingGroup, existingPCLQs []grovecorev1alpha1.PodClique) []string

GetPCLQsInPCSGPendingUpdate collects the PodClique FQNs that are pending updates. It identifies PCLQ pending update by comparing the current PodTemplateHash label on an existing PCLQ with that of a computed PodTemplateHash from the latest PodCliqueSet resource.

func GetPCLQsMatchingLabels

func GetPCLQsMatchingLabels(ctx context.Context, cl client.Client, namespace string, selectorLabels map[string]string) ([]grovecorev1alpha1.PodClique, error)

GetPCLQsMatchingLabels gets all the PodClique's in a given namespace matching selectorLabels.

func GetPCSGsByPCSReplicaIndex

func GetPCSGsByPCSReplicaIndex(ctx context.Context, cl client.Client, pcsObjKey client.ObjectKey) (map[string][]grovecorev1alpha1.PodCliqueScalingGroup, error)

GetPCSGsByPCSReplicaIndex groups the PodCliqueScalingGroups per PodCliqueSet replica index and returns a map with the key being the PodCliqueSet replica index and the value being the slice of PodCliqueScalingGroup objects.

func GetPCSGsForPCS

GetPCSGsForPCS fetches all PodCliqueScalingGroups for a PodCliqueSet.

func GetPodCliqueFQNsForPCSG

func GetPodCliqueFQNsForPCSG(pcsg *grovecorev1alpha1.PodCliqueScalingGroup) []string

GetPodCliqueFQNsForPCSG generates the PodClique FQNs for all PodCliques that are owned by a PodCliqueScalingGroup.

func GetPodCliqueFQNsForPCSNotInPCSG

func GetPodCliqueFQNsForPCSNotInPCSG(pcs *grovecorev1alpha1.PodCliqueSet) []string

GetPodCliqueFQNsForPCSNotInPCSG computes the FQNs for all PodCliques for all PCS replicas which are not part of any PCSG.

func GetPodCliqueFQNsForPCSReplicaNotInPCSG

func GetPodCliqueFQNsForPCSReplicaNotInPCSG(pcs *grovecorev1alpha1.PodCliqueSet, pcsReplicaIndex int) []string

GetPodCliqueFQNsForPCSReplicaNotInPCSG computes the FQNs for all PodCliques for a PCS replica which are not part of any PCSG.

func GetPodCliqueSet

func GetPodCliqueSet(ctx context.Context, cl client.Client, objectMeta metav1.ObjectMeta) (*grovecorev1alpha1.PodCliqueSet, error)

GetPodCliqueSet gets the owner PodCliqueSet object.

func GetPodCliqueSetName

func GetPodCliqueSetName(objectMeta metav1.ObjectMeta) string

GetPodCliqueSetName retrieves the PodCliqueSet name from the labels of the given ObjectMeta. NOTE: It is assumed that all managed objects like PCSG, PCLQ and Pods will always have PCS name as value for grovecorev1alpha1.LabelPartOfKey label. It should be ensured that labels that are set by the operator are never removed.

func GetPodCliquesWithParentPCS

func GetPodCliquesWithParentPCS(ctx context.Context, cl client.Client, pcsObjKey client.ObjectKey) ([]grovecorev1alpha1.PodClique, error)

GetPodCliquesWithParentPCS retrieves PodClique objects that are not part of any PodCliqueScalingGroup for the given PodCliqueSet.

func GetPodGang

func GetPodGang(ctx context.Context, cl client.Client, podGangName, namespace string) (*groveschedulerv1alpha1.PodGang, error)

GetPodGang fetches a PodGang by name and namespace.

func GetPodGangSelectorLabels

func GetPodGangSelectorLabels(pcsObjMeta metav1.ObjectMeta) map[string]string

GetPodGangSelectorLabels creates the label selector to list all the PodGangs for a PodCliqueSet.

func GroupPCLQsByPCSGReplicaIndex

func GroupPCLQsByPCSGReplicaIndex(pclqs []grovecorev1alpha1.PodClique) map[string][]grovecorev1alpha1.PodClique

GroupPCLQsByPCSGReplicaIndex filters PCLQs that have a PodCliqueScalingGroupReplicaIndex label and groups them by the PCSG replica.

func GroupPCLQsByPCSReplicaIndex

func GroupPCLQsByPCSReplicaIndex(pclqs []grovecorev1alpha1.PodClique) map[string][]grovecorev1alpha1.PodClique

GroupPCLQsByPCSReplicaIndex filters PCLQs that have a PodCliqueSetReplicaIndex label and groups them by the PCS replica.

func GroupPCLQsByPodGangName

func GroupPCLQsByPodGangName(pclqs []grovecorev1alpha1.PodClique) map[string][]grovecorev1alpha1.PodClique

GroupPCLQsByPodGangName filters PCLQs that have a PodGang label and groups them by the PodGang name.

func GroupPCSGsByPCSReplicaIndex

GroupPCSGsByPCSReplicaIndex filters PCSGs that have a PodCliqueSetReplicaIndex label and groups them by the PCS replica.

func IsLastPCLQUpdateCompleted

func IsLastPCLQUpdateCompleted(pclq *grovecorev1alpha1.PodClique) bool

IsLastPCLQUpdateCompleted checks if the last rolling update of PodClique is completed.

func IsPCLQUpdateInProgress

func IsPCLQUpdateInProgress(pclq *grovecorev1alpha1.PodClique) bool

IsPCLQUpdateInProgress checks if PodClique is under rolling update.

func IsPCSGUpdateComplete

func IsPCSGUpdateComplete(pcsg *grovecorev1alpha1.PodCliqueScalingGroup, pcsGenerationHash string) bool

IsPCSGUpdateComplete returns whether the rolling update of the PodCliqueScalingGroup is complete.

func IsPCSGUpdateInProgress

func IsPCSGUpdateInProgress(pcsg *grovecorev1alpha1.PodCliqueScalingGroup) bool

IsPCSGUpdateInProgress checks if PCSG is under rolling update.

func PodsToObjectNames

func PodsToObjectNames(pods []*corev1.Pod) []string

PodsToObjectNames converts a slice of Pods to a slice of string representations in "namespace/name" format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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