utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Entry = "true"

	// condition status of ModelServingStatus
	AllGroupsIsReady         = "All Serving groups are ready"
	SomeGroupsAreProgressing = "Some groups is progressing"
	SomeGroupsAreUpdated     = "Updated Groups are"
)

Variables

This section is empty.

Functions

func CheckPodRevision

func CheckPodRevision(pod *corev1.Pod, revision string) bool

CheckPodRevision determine if the pod's revision is compliant or not.

func ContainerRestarted

func ContainerRestarted(pod *corev1.Pod) bool

ContainerRestarted return true when there is any container in the pod that gets restarted

func CreateHeadlessService

func CreateHeadlessService(ctx context.Context, k8sClient kubernetes.Interface, mi *workloadv1alpha1.ModelServing, serviceSelector map[string]string, groupName, roleLabel string, roleIndex int) error

func DeepHashObject

func DeepHashObject(hasher hash.Hash, objectToWrite interface{})

DeepHashObject writes specified object to hash using the spew library which follows pointers and prints actual values of the nested objects ensuring the hash does not change when a pointer changes.

func ExpectedPodNum

func ExpectedPodNum(mi *workloadv1alpha1.ModelServing) int

func GenerateEntryPod

func GenerateEntryPod(role workloadv1alpha1.Role, mi *workloadv1alpha1.ModelServing, groupName string, roleIndex int, revision string) *corev1.Pod

func GenerateRoleID

func GenerateRoleID(roleName string, idx int) string

func GenerateServingGroupName

func GenerateServingGroupName(miName string, idx int) string

func GenerateWorkerPod

func GenerateWorkerPod(role workloadv1alpha1.Role, mi *workloadv1alpha1.ModelServing, entryPod *corev1.Pod, groupName string, roleIndex, podIndex int, revision string) *corev1.Pod

func GetModelServingAndGroupByLabel

func GetModelServingAndGroupByLabel(podLabels map[string]string) (string, string, bool)

func GetNamespaceName

func GetNamespaceName(obj metav1.Object) types.NamespacedName

func GetParentNameAndOrdinal

func GetParentNameAndOrdinal(groupName string) (string, int)

GetParentNameAndOrdinal gets the name of ServingGroup's parent modelServing and ServingGroup's ordinal as extracted from its Name. For example, the Servinggroup name is vllm-sample-0, this function can be used to obtain the modelServing name corresponding to the ServingGroup, which is vllm-sample and the serial number is 0.

func GroupNameIndexFunc

func GroupNameIndexFunc(obj interface{}) ([]string, error)

func IsPodFailed

func IsPodFailed(pod *corev1.Pod) bool

IsPodFailed returns true if pod has a Phase of PodFailed.

func IsPodRunningAndReady

func IsPodRunningAndReady(pod *corev1.Pod) bool

IsPodRunningAndReady returns true if pod is in the PodRunning Phase, if it has a condition of PodReady.

func IsPodTerminating

func IsPodTerminating(pod *corev1.Pod) bool

IsPodTerminating returns true if pod's DeletionTimestamp has been set

func ParseModelServingFromRequest

func ParseModelServingFromRequest(r *http.Request) (*admissionv1.AdmissionReview, *workloadv1alpha1.ModelServing, error)

ParseAdmissionRequest parses the HTTP request and extracts the AdmissionReview and ModelServing.

func PodRevision

func PodRevision(pod *corev1.Pod) string

PodRevision returns the revision label of the pod.

func PodRoleID

func PodRoleID(pod *corev1.Pod) string

PodRoleID returns the role id of the pod.

func PodRoleName

func PodRoleName(pod *corev1.Pod) string

PodRoleName returns the role name of the pod.

func RemoveRoleReplicasForRevision

func RemoveRoleReplicasForRevision(mi *workloadv1alpha1.ModelServing) *workloadv1alpha1.ModelServing

RemoveRoleReplicasForRevision remove role.replicas when calculating modelServing revision hash

func Revision

func Revision(obj interface{}) string

Revision calculates the revision of an object using FNV hashing.

func RoleIDIndexFunc

func RoleIDIndexFunc(obj interface{}) ([]string, error)

func SendAdmissionResponse

func SendAdmissionResponse(w http.ResponseWriter, admissionReview *admissionv1.AdmissionReview) error

SendAdmissionResponse sends the AdmissionReview response back to the client

func SetCondition

func SetCondition(mi *workloadv1alpha1.ModelServing, progressingGroups, updatedGroups, currentGroups []int) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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