@@ -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.
@@ -125,85 +125,89 @@ type EndpointPickerRef struct {
125125 //nolint:kubeapilinter // ignore kubeapilinter here as we want to use pointer here as 0 usually means all ports.
126126 PortNumber * PortNumber `json:"portNumber,omitempty"`
127127
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.
129129 // Defaults to failClose.
130130 //
131131 // +optional
132132 // +kubebuilder:default="FailClose"
133133 FailureMode ExtensionFailureMode `json:"failureMode,omitempty"`
134134}
135135
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
137137// responsive.
138138// +kubebuilder:validation:Enum=FailOpen;FailClose
139139type ExtensionFailureMode string
140140
141141const (
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.
143144 FailOpen ExtensionFailureMode = "FailOpen"
144145 // FailClose specifies that the proxy should drop the request when the Endpoint Picker fails.
145146 FailClose ExtensionFailureMode = "FailClose"
146147)
147148
148- // InferencePoolStatus defines the observed state of InferencePool.
149- // +kubebuilder:validation:MinProperties=1
149+ // InferencePoolStatus defines the observed state of the InferencePool.
150150type 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.
154153 //
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.
158157 //
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.
162160 //
163161 // +kubebuilder:validation:MaxItems=32
164162 // +optional
165163 // +listType=atomic
166- Parents []PoolStatus `json:"parent ,omitempty"`
164+ Parents []ParentStatus `json:"parents ,omitempty"`
167165}
168166
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.
172172 //
173173 // Known condition types are:
174174 //
175175 // * "Accepted"
176176 // * "ResolvedRefs"
177177 //
178- // +optional
178+ // +required
179179 // +listType=map
180180 // +listMapKey=type
181+ // +kubebuilder:validation:MinItems=1
181182 // +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"`
184185
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+ //
186190 // +required
187- GatewayRef ParentGatewayReference `json:"parentRef,omitzero"`
191+ ParentRef ParentReference `json:"parentRef,omitzero"`
188192}
189193
190- // InferencePoolConditionType is a type of condition for the InferencePool
194+ // InferencePoolConditionType is a type of status condition for the InferencePool.
191195type InferencePoolConditionType string
192196
193- // InferencePoolReason is the reason for a given InferencePoolConditionType
197+ // InferencePoolReason is the reason for a type of InferencePool status condition.
194198type InferencePoolReason string
195199
196200const (
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.
199203 //
200204 // Possible reasons for this condition to be True are:
201205 //
202206 // * "Accepted"
203207 //
204208 // Possible reasons for this condition to be False are:
205209 //
206- // * "NotSupportedByGateway "
210+ // * "NotSupportedByParent "
207211 // * "HTTPRouteNotAccepted"
208212 //
209213 // Possible reasons for this condition to be Unknown are:
@@ -214,18 +218,19 @@ const (
214218 // prefer to use the reasons listed above to improve interoperability.
215219 InferencePoolConditionAccepted InferencePoolConditionType = "Accepted"
216220
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 .
219223 InferencePoolReasonAccepted InferencePoolReason = "Accepted"
220224
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 "
225229
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.
229234 InferencePoolReasonHTTPRouteNotAccepted InferencePoolReason = "HTTPRouteNotAccepted"
230235
231236 // This reason is used with the "Accepted" when a controller has not yet
@@ -234,8 +239,8 @@ const (
234239)
235240
236241const (
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.
239244 //
240245 // Possible reasons for this condition to be True are:
241246 //
@@ -249,39 +254,44 @@ const (
249254 // prefer to use the reasons listed above to improve interoperability.
250255 InferencePoolConditionResolvedRefs InferencePoolConditionType = "ResolvedRefs"
251256
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.
254259 InferencePoolReasonResolvedRefs InferencePoolReason = "ResolvedRefs"
255260
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.
259264 InferencePoolReasonInvalidExtensionRef InferencePoolReason = "InvalidExtensionRef"
260265)
261266
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.
266272 //
267273 // +optional
268274 // +kubebuilder:default="gateway.networking.k8s.io"
269275 Group * Group `json:"group,omitempty"`
270276
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.
272279 //
273280 // +optional
274281 // +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"`
276284
277- // Name is the name of the referent.
285+ // Name is the name of the referent API object.
286+ //
278287 // +required
279288 Name ObjectName `json:"name,omitempty"`
280289
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.
284293 //
285294 // +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"`
287297}
0 commit comments