utils

package
v1.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOrdinal

func GetOrdinal(pod *corev1.Pod) int

GetOrdinal gets pod's ordinal. If pod has no ordinal, -1 is returned.

func GetOrdinalPodName

func GetOrdinalPodName(nodeset *slinkyv1beta1.NodeSet, ordinal int) string

GetOrdinalPodName gets the name of nodeset's child Pod with an ordinal index of ordinal

func GetPaddedOrdinal

func GetPaddedOrdinal(nodeset *slinkyv1beta1.NodeSet, ordinal int) string

GetPaddedOrdinal gets the name of nodeset's child Pod with an ordinal index of ordinal

func GetParentNameAndOrdinal

func GetParentNameAndOrdinal(pod *corev1.Pod) (string, int)

GetParentNameAndOrdinal gets the name of pod's parent NodeSet and pod's ordinal as extracted from its Name. If the Pod was not created by a NodeSet, its parent is considered to be empty string, and its ordinal is considered to be -1.

func GetPersistentVolumeClaimNameNodeName

func GetPersistentVolumeClaimNameNodeName(nodeset *slinkyv1beta1.NodeSet, claim *corev1.PersistentVolumeClaim, nodeName string) string

GetPersistentVolumeClaimNameNodeName gets the name of PersistentVolumeClaim for a Pod with a node name. claim must be a PersistentVolumeClaim from nodeset's VolumeClaims template.

func GetPersistentVolumeClaimNameOrdinal

func GetPersistentVolumeClaimNameOrdinal(nodeset *slinkyv1beta1.NodeSet, claim *corev1.PersistentVolumeClaim, paddedOrdinal string) string

GetPersistentVolumeClaimNameOrdinal gets the name of PersistentVolumeClaim for a Pod with an ordinal index of ordinal. claim must be a PersistentVolumeClaim from nodeset's VolumeClaims template.

func GetPersistentVolumeClaims

func GetPersistentVolumeClaims(nodeset *slinkyv1beta1.NodeSet, pod *corev1.Pod) map[string]corev1.PersistentVolumeClaim

GetPersistentVolumeClaims gets a map of PersistentVolumeClaims to their template names, as defined in nodeset. The returned PersistentVolumeClaims are each constructed with a the name specific to the Pod. This name is determined by GetPersistentVolumeClaimName.

func GetSlurmNodeName

func GetSlurmNodeName(pod *corev1.Pod) string

GetSlurmNodeName returns the Slurm node name.

func IsIdentityMatch

func IsIdentityMatch(nodeset *slinkyv1beta1.NodeSet, pod *corev1.Pod) bool

IsIdentityMatch returns true if pod has a valid identity and network identity for a member of nodeset.

func IsPodFromNodeSet

func IsPodFromNodeSet(nodeset *slinkyv1beta1.NodeSet, pod *corev1.Pod) bool

IsPodFromNodeSet returns if the name schema matches

func IsStorageMatch

func IsStorageMatch(nodeset *slinkyv1beta1.NodeSet, pod *corev1.Pod) bool

IsStorageMatch returns true if pod's Volumes cover the nodeset of PersistentVolumeClaims

func NewNodeSetDaemonSetPod

func NewNodeSetDaemonSetPod(
	client client.Client,
	nodeset *slinkyv1beta1.NodeSet,
	controller *slinkyv1beta1.Controller,
	nodeName string,
	revisionHash string,
) *corev1.Pod

func NewNodeSetStatefulSetPod

func NewNodeSetStatefulSetPod(
	client client.Client,
	nodeset *slinkyv1beta1.NodeSet,
	controller *slinkyv1beta1.Controller,
	ordinal int,
	revisionHash string,
) *corev1.Pod

NewNodeSetStatefulSetPod returns a new Pod conforming to the nodeset's Spec with an identity generated from ordinal.

func SetOwnerReferences

func SetOwnerReferences(r client.Client, ctx context.Context, object metav1.Object, clusterName string) error

SetOwnerReferences modifies the object with all NodeSets as non-controller owners.

func SplitActivePods

func SplitActivePods(pods []*corev1.Pod, partition int) (pods1, pods2 []*corev1.Pod)

SplitActivePods returns two list of pods partitioned by a number.

func SplitUnhealthyPods

func SplitUnhealthyPods(pods []*corev1.Pod) (unhealthyPods, healthyPods []*corev1.Pod)

SplitUnhealthyPods returns lists of healthy and unhealthy pods.

func UpdateIdentity

func UpdateIdentity(nodeset *slinkyv1beta1.NodeSet, pod *corev1.Pod)

UpdateIdentity updates pod's labels.

func UpdateStorage

func UpdateStorage(nodeset *slinkyv1beta1.NodeSet, pod *corev1.Pod)

UpdateStorage updates pod's Volumes to conform with the PersistentVolumeClaim of nodeset's templates. If pod has conflicting local Volumes these are replaced with Volumes that conform to the nodeset's templates.

Types

type ActivePods

type ActivePods []*corev1.Pod

ActivePods type allows custom sorting of pods so a controller can pick the best ones to delete.

func (ActivePods) Len

func (o ActivePods) Len() int

func (ActivePods) Less

func (o ActivePods) Less(i, j int) bool

Less compares two pods and returns true if the first one should be preferred for deletion.

func (ActivePods) Swap

func (o ActivePods) Swap(i, j int)

type PodsByCreationTimestamp

type PodsByCreationTimestamp []*corev1.Pod

PodsByCreationTimestamp sorts a list of Pods by creation timestamp, using their names as a tie breaker.

func (PodsByCreationTimestamp) Len

func (o PodsByCreationTimestamp) Len() int

func (PodsByCreationTimestamp) Less

func (o PodsByCreationTimestamp) Less(i, j int) bool

func (PodsByCreationTimestamp) Swap

func (o PodsByCreationTimestamp) Swap(i, j int)

Jump to

Keyboard shortcuts

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