@@ -29,15 +29,19 @@ import (
2929// +kubebuilder:storageversion
3030// +genclient
3131type InferencePool struct {
32- metav1.TypeMeta `json:",inline"`
32+ metav1.TypeMeta `json:",inline"`
33+
34+ // +optional
3335 metav1.ObjectMeta `json:"metadata,omitempty"`
3436
35- Spec InferencePoolSpec `json:"spec,omitempty"`
37+ // +required
38+ Spec InferencePoolSpec `json:"spec,omitzero"`
3639
3740 // Status defines the observed state of InferencePool.
3841 //
3942 // +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"}}}}}
40- Status InferencePoolStatus `json:"status,omitempty"`
43+ // +optional
44+ Status InferencePoolStatus `json:"status,omitzero"`
4145}
4246
4347// InferencePoolList contains a list of InferencePool.
@@ -59,30 +63,20 @@ type InferencePoolSpec struct {
5963 // with Kubernetes Service selectors, as some implementations may translate
6064 // this configuration into a Service resource.
6165 //
62- // +kubebuilder:validation:Required
63- Selector LabelSelector `json:"selector"`
64-
65- // TargetPorts defines the ports to access the selected model server Pods.
66- //
67- // +kubebuilder:validation:Required
68- // +kubebuilder:validation:MinItems=1
69- // +kubebuilder:validation:MaxItems=1
70- // +listType=map
71- // +listMapKey=number
72- TargetPorts []Port `json:"targetPorts"`
73-
74- // Extension configures an endpoint picker as an extension service.
75- ExtensionRef * Extension `json:"extensionRef,omitempty"`
76- }
66+ // +required
67+ Selector LabelSelector `json:"selector,omitempty,omitzero"`
7768
78- type Port struct {
79- // Number defines the port number to access the selected model server Pods.
69+ // TargetPortNumber defines the port number to access the selected model server Pods.
8070 // The number must be in the range 1 to 65535.
8171 //
8272 // +kubebuilder:validation:Minimum=1
8373 // +kubebuilder:validation:Maximum=65535
84- // +kubebuilder:validation:Required
85- Number PortNumber `json:"number"`
74+ // +required
75+ TargetPortNumber int32 `json:"targetPortNumber,omitempty"`
76+
77+ // Extension configures an endpoint picker as an extension service.
78+ // +optional
79+ ExtensionRef Extension `json:"extensionRef,omitempty,omitzero"`
8680}
8781
8882// Extension specifies how to configure an extension that runs the endpoint picker.
@@ -106,26 +100,26 @@ type Extension struct {
106100 //
107101 // +optional
108102 // +kubebuilder:default=Service
109- Kind * Kind `json:"kind,omitempty"`
103+ Kind Kind `json:"kind,omitempty"`
110104
111105 // Name is the name of the referent.
112106 //
113- // +kubebuilder:validation:Required
114- Name ObjectName `json:"name"`
107+ // +required
108+ Name ObjectName `json:"name,omitempty "`
115109
116110 // The port number on the service running the extension. When unspecified,
117111 // implementations SHOULD infer a default value of 9002 when the Kind is
118112 // Service.
119113 //
120114 // +optional
121- PortNumber * PortNumber `json:"portNumber,omitempty"`
115+ PortNumber PortNumber `json:"portNumber,omitempty"`
122116
123117 // Configures how the gateway handles the case when the extension is not responsive.
124118 // Defaults to failClose.
125119 //
126120 // +optional
127121 // +kubebuilder:default="FailClose"
128- FailureMode * ExtensionFailureMode `json:"failureMode"`
122+ FailureMode ExtensionFailureMode `json:"failureMode,omitempty "`
129123}
130124
131125// ExtensionFailureMode defines the options for how the gateway handles the case when the extension is not
@@ -141,6 +135,7 @@ const (
141135)
142136
143137// InferencePoolStatus defines the observed state of InferencePool.
138+ // +kubebuilder:validation:MinProperties=1
144139type InferencePoolStatus struct {
145140 // Parents is a list of parent resources (usually Gateways) that are
146141 // associated with the InferencePool, and the status of the InferencePool with respect to
@@ -155,14 +150,13 @@ type InferencePoolStatus struct {
155150 // and no other parents exist.
156151 //
157152 // +kubebuilder:validation:MaxItems=32
153+ // +optional
154+ // +listType=atomic
158155 Parents []PoolStatus `json:"parent,omitempty"`
159156}
160157
161158// PoolStatus defines the observed state of InferencePool from a Gateway.
162159type PoolStatus struct {
163- // GatewayRef indicates the gateway that observed state of InferencePool.
164- GatewayRef ParentGatewayReference `json:"parentRef"`
165-
166160 // Conditions track the state of the InferencePool.
167161 //
168162 // Known condition types are:
@@ -176,6 +170,10 @@ type PoolStatus struct {
176170 // +kubebuilder:validation:MaxItems=8
177171 // +kubebuilder:default={{type: "Accepted", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
178172 Conditions []metav1.Condition `json:"conditions,omitempty"`
173+
174+ // GatewayRef indicates the gateway that observed state of InferencePool.
175+ // +required
176+ GatewayRef ParentGatewayReference `json:"parentRef,omitzero"`
179177}
180178
181179// InferencePoolConditionType is a type of condition for the InferencePool
@@ -245,7 +243,7 @@ const (
245243 InferencePoolReasonResolvedRefs InferencePoolReason = "ResolvedRefs"
246244
247245 // This reason is used with the "ResolvedRefs" condition when the
248- // ExtensionRef is invalid in some way. This can include an unsupported kind
246+ // Extension is invalid in some way. This can include an unsupported kind
249247 // or API group, or a reference to a resource that can not be found.
250248 InferencePoolReasonInvalidExtensionRef InferencePoolReason = "InvalidExtensionRef"
251249)
@@ -257,21 +255,22 @@ type ParentGatewayReference struct {
257255 //
258256 // +optional
259257 // +kubebuilder:default="gateway.networking.k8s.io"
260- Group * Group `json:"group"`
258+ Group * Group `json:"group,omitempty "`
261259
262260 // Kind is kind of the referent. For example "Gateway".
263261 //
264262 // +optional
265263 // +kubebuilder:default=Gateway
266- Kind * Kind `json:"kind"`
264+ Kind Kind `json:"kind,omitempty "`
267265
268266 // Name is the name of the referent.
269- Name ObjectName `json:"name"`
267+ // +required
268+ Name ObjectName `json:"name,omitempty"`
270269
271270 // Namespace is the namespace of the referent. If not present,
272271 // the namespace of the referent is assumed to be the same as
273272 // the namespace of the referring object.
274273 //
275274 // +optional
276- Namespace * Namespace `json:"namespace,omitempty"`
275+ Namespace Namespace `json:"namespace,omitempty"`
277276}
0 commit comments