Skip to content

API: Adds default status condition to InferencePool #830

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 2 commits into from
Jun 21, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
25 changes: 17 additions & 8 deletions api/v1alpha2/inferencepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ type InferencePool struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec InferencePoolSpec `json:"spec,omitempty"`
Spec InferencePoolSpec `json:"spec,omitempty"`

// Status defines the observed state of InferencePool.
//
// +kubebuilder:default={parent: {{parentRef: {kind: "Status", name: "default"}, conditions: {{type: "Accepted", status: "Unknown", reason: "Pending", message: "Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}}}}
Copy link
Member

Choose a reason for hiding this comment

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

@zetxqx I think we'll likely need some conformance test coverage here to ensure that controllers drop this condition from status. It's possible that our existing conformance tests will already cover this though.

Copy link
Contributor

Choose a reason for hiding this comment

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

ack!

Status InferencePoolStatus `json:"status,omitempty"`
}

Expand Down Expand Up @@ -150,14 +154,19 @@ const (
FailClose ExtensionFailureMode = "FailClose"
)

// InferencePoolStatus defines the observed state of InferencePool
// InferencePoolStatus defines the observed state of InferencePool.
type InferencePoolStatus struct {
// Parents is a list of parent resources (usually Gateways) that are
// associated with the route, and the status of the InferencePool with respect to
// associated with the InferencePool, and the status of the InferencePool with respect to
// each parent.
//
// A maximum of 32 Gateways will be represented in this list. An empty list
// means the route has not been attached to any Gateway.
// A maximum of 32 Gateways will be represented in this list. When the list contains
// `kind: Status, name: default`, it indicates that the InferencePool is not
// associated with any Gateway and a controller must perform the following:
//
// - Remove the parent when setting the "Accepted" condition.
// - Add the parent when the controller will no longer manage the InferencePool
// and no other parents exist.
//
// +kubebuilder:validation:MaxItems=32
Parents []PoolStatus `json:"parent,omitempty"`
Expand Down Expand Up @@ -190,7 +199,7 @@ type InferencePoolConditionType string
type InferencePoolReason string

const (
// This condition indicates whether the route has been accepted or rejected
// This condition indicates whether the InferencePool has been accepted or rejected
// by a Gateway, and why.
//
// Possible reasons for this condition to be True are:
Expand All @@ -209,7 +218,7 @@ const (
// prefer to use the reasons listed above to improve interoperability.
InferencePoolConditionAccepted InferencePoolConditionType = "Accepted"

// This reason is used with the "Accepted" condition when the Route has been
// This reason is used with the "Accepted" condition when the InferencePool has been
// accepted by the Gateway.
InferencePoolReasonAccepted InferencePoolReason = "Accepted"

Expand All @@ -219,7 +228,7 @@ const (
InferencePoolReasonNotSupportedByGateway InferencePoolReason = "NotSupportedByGateway"

// This reason is used with the "Accepted" when a controller has not yet
// reconciled the route.
// reconciled the InferencePool.
InferencePoolReasonPending InferencePoolReason = "Pending"
)

Expand Down
24 changes: 20 additions & 4 deletions config/crd/bases/inference.networking.x-k8s.io_inferencepools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,32 @@ spec:
- targetPortNumber
type: object
status:
description: InferencePoolStatus defines the observed state of InferencePool
default:
parent:
- conditions:
- lastTransitionTime: "1970-01-01T00:00:00Z"
message: Waiting for controller
reason: Pending
status: Unknown
type: Accepted
parentRef:
kind: Status
name: default
description: Status defines the observed state of InferencePool.
properties:
parent:
description: |-
Parents is a list of parent resources (usually Gateways) that are
associated with the route, and the status of the InferencePool with respect to
associated with the InferencePool, and the status of the InferencePool with respect to
each parent.

A maximum of 32 Gateways will be represented in this list. An empty list
means the route has not been attached to any Gateway.
A maximum of 32 Gateways will be represented in this list. When the list contains
`kind: Status, name: default`, it indicates that the InferencePool is not
associated with any Gateway and a controller must perform the following:

- Remove the parent when setting the "Accepted" condition.
- Add the parent when the controller will no longer manage the InferencePool
and no other parents exist.
items:
description: PoolStatus defines the observed state of InferencePool
from a Gateway.
Expand Down