Skip to content

Commit 506295a

Browse files
authored
API: Adds default status condition to InferencePool (#830)
* API: Adds default status condition to InferencePool Signed-off-by: Daneyon Hansen <[email protected]> * Adds default parent to pool status Signed-off-by: Daneyon Hansen <[email protected]> --------- Signed-off-by: Daneyon Hansen <[email protected]>
1 parent ea66dd2 commit 506295a

File tree

2 files changed

+37
-12
lines changed

2 files changed

+37
-12
lines changed

api/v1alpha2/inferencepool_types.go

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ type InferencePool struct {
3131
metav1.TypeMeta `json:",inline"`
3232
metav1.ObjectMeta `json:"metadata,omitempty"`
3333

34-
Spec InferencePoolSpec `json:"spec,omitempty"`
34+
Spec InferencePoolSpec `json:"spec,omitempty"`
35+
36+
// Status defines the observed state of InferencePool.
37+
//
38+
// +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"}}}}}
3539
Status InferencePoolStatus `json:"status,omitempty"`
3640
}
3741

@@ -150,14 +154,19 @@ const (
150154
FailClose ExtensionFailureMode = "FailClose"
151155
)
152156

153-
// InferencePoolStatus defines the observed state of InferencePool
157+
// InferencePoolStatus defines the observed state of InferencePool.
154158
type InferencePoolStatus struct {
155159
// Parents is a list of parent resources (usually Gateways) that are
156-
// associated with the route, and the status of the InferencePool with respect to
160+
// associated with the InferencePool, and the status of the InferencePool with respect to
157161
// each parent.
158162
//
159-
// A maximum of 32 Gateways will be represented in this list. An empty list
160-
// means the route has not been attached to any Gateway.
163+
// A maximum of 32 Gateways will be represented in this list. When the list contains
164+
// `kind: Status, name: default`, it indicates that the InferencePool is not
165+
// associated with any Gateway and a controller must perform the following:
166+
//
167+
// - Remove the parent when setting the "Accepted" condition.
168+
// - Add the parent when the controller will no longer manage the InferencePool
169+
// and no other parents exist.
161170
//
162171
// +kubebuilder:validation:MaxItems=32
163172
Parents []PoolStatus `json:"parent,omitempty"`
@@ -190,7 +199,7 @@ type InferencePoolConditionType string
190199
type InferencePoolReason string
191200

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

212-
// This reason is used with the "Accepted" condition when the Route has been
221+
// This reason is used with the "Accepted" condition when the InferencePool has been
213222
// accepted by the Gateway.
214223
InferencePoolReasonAccepted InferencePoolReason = "Accepted"
215224

@@ -219,7 +228,7 @@ const (
219228
InferencePoolReasonNotSupportedByGateway InferencePoolReason = "NotSupportedByGateway"
220229

221230
// This reason is used with the "Accepted" when a controller has not yet
222-
// reconciled the route.
231+
// reconciled the InferencePool.
223232
InferencePoolReasonPending InferencePoolReason = "Pending"
224233
)
225234

config/crd/bases/inference.networking.x-k8s.io_inferencepools.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,32 @@ spec:
134134
- targetPortNumber
135135
type: object
136136
status:
137-
description: InferencePoolStatus defines the observed state of InferencePool
137+
default:
138+
parent:
139+
- conditions:
140+
- lastTransitionTime: "1970-01-01T00:00:00Z"
141+
message: Waiting for controller
142+
reason: Pending
143+
status: Unknown
144+
type: Accepted
145+
parentRef:
146+
kind: Status
147+
name: default
148+
description: Status defines the observed state of InferencePool.
138149
properties:
139150
parent:
140151
description: |-
141152
Parents is a list of parent resources (usually Gateways) that are
142-
associated with the route, and the status of the InferencePool with respect to
153+
associated with the InferencePool, and the status of the InferencePool with respect to
143154
each parent.
144155
145-
A maximum of 32 Gateways will be represented in this list. An empty list
146-
means the route has not been attached to any Gateway.
156+
A maximum of 32 Gateways will be represented in this list. When the list contains
157+
`kind: Status, name: default`, it indicates that the InferencePool is not
158+
associated with any Gateway and a controller must perform the following:
159+
160+
- Remove the parent when setting the "Accepted" condition.
161+
- Add the parent when the controller will no longer manage the InferencePool
162+
and no other parents exist.
147163
items:
148164
description: PoolStatus defines the observed state of InferencePool
149165
from a Gateway.

0 commit comments

Comments
 (0)