@@ -38,11 +38,11 @@ type InferencePool struct {
38
38
// +required
39
39
Spec InferencePoolSpec `json:"spec,omitzero"`
40
40
41
- // Status defines the observed state of InferencePool.
41
+ // Status defines the observed state of the InferencePool.
42
42
//
43
- // +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"}}}}}
44
43
// +optional
45
- Status InferencePoolStatus `json:"status,omitzero"`
44
+ //nolint:kubeapilinter // ignore kubeapilinter to follow K8s conventions of optional but non-pointer.
45
+ Status InferencePoolStatus `json:"status,omitempty"`
46
46
}
47
47
48
48
// InferencePoolList contains a list of InferencePool.
@@ -125,85 +125,89 @@ type EndpointPickerRef struct {
125
125
//nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer here as 0 usually means all ports.
126
126
PortNumber * PortNumber `json:"portNumber,omitempty"`
127
127
128
- // Configures how the gateway handles the case when the extension is not responsive.
128
+ // Configures how the parent handles the case when the extension is not responsive.
129
129
// Defaults to failClose.
130
130
//
131
131
// +optional
132
132
// +kubebuilder:default="FailClose"
133
133
FailureMode ExtensionFailureMode `json:"failureMode,omitempty"`
134
134
}
135
135
136
- // ExtensionFailureMode defines the options for how the gateway handles the case when the extension is not
136
+ // ExtensionFailureMode defines the options for how the parent handles the case when the extension is not
137
137
// responsive.
138
138
// +kubebuilder:validation:Enum=FailOpen;FailClose
139
139
type ExtensionFailureMode string
140
140
141
141
const (
142
- // FailOpen specifies that the proxy should forward the request to an endpoint of its picking when the Endpoint Picker fails.
142
+ // FailOpen specifies that the proxy should forward the request to an endpoint of its picking when
143
+ // the Endpoint Picker fails.
143
144
FailOpen ExtensionFailureMode = "FailOpen"
144
145
// FailClose specifies that the proxy should drop the request when the Endpoint Picker fails.
145
146
FailClose ExtensionFailureMode = "FailClose"
146
147
)
147
148
148
- // InferencePoolStatus defines the observed state of InferencePool.
149
- // +kubebuilder:validation:MinProperties=1
149
+ // InferencePoolStatus defines the observed state of the InferencePool.
150
150
type InferencePoolStatus struct {
151
- // Parents is a list of parent resources (usually Gateways) that are
152
- // associated with the InferencePool, and the status of the InferencePool with respect to
153
- // each parent.
151
+ // Parents is a list of parent resources, typically Gateways, that are associated with
152
+ // the InferencePool, and the status of the InferencePool with respect to each parent.
154
153
//
155
- // A maximum of 32 Gateways will be represented in this list. When the list contains
156
- // `kind: Status, name: default`, it indicates that the InferencePool is not
157
- // associated with any Gateway and a controller must perform the following:
154
+ // A controller that manages the InferencePool, must add an entry for each parent it manages
155
+ // and remove the parent entry when the controller no longer considers the InferencePool to
156
+ // be associated with that parent.
158
157
//
159
- // - Remove the parent when setting the "Accepted" condition.
160
- // - Add the parent when the controller will no longer manage the InferencePool
161
- // and no other parents exist.
158
+ // A maximum of 32 parents will be represented in this list. When the list is empty,
159
+ // it indicates that the InferencePool is not associated with any parents.
162
160
//
163
161
// +kubebuilder:validation:MaxItems=32
164
162
// +optional
165
163
// +listType=atomic
166
- Parents []PoolStatus `json:"parent ,omitempty"`
164
+ Parents []ParentStatus `json:"parents ,omitempty"`
167
165
}
168
166
169
- // PoolStatus defines the observed state of InferencePool from a Gateway.
170
- type PoolStatus struct {
171
- // Conditions track the state of the InferencePool.
167
+ // ParentStatus defines the observed state of InferencePool from a Parent, i.e. Gateway.
168
+ type ParentStatus struct {
169
+ // Conditions is a list of status conditions that provide information about the observed
170
+ // state of the InferencePool. This field is required to be set by the controller that
171
+ // manages the InferencePool.
172
172
//
173
173
// Known condition types are:
174
174
//
175
175
// * "Accepted"
176
176
// * "ResolvedRefs"
177
177
//
178
- // +optional
178
+ // +required
179
179
// +listType=map
180
180
// +listMapKey=type
181
+ // +kubebuilder:validation:MinItems=1
181
182
// +kubebuilder:validation:MaxItems=8
182
- // +kubebuilder:default={{type: "Accepted", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
183
- Conditions []metav1.Condition `json:"conditions,omitempty "`
183
+ //nolint:kubeapilinter // ignore kubeapilinter here as we want conditions to be required.
184
+ Conditions []metav1.Condition `json:"conditions"`
184
185
185
- // GatewayRef indicates the gateway that observed state of InferencePool.
186
+ // ParentRef is used to identify the parent resource that this status
187
+ // is associated with. It is used to match the InferencePool with the parent
188
+ // resource, such as a Gateway.
189
+ //
186
190
// +required
187
- GatewayRef ParentGatewayReference `json:"parentRef,omitzero"`
191
+ ParentRef ParentReference `json:"parentRef,omitzero"`
188
192
}
189
193
190
- // InferencePoolConditionType is a type of condition for the InferencePool
194
+ // InferencePoolConditionType is a type of status condition for the InferencePool.
191
195
type InferencePoolConditionType string
192
196
193
- // InferencePoolReason is the reason for a given InferencePoolConditionType
197
+ // InferencePoolReason is the reason for a type of InferencePool status condition.
194
198
type InferencePoolReason string
195
199
196
200
const (
197
- // This condition indicates whether the InferencePool has been accepted or rejected
198
- // by a Gateway , and why.
201
+ // InferencePoolConditionAccepted is a type of condition that indicates whether
202
+ // the InferencePool has been accepted or rejected by a Parent , and why.
199
203
//
200
204
// Possible reasons for this condition to be True are:
201
205
//
202
206
// * "Accepted"
203
207
//
204
208
// Possible reasons for this condition to be False are:
205
209
//
206
- // * "NotSupportedByGateway "
210
+ // * "NotSupportedByParent "
207
211
// * "HTTPRouteNotAccepted"
208
212
//
209
213
// Possible reasons for this condition to be Unknown are:
@@ -214,18 +218,19 @@ const (
214
218
// prefer to use the reasons listed above to improve interoperability.
215
219
InferencePoolConditionAccepted InferencePoolConditionType = "Accepted"
216
220
217
- // This reason is used with the "Accepted" condition when the InferencePool has been
218
- // accepted by the Gateway .
221
+ // InferencePoolReasonAccepted is a reason used with the "Accepted" condition
222
+ // when the InferencePool has been accepted by the Parent .
219
223
InferencePoolReasonAccepted InferencePoolReason = "Accepted"
220
224
221
- // This reason is used with the "Accepted" condition when the InferencePool
222
- // has not been accepted by a Gateway because the Gateway does not support
223
- // InferencePool as a backend.
224
- InferencePoolReasonNotSupportedByGateway InferencePoolReason = "NotSupportedByGateway "
225
+ // InferencePoolReasonNotSupportedByParent is a reason used with the "Accepted"
226
+ // condition when the InferencePool has not been accepted by a Parent because
227
+ // the Parent does not support InferencePool as a backend.
228
+ InferencePoolReasonNotSupportedByParent InferencePoolReason = "NotSupportedByParent "
225
229
226
- // This reason is used with the "Accepted" condition when the InferencePool is
227
- // referenced by an HTTPRoute that has been rejected by the Gateway. The user
228
- // should inspect the status of the referring HTTPRoute for the specific reason.
230
+ // InferencePoolReasonHTTPRouteNotAccepted is a reason used with the "Accepted"
231
+ // condition when the InferencePool is referenced by an HTTPRoute that has been
232
+ // rejected by the Parent. The user should inspect the status of the referring
233
+ // HTTPRoute for the specific reason.
229
234
InferencePoolReasonHTTPRouteNotAccepted InferencePoolReason = "HTTPRouteNotAccepted"
230
235
231
236
// This reason is used with the "Accepted" when a controller has not yet
@@ -234,8 +239,8 @@ const (
234
239
)
235
240
236
241
const (
237
- // This condition indicates whether the controller was able to resolve all
238
- // the object references for the InferencePool.
242
+ // InferencePoolConditionResolvedRefs is a type of condition that indicates whether
243
+ // the controller was able to resolve all the object references for the InferencePool.
239
244
//
240
245
// Possible reasons for this condition to be True are:
241
246
//
@@ -249,39 +254,44 @@ const (
249
254
// prefer to use the reasons listed above to improve interoperability.
250
255
InferencePoolConditionResolvedRefs InferencePoolConditionType = "ResolvedRefs"
251
256
252
- // This reason is used with the "ResolvedRefs" condition when the condition
253
- // is true.
257
+ // InferencePoolReasonResolvedRefs is a reason used with the "ResolvedRefs"
258
+ // condition when the condition is true.
254
259
InferencePoolReasonResolvedRefs InferencePoolReason = "ResolvedRefs"
255
260
256
- // This reason is used with the "ResolvedRefs" condition when the
257
- // Extension is invalid in some way. This can include an unsupported kind
258
- // or API group, or a reference to a resource that can not be found.
261
+ // InferencePoolReasonInvalidExtensionRef is a reason used with the "ResolvedRefs"
262
+ // condition when the Extension is invalid in some way. This can include an
263
+ // unsupported kind or API group, or a reference to a resource that cannot be found.
259
264
InferencePoolReasonInvalidExtensionRef InferencePoolReason = "InvalidExtensionRef"
260
265
)
261
266
262
- // ParentGatewayReference identifies an API object including its namespace,
263
- // defaulting to Gateway.
264
- type ParentGatewayReference struct {
265
- // Group is the group of the referent.
267
+ // ParentReference identifies an API object. It is used to associate the InferencePool with a
268
+ // parent resource, such as a Gateway.
269
+ type ParentReference struct {
270
+ // Group is the group of the referent API object. When unspecified, the referent is assumed
271
+ // to be in the "gateway.networking.k8s.io" API group.
266
272
//
267
273
// +optional
268
274
// +kubebuilder:default="gateway.networking.k8s.io"
269
275
Group * Group `json:"group,omitempty"`
270
276
271
- // Kind is kind of the referent. For example "Gateway".
277
+ // Kind is the kind of the referent API object. When unspecified, the referent is assumed
278
+ // to be a "Gateway" kind.
272
279
//
273
280
// +optional
274
281
// +kubebuilder:default=Gateway
275
- Kind Kind `json:"kind,omitempty"`
282
+ //nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer here as empty means default value.
283
+ Kind * Kind `json:"kind,omitempty"`
276
284
277
- // Name is the name of the referent.
285
+ // Name is the name of the referent API object.
286
+ //
278
287
// +required
279
288
Name ObjectName `json:"name,omitempty"`
280
289
281
- // Namespace is the namespace of the referent. If not present ,
282
- // the namespace of the referent is assumed to be the same as
283
- // the namespace of the referring object.
290
+ // Namespace is the namespace of the referent API object. When unspecified ,
291
+ // the namespace of the referent is assumed to be the same as the namespace
292
+ // of the referring object.
284
293
//
285
294
// +optional
286
- Namespace Namespace `json:"namespace,omitempty"`
295
+ //nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer here as empty means same namespace.
296
+ Namespace * Namespace `json:"namespace,omitempty"`
287
297
}
0 commit comments