@@ -38,11 +38,11 @@ type InferencePool struct {
3838 // +required
3939 Spec InferencePoolSpec `json:"spec,omitzero"`
4040
41- // Status defines the observed state of InferencePool.
41+ // Status defines the observed state of the InferencePool.
4242 //
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"}}}}}
4443 // +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"`
4646}
4747
4848// InferencePoolList contains a list of InferencePool.
@@ -127,85 +127,89 @@ type EndpointPickerRef struct {
127127 //nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer here as 0 usually means all ports.
128128 PortNumber * PortNumber `json:"portNumber,omitempty"`
129129
130- // Configures how the gateway handles the case when the extension is not responsive.
130+ // Configures how the parent handles the case when the extension is not responsive.
131131 // Defaults to failClose.
132132 //
133133 // +optional
134134 // +kubebuilder:default="FailClose"
135135 FailureMode ExtensionFailureMode `json:"failureMode,omitempty"`
136136}
137137
138- // ExtensionFailureMode defines the options for how the gateway handles the case when the extension is not
138+ // ExtensionFailureMode defines the options for how the parent handles the case when the extension is not
139139// responsive.
140140// +kubebuilder:validation:Enum=FailOpen;FailClose
141141type ExtensionFailureMode string
142142
143143const (
144- // FailOpen specifies that the proxy should forward the request to an endpoint of its picking when the Endpoint Picker fails.
144+ // FailOpen specifies that the proxy should forward the request to an endpoint of its picking when
145+ // the Endpoint Picker fails.
145146 FailOpen ExtensionFailureMode = "FailOpen"
146147 // FailClose specifies that the proxy should drop the request when the Endpoint Picker fails.
147148 FailClose ExtensionFailureMode = "FailClose"
148149)
149150
150- // InferencePoolStatus defines the observed state of InferencePool.
151- // +kubebuilder:validation:MinProperties=1
151+ // InferencePoolStatus defines the observed state of the InferencePool.
152152type InferencePoolStatus struct {
153- // Parents is a list of parent resources (usually Gateways) that are
154- // associated with the InferencePool, and the status of the InferencePool with respect to
155- // each parent.
153+ // Parents is a list of parent resources, typically Gateways, that are associated with
154+ // the InferencePool, and the status of the InferencePool with respect to each parent.
156155 //
157- // A maximum of 32 Gateways will be represented in this list. When the list contains
158- // `kind: Status, name: default`, it indicates that the InferencePool is not
159- // associated with any Gateway and a controller must perform the following:
156+ // A controller that manages the InferencePool, must add an entry for each parent it manages
157+ // and remove the parent entry when the controller no longer considers the InferencePool to
158+ // be associated with that parent.
160159 //
161- // - Remove the parent when setting the "Accepted" condition.
162- // - Add the parent when the controller will no longer manage the InferencePool
163- // and no other parents exist.
160+ // A maximum of 32 parents will be represented in this list. When the list is empty,
161+ // it indicates that the InferencePool is not associated with any parents.
164162 //
165163 // +kubebuilder:validation:MaxItems=32
166164 // +optional
167165 // +listType=atomic
168- Parents []PoolStatus `json:"parent ,omitempty"`
166+ Parents []ParentStatus `json:"parents ,omitempty"`
169167}
170168
171- // PoolStatus defines the observed state of InferencePool from a Gateway.
172- type PoolStatus struct {
173- // Conditions track the state of the InferencePool.
169+ // ParentStatus defines the observed state of InferencePool from a Parent, i.e. Gateway.
170+ type ParentStatus struct {
171+ // Conditions is a list of status conditions that provide information about the observed
172+ // state of the InferencePool. This field is required to be set by the controller that
173+ // manages the InferencePool.
174174 //
175175 // Known condition types are:
176176 //
177177 // * "Accepted"
178178 // * "ResolvedRefs"
179179 //
180- // +optional
180+ // +required
181181 // +listType=map
182182 // +listMapKey=type
183+ // +kubebuilder:validation:MinItems=1
183184 // +kubebuilder:validation:MaxItems=8
184- // +kubebuilder:default={{type: "Accepted", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
185- Conditions []metav1.Condition `json:"conditions,omitempty "`
185+ //nolint:kubeapilinter // ignore kubeapilinter here as we want conditions to be required.
186+ Conditions []metav1.Condition `json:"conditions"`
186187
187- // GatewayRef indicates the gateway that observed state of InferencePool.
188+ // ParentRef is used to identify the parent resource that this status
189+ // is associated with. It is used to match the InferencePool with the parent
190+ // resource, such as a Gateway.
191+ //
188192 // +required
189- GatewayRef ParentGatewayReference `json:"parentRef,omitzero"`
193+ ParentRef ParentReference `json:"parentRef,omitzero"`
190194}
191195
192- // InferencePoolConditionType is a type of condition for the InferencePool
196+ // InferencePoolConditionType is a type of status condition for the InferencePool.
193197type InferencePoolConditionType string
194198
195- // InferencePoolReason is the reason for a given InferencePoolConditionType
199+ // InferencePoolReason is the reason for a type of InferencePool status condition.
196200type InferencePoolReason string
197201
198202const (
199- // This condition indicates whether the InferencePool has been accepted or rejected
200- // by a Gateway , and why.
203+ // InferencePoolConditionAccepted is a type of condition that indicates whether
204+ // the InferencePool has been accepted or rejected by a Parent , and why.
201205 //
202206 // Possible reasons for this condition to be True are:
203207 //
204208 // * "Accepted"
205209 //
206210 // Possible reasons for this condition to be False are:
207211 //
208- // * "NotSupportedByGateway "
212+ // * "NotSupportedByParent "
209213 // * "HTTPRouteNotAccepted"
210214 //
211215 // Possible reasons for this condition to be Unknown are:
@@ -216,18 +220,19 @@ const (
216220 // prefer to use the reasons listed above to improve interoperability.
217221 InferencePoolConditionAccepted InferencePoolConditionType = "Accepted"
218222
219- // This reason is used with the "Accepted" condition when the InferencePool has been
220- // accepted by the Gateway .
223+ // InferencePoolReasonAccepted is a reason used with the "Accepted" condition
224+ // when the InferencePool has been accepted by the Parent .
221225 InferencePoolReasonAccepted InferencePoolReason = "Accepted"
222226
223- // This reason is used with the "Accepted" condition when the InferencePool
224- // has not been accepted by a Gateway because the Gateway does not support
225- // InferencePool as a backend.
226- InferencePoolReasonNotSupportedByGateway InferencePoolReason = "NotSupportedByGateway "
227+ // InferencePoolReasonNotSupportedByParent is a reason used with the "Accepted"
228+ // condition when the InferencePool has not been accepted by a Parent because
229+ // the Parent does not support InferencePool as a backend.
230+ InferencePoolReasonNotSupportedByParent InferencePoolReason = "NotSupportedByParent "
227231
228- // This reason is used with the "Accepted" condition when the InferencePool is
229- // referenced by an HTTPRoute that has been rejected by the Gateway. The user
230- // should inspect the status of the referring HTTPRoute for the specific reason.
232+ // InferencePoolReasonHTTPRouteNotAccepted is a reason used with the "Accepted"
233+ // condition when the InferencePool is referenced by an HTTPRoute that has been
234+ // rejected by the Parent. The user should inspect the status of the referring
235+ // HTTPRoute for the specific reason.
231236 InferencePoolReasonHTTPRouteNotAccepted InferencePoolReason = "HTTPRouteNotAccepted"
232237
233238 // This reason is used with the "Accepted" when a controller has not yet
@@ -236,8 +241,8 @@ const (
236241)
237242
238243const (
239- // This condition indicates whether the controller was able to resolve all
240- // the object references for the InferencePool.
244+ // InferencePoolConditionResolvedRefs is a type of condition that indicates whether
245+ // the controller was able to resolve all the object references for the InferencePool.
241246 //
242247 // Possible reasons for this condition to be True are:
243248 //
@@ -251,39 +256,44 @@ const (
251256 // prefer to use the reasons listed above to improve interoperability.
252257 InferencePoolConditionResolvedRefs InferencePoolConditionType = "ResolvedRefs"
253258
254- // This reason is used with the "ResolvedRefs" condition when the condition
255- // is true.
259+ // InferencePoolReasonResolvedRefs is a reason used with the "ResolvedRefs"
260+ // condition when the condition is true.
256261 InferencePoolReasonResolvedRefs InferencePoolReason = "ResolvedRefs"
257262
258- // This reason is used with the "ResolvedRefs" condition when the
259- // Extension is invalid in some way. This can include an unsupported kind
260- // or API group, or a reference to a resource that can not be found.
263+ // InferencePoolReasonInvalidExtensionRef is a reason used with the "ResolvedRefs"
264+ // condition when the Extension is invalid in some way. This can include an
265+ // unsupported kind or API group, or a reference to a resource that cannot be found.
261266 InferencePoolReasonInvalidExtensionRef InferencePoolReason = "InvalidExtensionRef"
262267)
263268
264- // ParentGatewayReference identifies an API object including its namespace,
265- // defaulting to Gateway.
266- type ParentGatewayReference struct {
267- // Group is the group of the referent.
269+ // ParentReference identifies an API object. It is used to associate the InferencePool with a
270+ // parent resource, such as a Gateway.
271+ type ParentReference struct {
272+ // Group is the group of the referent API object. When unspecified, the referent is assumed
273+ // to be in the "gateway.networking.k8s.io" API group.
268274 //
269275 // +optional
270276 // +kubebuilder:default="gateway.networking.k8s.io"
271277 Group * Group `json:"group,omitempty"`
272278
273- // Kind is kind of the referent. For example "Gateway".
279+ // Kind is the kind of the referent API object. When unspecified, the referent is assumed
280+ // to be a "Gateway" kind.
274281 //
275282 // +optional
276283 // +kubebuilder:default=Gateway
277- Kind Kind `json:"kind,omitempty"`
284+ //nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer here as empty means default value.
285+ Kind * Kind `json:"kind,omitempty"`
278286
279- // Name is the name of the referent.
287+ // Name is the name of the referent API object.
288+ //
280289 // +required
281290 Name ObjectName `json:"name,omitempty"`
282291
283- // Namespace is the namespace of the referent. If not present ,
284- // the namespace of the referent is assumed to be the same as
285- // the namespace of the referring object.
292+ // Namespace is the namespace of the referent API object. When unspecified ,
293+ // the namespace of the referent is assumed to be the same as the namespace
294+ // of the referring object.
286295 //
287296 // +optional
288- Namespace Namespace `json:"namespace,omitempty"`
297+ //nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer here as empty means same namespace.
298+ Namespace * Namespace `json:"namespace,omitempty"`
289299}
0 commit comments