@@ -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,19 +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"`
66+ // +required
67+ Selector LabelSelector `json:"selector,omitempty,omitzero "`
6468
6569 // TargetPortNumber defines the port number to access the selected model server Pods.
6670 // The number must be in the range 1 to 65535.
6771 //
6872 // +kubebuilder:validation:Minimum=1
6973 // +kubebuilder:validation:Maximum=65535
70- // +kubebuilder:validation:Required
71- TargetPortNumber int32 `json:"targetPortNumber"`
74+ // +required
75+ TargetPortNumber int32 `json:"targetPortNumber,omitempty "`
7276
7377 // Extension configures an endpoint picker as an extension service.
74- ExtensionRef * Extension `json:"extensionRef,omitempty"`
78+ // +optional
79+ ExtensionRef Extension `json:"extensionRef,omitempty,omitzero"`
7580}
7681
7782// Extension specifies how to configure an extension that runs the endpoint picker.
@@ -95,26 +100,26 @@ type Extension struct {
95100 //
96101 // +optional
97102 // +kubebuilder:default=Service
98- Kind * Kind `json:"kind,omitempty"`
103+ Kind Kind `json:"kind,omitempty"`
99104
100105 // Name is the name of the referent.
101106 //
102- // +kubebuilder:validation:Required
103- Name ObjectName `json:"name"`
107+ // +required
108+ Name ObjectName `json:"name,omitempty "`
104109
105110 // The port number on the service running the extension. When unspecified,
106111 // implementations SHOULD infer a default value of 9002 when the Kind is
107112 // Service.
108113 //
109114 // +optional
110- PortNumber * PortNumber `json:"portNumber,omitempty"`
115+ PortNumber PortNumber `json:"portNumber,omitempty"`
111116
112117 // Configures how the gateway handles the case when the extension is not responsive.
113118 // Defaults to failClose.
114119 //
115120 // +optional
116121 // +kubebuilder:default="FailClose"
117- FailureMode * ExtensionFailureMode `json:"failureMode"`
122+ FailureMode ExtensionFailureMode `json:"failureMode,omitempty "`
118123}
119124
120125// ExtensionFailureMode defines the options for how the gateway handles the case when the extension is not
@@ -130,6 +135,7 @@ const (
130135)
131136
132137// InferencePoolStatus defines the observed state of InferencePool.
138+ // +kubebuilder:validation:MinProperties=1
133139type InferencePoolStatus struct {
134140 // Parents is a list of parent resources (usually Gateways) that are
135141 // associated with the InferencePool, and the status of the InferencePool with respect to
@@ -144,14 +150,13 @@ type InferencePoolStatus struct {
144150 // and no other parents exist.
145151 //
146152 // +kubebuilder:validation:MaxItems=32
153+ // +optional
154+ // +listType=atomic
147155 Parents []PoolStatus `json:"parent,omitempty"`
148156}
149157
150158// PoolStatus defines the observed state of InferencePool from a Gateway.
151159type PoolStatus struct {
152- // GatewayRef indicates the gateway that observed state of InferencePool.
153- GatewayRef ParentGatewayReference `json:"parentRef"`
154-
155160 // Conditions track the state of the InferencePool.
156161 //
157162 // Known condition types are:
@@ -165,6 +170,10 @@ type PoolStatus struct {
165170 // +kubebuilder:validation:MaxItems=8
166171 // +kubebuilder:default={{type: "Accepted", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
167172 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"`
168177}
169178
170179// InferencePoolConditionType is a type of condition for the InferencePool
@@ -246,21 +255,22 @@ type ParentGatewayReference struct {
246255 //
247256 // +optional
248257 // +kubebuilder:default="gateway.networking.k8s.io"
249- Group * Group `json:"group"`
258+ Group * Group `json:"group,omitempty "`
250259
251260 // Kind is kind of the referent. For example "Gateway".
252261 //
253262 // +optional
254263 // +kubebuilder:default=Gateway
255- Kind * Kind `json:"kind"`
264+ Kind Kind `json:"kind,omitempty "`
256265
257266 // Name is the name of the referent.
258- Name ObjectName `json:"name"`
267+ // +required
268+ Name ObjectName `json:"name,omitempty"`
259269
260270 // Namespace is the namespace of the referent. If not present,
261271 // the namespace of the referent is assumed to be the same as
262272 // the namespace of the referring object.
263273 //
264274 // +optional
265- Namespace * Namespace `json:"namespace,omitempty"`
275+ Namespace Namespace `json:"namespace,omitempty"`
266276}
0 commit comments