Repository: vllm-project/aibrix
File: api/orchestration/v1alpha1/podset_types.go (Go)

Code before:

// PodSetPhase represents the current lifecycle phase of a PodSet
// +enum
type PodSetPhase string

const (
	// PodSetPhasePending indicates the PodSet is being created
	PodSetPhasePending PodSetPhase = "Pending"

	// PodSetPhaseRunning indicates at least one pod is running
	PodSetPhaseRunning PodSetPhase = "Running"

	// PodSetPhaseReady indicates all pods in the set are ready
	PodSetPhaseReady PodSetPhase = "Ready"

	// PodSetPhaseFailed indicates the PodSet has failed
	PodSetPhaseFailed PodSetPhase = "Failed"
)

// PodRecreateStrategy defines how a PodSet handles pod recreation when pods are lost or fail.
// +enum
type PodRecreateStrategy string

const (
	// MissingOnlyPodRecreateStrategy means only missing pods (by index) will be recreated.
	MissingOnlyPodRecreateStrategy PodRecreateStrategy = "MissingOnly"

	// FullRecreatePodRecreateStrategy means if any pod is missing, all pods in the set will be deleted, and then all pods will be recreated.
	FullRecreatePodRecreateStrategy PodRecreateStrategy = "FullRecreate"
)

// PodSet conditions
const (
	// PodSetReady indicates whether all pods in the set are ready
	PodSetReady ConditionType = "Ready"

	// PodSetProgressing indicates the PodSet is in the process of updating
	PodSetProgressing ConditionType = "Progressing"
)

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// PodSet is the Schema for the podsets API
// PodSet represents an atomic group of pods that work together
// This is an internal API used by RoleSet controller when podGroupSize > 1
type PodSet struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   PodSetSpec   `json:"spec,omitempty"`

Review comment (bug):
our original case is carelessly delete pod. However, we have other failure cases like Failed、Evicted、NodeLost、CrashLoop etc.

I personally feel missing only is too restricted, could you use something like `Repair` or `ReplaceUnhealthy` instead? 

Code after:

// PodSetPhase represents the current lifecycle phase of a PodSet
// +enum
type PodSetPhase string

const (
	// PodSetPhasePending indicates the PodSet is being created
	PodSetPhasePending PodSetPhase = "Pending"

	// PodSetPhaseRunning indicates at least one pod is running
	PodSetPhaseRunning PodSetPhase = "Running"

	// PodSetPhaseReady indicates all pods in the set are ready
	PodSetPhaseReady PodSetPhase = "Ready"

	// PodSetPhaseFailed indicates the PodSet has failed
	PodSetPhaseFailed PodSetPhase = "Failed"
)

// PodRecoveryPolicy defines how a PodSet handles pod recreation when pods are lost or fail.
// +enum
type PodRecoveryPolicy string

const (
	// ReplaceUnhealthy means only missing pods (by index) will be recreated.
	ReplaceUnhealthy PodRecoveryPolicy = "ReplaceUnhealthy"

	// RecreatePodRecreateStrategy means if any pod is missing, all pods in the set will be deleted, and then all pods will be recreated.
	RecreatePodRecreateStrategy PodRecoveryPolicy = "Recreate"
)

// PodSet conditions
const (
	// PodSetReady indicates whether all pods in the set are ready
	PodSetReady ConditionType = "Ready"

	// PodSetProgressing indicates the PodSet is in the process of updating
	PodSetProgressing ConditionType = "Progressing"
)

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// PodSet is the Schema for the podsets API
// PodSet represents an atomic group of pods that work together
// This is an internal API used by RoleSet controller when podGroupSize > 1
type PodSet struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   PodSetSpec   `json:"spec,omitempty"`