Skip to content

[v0.1 API Review] Grammatical fixes and TypedCondition creation/defaulting #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions api/v1alpha1/inferencemodel_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const (
// to exist at request time, the error is processed by the Inference Gateway
// and emitted on the appropriate InferenceModel object.
type TargetModel struct {
// Name is the name of the adapter as expected by the ModelServer.
// Name is the name of the adapter or base model, as expected by the ModelServer.
//
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Required
Expand Down Expand Up @@ -174,10 +174,54 @@ type TargetModel struct {

// InferenceModelStatus defines the observed state of InferenceModel
type InferenceModelStatus struct {
// Conditions track the state of the InferencePool.
// Conditions track the state of the InferenceModel.
//
// Known condition types are:
//
// * "Accepted"
//
// +optional
// +listType=map
// +listMapKey=type
// +kubebuilder:validation:MaxItems=8
// +kubebuilder:default={{type: "Ready", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// InferenceModelConditionType is a type of condition for the InferenceModel.
type InferenceModelConditionType string

// InferenceModelConditionReason is the reason for a given InferenceModelConditionType.
type InferenceModelConditionReason string

const (
// This condition indicates if the model config is accepted, and if not, why.
//
// Possible reasons for this condition to be True are:
//
// * "Accepted"
//
// Possible reasons for this condition to be False are:
//
// * "ModelNameInUse"
//
// Possible reasons for this condition to be Unknown are:
//
// * "Pending"
//
ModelConditionReady InferenceModelConditionType = "Accepted"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update variable names too


// Desired state. Model conforms to the state of the pool.
ModelReasonReady InferenceModelConditionReason = "Accepted"

// This reason is used when a given ModelName already exists within the pool.
// Details about naming conflict resolution are on the ModelName field itself.
ModelReasonNameInUse InferenceModelConditionReason = "ModelNameInUse"

// This reason is the initial state, and indicates that the controller has not yet reconciled the InferenceModel.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect that an InferenceModel status to revert back to Pending from Ready? or is that left to the implementation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt it would ever go from Accepted back to Pending. But leaving it up to the implementation is fine with me

ModelReasonPending InferenceModelConditionReason = "Pending"
)

func init() {
SchemeBuilder.Register(&InferenceModel{}, &InferenceModelList{})
}
44 changes: 44 additions & 0 deletions api/v1alpha1/inferencepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type InferencePoolSpec struct {
//
// LabelKey is the key of a label. This is used for validation
// of maps. This matches the Kubernetes "qualified name" validation that is used for labels.
// Labels are case sensitive, so: my-label and My-Label are considered distinct.
//
// Valid values include:
//
Expand Down Expand Up @@ -106,9 +107,52 @@ type LabelValue string
// InferencePoolStatus defines the observed state of InferencePool
type InferencePoolStatus struct {
// Conditions track the state of the InferencePool.
//
// Known condition types are:
//
// * "Ready"
//
// +optional
// +listType=map
// +listMapKey=type
// +kubebuilder:validation:MaxItems=8
// +kubebuilder:default={{type: "Ready", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// InferencePoolConditionType is a type of condition for the InferencePool
type InferencePoolConditionType string

// InferencePoolConditionReason is the reason for a given InferencePoolConditionType
type InferencePoolConditionReason string

const (
// This condition indicates if the pool is ready to accept traffic, and if not, why.
//
// Possible reasons for this condition to be True are:
//
// * "Ready"
//
// Possible reasons for this condition to be False are:
//
// * "EndpointPickerNotHealthy"
//
// Possible reasons for this condition to be Unknown are:
//
// * "Pending"
//
PoolConditionReady InferencePoolConditionType = "Ready"

// Desired state. The pool and its components are initialized and ready for traffic.
PoolReasonReady InferencePoolConditionReason = "Ready"

// This reason is used when the EPP has not yet passed health checks, or has started failing them.
PoolReasonEPPNotHealthy InferencePoolConditionReason = "EndpointPickerNotHealthy"

// This reason is the initial state, and indicates that the controller has not yet reconciled this pool.
PoolReasonPending InferencePoolConditionReason = "Pending"
)

func init() {
SchemeBuilder.Register(&InferencePool{}, &InferencePoolList{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ spec:
and emitted on the appropriate InferenceModel object.
properties:
name:
description: Name is the name of the adapter as expected by
the ModelServer.
description: Name is the name of the adapter or base model,
as expected by the ModelServer.
maxLength: 253
type: string
weight:
Expand Down Expand Up @@ -154,7 +154,18 @@ spec:
description: InferenceModelStatus defines the observed state of InferenceModel
properties:
conditions:
description: Conditions track the state of the InferencePool.
default:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: Waiting for controller
reason: Pending
status: Unknown
type: Ready
description: |-
Conditions track the state of the InferenceModel.

Known condition types are:

* "Accepted"
items:
description: Condition contains details for one aspect of the current
state of this API Resource.
Expand Down Expand Up @@ -209,7 +220,11 @@ spec:
- status
- type
type: object
maxItems: 8
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,18 @@ spec:
description: InferencePoolStatus defines the observed state of InferencePool
properties:
conditions:
description: Conditions track the state of the InferencePool.
default:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: Waiting for controller
reason: Pending
status: Unknown
type: Ready
description: |-
Conditions track the state of the InferencePool.

Known condition types are:

* "Ready"
items:
description: Condition contains details for one aspect of the current
state of this API Resource.
Expand Down Expand Up @@ -136,7 +147,11 @@ spec:
- status
- type
type: object
maxItems: 8
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
type: object
type: object
served: true
Expand Down