Documentation
¶
Index ¶
- Constants
- func CheckPodRevision(pod *corev1.Pod, revision string) bool
- func CleanupOldControllerRevisions(ctx context.Context, client kubernetes.Interface, ...) error
- func ContainerRestarted(pod *corev1.Pod) bool
- func CreateControllerRevision(ctx context.Context, client kubernetes.Interface, ...) (*appsv1.ControllerRevision, error)
- func CreateHeadlessService(ctx context.Context, k8sClient kubernetes.Interface, ...) error
- func DeepHashObject(hasher hash.Hash, objectToWrite interface{})
- func ExpectedPodNum(ms *workloadv1alpha1.ModelServing) int
- func GenerateControllerRevisionName(msName, revision string) string
- func GenerateEntryPod(role workloadv1alpha1.Role, ms *workloadv1alpha1.ModelServing, ...) *corev1.Pod
- func GeneratePodName(groupName, roleName string, podIndex int) string
- func GenerateRoleID(roleName string, idx int) string
- func GenerateServingGroupName(miName string, idx int) string
- func GenerateWorkerPod(role workloadv1alpha1.Role, ms *workloadv1alpha1.ModelServing, ...) *corev1.Pod
- func GetControllerRevision(ctx context.Context, client kubernetes.Interface, ...) (*appsv1.ControllerRevision, error)
- func GetMaxUnavailable(mi *workloadv1alpha1.ModelServing) (int, error)
- func GetModelServingAndGroupByLabel(podLabels map[string]string) (string, string, bool)
- func GetNamespaceName(obj metav1.Object) types.NamespacedName
- func GetParentNameAndOrdinal(groupName string) (string, int)
- func GetRoleID(resource metav1.Object) string
- func GetRoleName(resource metav1.Object) string
- func GetRolesFromControllerRevision(cr *appsv1.ControllerRevision) ([]workloadv1alpha1.Role, error)
- func GroupNameIndexFunc(obj interface{}) ([]string, error)
- func IsOwnedByModelServingWithUID(obj metav1.Object, uid types.UID) bool
- func IsPodFailed(pod *corev1.Pod) bool
- func IsPodRunningAndReady(pod *corev1.Pod) bool
- func IsPodTerminating(pod *corev1.Pod) bool
- func ObjectRevision(obj metav1.Object) string
- func ParseModelServingFromRequest(r *http.Request) (*admissionv1.AdmissionReview, *workloadv1alpha1.ModelServing, error)
- func RemoveRoleReplicasForRevision(ms *workloadv1alpha1.ModelServing) *workloadv1alpha1.ModelServing
- func Revision(obj interface{}) string
- func RoleIDIndexFunc(obj interface{}) ([]string, error)
- func SendAdmissionResponse(w http.ResponseWriter, admissionReview *admissionv1.AdmissionReview) error
- func SetCondition(ms *workloadv1alpha1.ModelServing, ...) bool
Constants ¶
const ( // ControllerRevisionLabelKey is the label key for ModelServing name ControllerRevisionLabelKey = workloadv1alpha1.ModelServingNameLabelKey // ControllerRevisionRevisionLabelKey is the label key for revision ControllerRevisionRevisionLabelKey = workloadv1alpha1.RevisionLabelKey )
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 ¶
CheckPodRevision determine if the pod's revision is compliant or not.
func CleanupOldControllerRevisions ¶ added in v0.3.0
func CleanupOldControllerRevisions( ctx context.Context, client kubernetes.Interface, ms *workloadv1alpha1.ModelServing, ) error
CleanupOldControllerRevisions deletes old ControllerRevisions that are no longer in use. In ModelServing, we typically have at most two revisions (CurrentRevision and UpdateRevision), so this cleanup removes all revisions except CurrentRevision and UpdateRevision.
func ContainerRestarted ¶
ContainerRestarted return true when there is any container in the pod that gets restarted
func CreateControllerRevision ¶ added in v0.3.0
func CreateControllerRevision(ctx context.Context, client kubernetes.Interface, ms *workloadv1alpha1.ModelServing, revision string, templateData interface{}) (*appsv1.ControllerRevision, error)
CreateControllerRevision creates or retrieves a ControllerRevision for a specific revision. In ModelServing, we typically have at most two revisions: CurrentRevision and UpdateRevision.
func CreateHeadlessService ¶
func CreateHeadlessService(ctx context.Context, k8sClient kubernetes.Interface, ms *workloadv1alpha1.ModelServing, serviceSelector map[string]string, groupName, roleLabel string, roleIndex int) error
func DeepHashObject ¶
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(ms *workloadv1alpha1.ModelServing) int
func GenerateControllerRevisionName ¶ added in v0.3.0
func GenerateEntryPod ¶
func GenerateEntryPod(role workloadv1alpha1.Role, ms *workloadv1alpha1.ModelServing, groupName string, roleIndex int, revision string) *corev1.Pod
func GeneratePodName ¶ added in v0.3.0
func GenerateRoleID ¶
func GenerateWorkerPod ¶
func GenerateWorkerPod(role workloadv1alpha1.Role, ms *workloadv1alpha1.ModelServing, entryPod *corev1.Pod, groupName string, roleIndex, podIndex int, revision string) *corev1.Pod
func GetControllerRevision ¶ added in v0.3.0
func GetControllerRevision( ctx context.Context, client kubernetes.Interface, ms *workloadv1alpha1.ModelServing, revision string, ) (*appsv1.ControllerRevision, error)
GetControllerRevision retrieves a ControllerRevision by its revision string
func GetMaxUnavailable ¶ added in v0.3.0
func GetMaxUnavailable(mi *workloadv1alpha1.ModelServing) (int, error)
func GetNamespaceName ¶
func GetNamespaceName(obj metav1.Object) types.NamespacedName
func GetParentNameAndOrdinal ¶
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 GetRoleName ¶ added in v0.3.0
GetRoleName returns the role name of the resource.
func GetRolesFromControllerRevision ¶ added in v0.3.0
func GetRolesFromControllerRevision(cr *appsv1.ControllerRevision) ([]workloadv1alpha1.Role, error)
GetRolesFromControllerRevision extracts roles template data from a ControllerRevision
func GroupNameIndexFunc ¶
func IsOwnedByModelServingWithUID ¶ added in v0.3.0
IsOwnedByModelServingWithUID returns true when the object is owned by the ModelServing with the provided UID.
func IsPodFailed ¶
IsPodFailed returns true if pod has a Phase of PodFailed.
func IsPodRunningAndReady ¶
IsPodRunningAndReady returns true if pod is in the PodRunning Phase, if it has a condition of PodReady.
func IsPodTerminating ¶
IsPodTerminating returns true if pod's DeletionTimestamp has been set
func ObjectRevision ¶ added in v0.3.0
ObjectRevision returns the revision label of the resource.
func ParseModelServingFromRequest ¶
func ParseModelServingFromRequest(r *http.Request) (*admissionv1.AdmissionReview, *workloadv1alpha1.ModelServing, error)
ParseAdmissionRequest parses the HTTP request and extracts the AdmissionReview and ModelServing.
func RemoveRoleReplicasForRevision ¶
func RemoveRoleReplicasForRevision(ms *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 SendAdmissionResponse ¶
func SendAdmissionResponse(w http.ResponseWriter, admissionReview *admissionv1.AdmissionReview) error
SendAdmissionResponse sends the AdmissionReview response back to the client
func SetCondition ¶
func SetCondition(ms *workloadv1alpha1.ModelServing, progressingGroups, updatedGroups, currentGroups []int) bool
Types ¶
This section is empty.