Skip to content

Commit 3faf31f

Browse files
committed
[v0.1 API Review] Grammatical fixes and TypedCondition creation/defaulting (kubernetes-sigs#186)
* Feedback updates + code gen * Adding explanations for condition reasons * typo fix * Updating Condition Type * generated manifests * var name update
1 parent 1cef789 commit 3faf31f

4 files changed

+124
-6
lines changed

api/v1alpha1/inferencemodel_types.go

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const (
144144
// to exist at request time, the error is processed by the Inference Gateway
145145
// and emitted on the appropriate InferenceModel object.
146146
type TargetModel struct {
147-
// Name is the name of the adapter as expected by the ModelServer.
147+
// Name is the name of the adapter or base model, as expected by the ModelServer.
148148
//
149149
// +kubebuilder:validation:MaxLength=253
150150
// +kubebuilder:validation:Required
@@ -174,10 +174,54 @@ type TargetModel struct {
174174

175175
// InferenceModelStatus defines the observed state of InferenceModel
176176
type InferenceModelStatus struct {
177-
// Conditions track the state of the InferencePool.
177+
// Conditions track the state of the InferenceModel.
178+
//
179+
// Known condition types are:
180+
//
181+
// * "Accepted"
182+
//
183+
// +optional
184+
// +listType=map
185+
// +listMapKey=type
186+
// +kubebuilder:validation:MaxItems=8
187+
// +kubebuilder:default={{type: "Ready", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
178188
Conditions []metav1.Condition `json:"conditions,omitempty"`
179189
}
180190

191+
// InferenceModelConditionType is a type of condition for the InferenceModel.
192+
type InferenceModelConditionType string
193+
194+
// InferenceModelConditionReason is the reason for a given InferenceModelConditionType.
195+
type InferenceModelConditionReason string
196+
197+
const (
198+
// This condition indicates if the model config is accepted, and if not, why.
199+
//
200+
// Possible reasons for this condition to be True are:
201+
//
202+
// * "Accepted"
203+
//
204+
// Possible reasons for this condition to be False are:
205+
//
206+
// * "ModelNameInUse"
207+
//
208+
// Possible reasons for this condition to be Unknown are:
209+
//
210+
// * "Pending"
211+
//
212+
ModelConditionAccepted InferenceModelConditionType = "Accepted"
213+
214+
// Desired state. Model conforms to the state of the pool.
215+
ModelReasonAccepted InferenceModelConditionReason = "Accepted"
216+
217+
// This reason is used when a given ModelName already exists within the pool.
218+
// Details about naming conflict resolution are on the ModelName field itself.
219+
ModelReasonNameInUse InferenceModelConditionReason = "ModelNameInUse"
220+
221+
// This reason is the initial state, and indicates that the controller has not yet reconciled the InferenceModel.
222+
ModelReasonPending InferenceModelConditionReason = "Pending"
223+
)
224+
181225
func init() {
182226
SchemeBuilder.Register(&InferenceModel{}, &InferenceModelList{})
183227
}

api/v1alpha1/inferencepool_types.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ type InferencePoolSpec struct {
6868
//
6969
// LabelKey is the key of a label. This is used for validation
7070
// of maps. This matches the Kubernetes "qualified name" validation that is used for labels.
71+
// Labels are case sensitive, so: my-label and My-Label are considered distinct.
7172
//
7273
// Valid values include:
7374
//
@@ -106,9 +107,52 @@ type LabelValue string
106107
// InferencePoolStatus defines the observed state of InferencePool
107108
type InferencePoolStatus struct {
108109
// Conditions track the state of the InferencePool.
110+
//
111+
// Known condition types are:
112+
//
113+
// * "Ready"
114+
//
115+
// +optional
116+
// +listType=map
117+
// +listMapKey=type
118+
// +kubebuilder:validation:MaxItems=8
119+
// +kubebuilder:default={{type: "Ready", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
109120
Conditions []metav1.Condition `json:"conditions,omitempty"`
110121
}
111122

123+
// InferencePoolConditionType is a type of condition for the InferencePool
124+
type InferencePoolConditionType string
125+
126+
// InferencePoolConditionReason is the reason for a given InferencePoolConditionType
127+
type InferencePoolConditionReason string
128+
129+
const (
130+
// This condition indicates if the pool is ready to accept traffic, and if not, why.
131+
//
132+
// Possible reasons for this condition to be True are:
133+
//
134+
// * "Ready"
135+
//
136+
// Possible reasons for this condition to be False are:
137+
//
138+
// * "EndpointPickerNotHealthy"
139+
//
140+
// Possible reasons for this condition to be Unknown are:
141+
//
142+
// * "Pending"
143+
//
144+
PoolConditionReady InferencePoolConditionType = "Ready"
145+
146+
// Desired state. The pool and its components are initialized and ready for traffic.
147+
PoolReasonReady InferencePoolConditionReason = "Ready"
148+
149+
// This reason is used when the EPP has not yet passed health checks, or has started failing them.
150+
PoolReasonEPPNotHealthy InferencePoolConditionReason = "EndpointPickerNotHealthy"
151+
152+
// This reason is the initial state, and indicates that the controller has not yet reconciled this pool.
153+
PoolReasonPending InferencePoolConditionReason = "Pending"
154+
)
155+
112156
func init() {
113157
SchemeBuilder.Register(&InferencePool{}, &InferencePoolList{})
114158
}

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ spec:
116116
and emitted on the appropriate InferenceModel object.
117117
properties:
118118
name:
119-
description: Name is the name of the adapter as expected by
120-
the ModelServer.
119+
description: Name is the name of the adapter or base model,
120+
as expected by the ModelServer.
121121
maxLength: 253
122122
type: string
123123
weight:
@@ -154,7 +154,18 @@ spec:
154154
description: InferenceModelStatus defines the observed state of InferenceModel
155155
properties:
156156
conditions:
157-
description: Conditions track the state of the InferencePool.
157+
default:
158+
- lastTransitionTime: "1970-01-01T00:00:00Z"
159+
message: Waiting for controller
160+
reason: Pending
161+
status: Unknown
162+
type: Ready
163+
description: |-
164+
Conditions track the state of the InferenceModel.
165+
166+
Known condition types are:
167+
168+
* "Accepted"
158169
items:
159170
description: Condition contains details for one aspect of the current
160171
state of this API Resource.
@@ -209,7 +220,11 @@ spec:
209220
- status
210221
- type
211222
type: object
223+
maxItems: 8
212224
type: array
225+
x-kubernetes-list-map-keys:
226+
- type
227+
x-kubernetes-list-type: map
213228
type: object
214229
type: object
215230
served: true

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,18 @@ spec:
8181
description: InferencePoolStatus defines the observed state of InferencePool
8282
properties:
8383
conditions:
84-
description: Conditions track the state of the InferencePool.
84+
default:
85+
- lastTransitionTime: "1970-01-01T00:00:00Z"
86+
message: Waiting for controller
87+
reason: Pending
88+
status: Unknown
89+
type: Ready
90+
description: |-
91+
Conditions track the state of the InferencePool.
92+
93+
Known condition types are:
94+
95+
* "Ready"
8596
items:
8697
description: Condition contains details for one aspect of the current
8798
state of this API Resource.
@@ -136,7 +147,11 @@ spec:
136147
- status
137148
- type
138149
type: object
150+
maxItems: 8
139151
type: array
152+
x-kubernetes-list-map-keys:
153+
- type
154+
x-kubernetes-list-type: map
140155
type: object
141156
type: object
142157
served: true

0 commit comments

Comments
 (0)