Skip to content

Commit bfa2326

Browse files
committed
Resolves initial review comments
Signed-off-by: Daneyon Hansen <[email protected]>
1 parent 9570482 commit bfa2326

File tree

9 files changed

+134
-153
lines changed

9 files changed

+134
-153
lines changed

api/v1/inferencepool_types.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,11 @@ type ParentStatus struct {
218218
// longer necessary.
219219
//
220220
// +required
221-
ControllerName ParentController `json:"controllerName"`
221+
//nolint:kubeapilinter // should not have omitempty since the field is required
222+
ControllerName ControllerName `json:"controllerName"`
222223
}
223224

224-
// ParentController is the name of a controller that manages ParentStatus. It must be a domain prefixed
225+
// ControllerName is the name of a controller that manages ParentStatus. It must be a domain prefixed
225226
// path.
226227
//
227228
// Valid values include:
@@ -236,7 +237,7 @@ type ParentStatus struct {
236237
// +kubebuilder:validation:MinLength=1
237238
// +kubebuilder:validation:MaxLength=253
238239
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$`
239-
type ParentController string
240+
type ControllerName string
240241

241242
// InferencePoolConditionType is a type of status condition for the InferencePool.
242243
type InferencePoolConditionType string
@@ -318,7 +319,8 @@ const (
318319
//
319320
// Possible reasons for this condition to be False are:
320321
//
321-
// * "Invalid"
322+
// * "NotRequested"
323+
// * "NotSupported"
322324
//
323325
// Controllers MAY raise this condition with other reasons, but should
324326
// prefer to use the reasons listed above to improve interoperability.
@@ -328,10 +330,15 @@ const (
328330
// condition is true.
329331
InferencePoolReasonExported InferencePoolReason = "Exported"
330332

331-
// InferencePoolReasonInvalid is a reason used with the "Exported" condition when the
332-
// InferencePool cannot be exported for some reason. A controller should provide
333-
// additional information in the condition message.
334-
InferencePoolReasonInvalid InferencePoolReason = "Invalid"
333+
// InferencePoolReasonNotRequested is a reason used with the "Exported" condition when the
334+
// condition is false and no export was requested by the InferencePool. This indicates a
335+
// deliberate non-action rather than an error.
336+
InferencePoolReasonNotRequested InferencePoolReason = "NotRequested"
337+
338+
// InferencePoolReasonNotSupported is a reason used with the "Exported" condition when the
339+
// condition is false and the export was requested but is not supported by the implementation.
340+
// Controllers should include details in the condition message.
341+
InferencePoolReasonNotSupported InferencePoolReason = "NotSupported"
335342
)
336343

337344
// ParentReference identifies an API object. It is used to associate the InferencePool with a

apix/v1alpha1/inferencepoolimport_types.go

Lines changed: 63 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ type InferencePoolImport struct {
3535
// +optional
3636
metav1.ObjectMeta `json:"metadata,omitempty"`
3737

38-
// Spec defines the desired state of the InferencePoolImport.
39-
//
40-
// +required
41-
Spec InferencePoolImportSpec `json:"spec,omitzero"`
42-
4338
// Status defines the observed state of the InferencePoolImport.
4439
//
4540
// +optional
@@ -56,90 +51,93 @@ type InferencePoolImportList struct {
5651
Items []InferencePoolImport `json:"items"`
5752
}
5853

59-
// InferencePoolImportSpec defines the desired state of the InferencePoolImport.
60-
type InferencePoolImportSpec struct {}
61-
6254
// InferencePoolImportStatus defines the observed state of the InferencePoolImport.
6355
type InferencePoolImportStatus struct {
64-
// Controllers is a list of controllers that are responsible for managing the InferencePoolImport.
65-
//
56+
// Controllers is a list of controllers that are responsible for managing the InferencePoolImport.
57+
//
6658
// +listType=map
6759
// +listMapKey=name
68-
// +kubebuilder:validation:MaxItems=8
69-
// +kubebuilder:validation:Required
70-
Controllers []ImportController `json:"controllers"`
60+
// +kubebuilder:validation:MaxItems=8
61+
// +kubebuilder:validation:Required
62+
Controllers []ImportController `json:"controllers"`
7163
}
7264

7365
// ImportController defines a controller that is responsible for managing the InferencePoolImport.
7466
type ImportController struct {
75-
// Name is a domain/path string that indicates the name of the controller that manages the
76-
// InferencePoolImport. Name corresponds to the GatewayClass controllerName field when the
77-
// controller will manage parents of type "Gateway". Otherwise, the name is implementation-specific.
78-
//
79-
// Example: "example.net/import-controller".
80-
//
81-
// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are valid Kubernetes
82-
// names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
83-
//
84-
// A controller MUST populate this field when writing status and ensure that entries to status
85-
// populated with their controller name are removed when they are no longer necessary.
86-
//
87-
// +required
88-
Name ControllerName `json:"name"`
89-
90-
// ExportingClusters is a list of clusters that exported the InferencePool(s) that back the
91-
// InferencePoolImport. Required when the controller is responsible for CRUD'ing the InferencePoolImport
92-
// from the exported InferencePool(s).
93-
//
94-
// +optional
95-
ExportingClusters []ExportingCluster `json:"exportingClusters,omitempty"`
96-
97-
// Parents is a list of parent resources, typically Gateways, that are associated with the
98-
// InferencePoolImport, and the status of the InferencePoolImport with respect to each parent.
67+
// Name is a domain/path string that indicates the name of the controller that manages the
68+
// InferencePoolImport. Name corresponds to the GatewayClass controllerName field when the
69+
// controller will manage parents of type "Gateway". Otherwise, the name is implementation-specific.
70+
//
71+
// Example: "example.net/import-controller".
72+
//
73+
// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are valid Kubernetes
74+
// names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
75+
//
76+
// A controller MUST populate this field when writing status and ensure that entries to status
77+
// populated with their controller name are removed when they are no longer necessary.
78+
//
79+
// +required
80+
Name ControllerName `json:"name"`
81+
82+
// ExportingClusters is a list of clusters that exported the InferencePool(s) that back the
83+
// InferencePoolImport. Required when the controller is responsible for CRUD'ing the InferencePoolImport
84+
// from the exported InferencePool(s).
85+
//
86+
// +optional
87+
ExportingClusters []ExportingCluster `json:"exportingClusters,omitempty"`
88+
89+
// Parents is a list of parent resources, typically Gateways, that are associated with the
90+
// InferencePoolImport, and the status of the InferencePoolImport with respect to each parent.
9991
//
10092
// Ancestor would be a more accurate name, but Parent is consistent with InferencePool terminology.
101-
//
102-
// Required when the controller manages the InferencePoolImport as an HTTPRoute backendRef. The controller
103-
// must add an entry for each parent it manages and remove the parent entry when the controller no longer
104-
// considers the InferencePoolImport to be associated with that parent.
105-
//
106-
// +optional
107-
// +listType=atomic
108-
Parents []v1.ParentStatus `json:"parents,omitempty"`
109-
110-
// Conditions track the state of the InferencePoolImport.
111-
//
112-
// Known condition types are:
113-
//
114-
// * "Accepted"
115-
//
116-
// +optional
117-
// +listType=map
118-
// +listMapKey=type
119-
// +kubebuilder:validation:MaxItems=8
120-
Conditions []metav1.Condition `json:"conditions,omitempty"`
93+
//
94+
// Required when the controller manages the InferencePoolImport as an HTTPRoute backendRef. The controller
95+
// must add an entry for each parent it manages and remove the parent entry when the controller no longer
96+
// considers the InferencePoolImport to be associated with that parent.
97+
//
98+
// +optional
99+
// +listType=atomic
100+
Parents []v1.ParentStatus `json:"parents,omitempty"`
101+
102+
// Conditions track the state of the InferencePoolImport.
103+
//
104+
// Known condition types are:
105+
//
106+
// * "Accepted"
107+
//
108+
// +optional
109+
// +listType=map
110+
// +listMapKey=type
111+
// +kubebuilder:validation:MaxItems=8
112+
Conditions []metav1.Condition `json:"conditions,omitempty"`
121113
}
122114

123115
// ControllerName is the name of a controller that manages a resource. It must be a domain prefixed path.
124116
//
125117
// Valid values include:
126118
//
127-
// * "example.com/bar"
119+
// - "example.com/bar"
128120
//
129121
// Invalid values include:
130122
//
131-
// * "example.com" - must include path
132-
// * "foo.example.com" - must include path
123+
// - "example.com" - must include path
124+
// - "foo.example.com" - must include path
133125
//
134126
// +kubebuilder:validation:MinLength=1
135127
// +kubebuilder:validation:MaxLength=253
136128
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$`
137129
type ControllerName string
138130

139-
// ExportingCluster defines a cluster that exported the InferencePool associated to this InferencePoolImport.
131+
// ClusterName is the name of a cluster that exported the InferencePool.
132+
//
133+
// +kubebuilder:validation:MinLength=1
134+
// +kubebuilder:validation:MaxLength=253
135+
type ClusterName string
136+
137+
// ExportingCluster defines a cluster that exported the InferencePool that backs this InferencePoolImport.
140138
type ExportingCluster struct {
141-
// Name of the exporting cluster (must be unique within the list).
142-
//
143-
// +kubebuilder:validation:Required
144-
Name string `json:"name"`
139+
// Name of the exporting cluster (must be unique within the list).
140+
//
141+
// +kubebuilder:validation:Required
142+
Name ClusterName `json:"name"`
145143
}

apix/v1alpha1/zz_generated.deepcopy.go

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/api/v1/parentstatus.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/apix/v1alpha1/exportingcluster.go

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/apix/v1alpha1/inferencepoolimport.go

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/inference.networking.x-k8s.io_inferencepoolimports.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ spec:
3838
type: string
3939
metadata:
4040
type: object
41-
spec:
42-
description: Spec defines the desired state of the InferencePoolImport.
43-
type: object
4441
status:
4542
description: Status defines the observed state of the InferencePoolImport.
4643
properties:
@@ -125,11 +122,13 @@ spec:
125122
from the exported InferencePool(s).
126123
items:
127124
description: ExportingCluster defines a cluster that exported
128-
the InferencePool associated to this InferencePoolImport.
125+
the InferencePool that backs this InferencePoolImport.
129126
properties:
130127
name:
131128
description: Name of the exporting cluster (must be unique
132129
within the list).
130+
maxLength: 253
131+
minLength: 1
133132
type: string
134133
required:
135134
- name
@@ -319,8 +318,6 @@ spec:
319318
required:
320319
- controllers
321320
type: object
322-
required:
323-
- spec
324321
type: object
325322
served: true
326323
storage: true

0 commit comments

Comments
 (0)