Skip to content

Commit fb23f19

Browse files
committed
adding required decorator, some more validation and defaulting
1 parent bcc6c84 commit fb23f19

4 files changed

+20
-0
lines changed

api/v1alpha1/inferencemodel_types.go

+8
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,21 @@ type InferenceModelSpec struct {
5151
// +kubebuilder:validation:MaxLength=253
5252
ModelName string `json:"modelName,omitempty"`
5353
// Defines how important it is to serve the model compared to other models referencing the same pool.
54+
//
5455
// +optional
56+
// +kubebuilder:default="Default"
5557
Criticality *Criticality `json:"criticality,omitempty"`
5658
// Allow multiple versions of a model for traffic splitting.
5759
// If not specified, the target model name is defaulted to the modelName parameter.
5860
// modelName is often in reference to a LoRA adapter.
61+
//
5962
// +optional
63+
// +kubebuilder:validation:MinItems=1
64+
// +kubebuilder:validation:MaxItems=10
6065
TargetModels []TargetModel `json:"targetModels,omitempty"`
6166
// Reference to the poolIt must exist in the same namespace.
67+
//
68+
// +kubebuilder:validation:Required
6269
PoolRef *LocalObjectReference `json:"poolRef,omitempty"`
6370
}
6471

@@ -74,6 +81,7 @@ type LocalObjectReference struct {
7481
Group string `json:"group,omitempty"`
7582

7683
// Kind is kind of the referent. For example "InferencePool".
84+
//
7785
// +optional
7886
// +kubebuilder:default="InferencePool"
7987
// +kubebuilder:validation:MinLength=1

api/v1alpha1/inferencepool_types.go

+4
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,17 @@ type InferencePoolSpec struct {
3131
// and will result in sub-optimal utilization.
3232
// In some cases, implementations may translate this to a Service selector, so this matches the simple
3333
// map used for Service selectors instead of the full Kubernetes LabelSelector type.
34+
//
35+
// +kubebuilder:validation:Required
3436
Selector map[LabelString]LabelString `json:"selector,omitempty"`
3537

3638
// TargetPort is the port number that the model servers within the pool expect
3739
// to recieve traffic from.
3840
// This maps to the TargetPort in: https://pkg.go.dev/k8s.io/api/core/v1#ServicePort
41+
//
3942
// +kubebuilder:validation:Minimum=0
4043
// +kubebuilder:validation:Maximum=65535
44+
// +kubebuilder:validation:Required
4145
TargetPort int32 `json:"targetPort,omitempty"`
4246
}
4347

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

+5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ spec:
5555
condition, one will be selected at random.
5656
properties:
5757
criticality:
58+
default: Default
5859
description: Defines how important it is to serve the model compared
5960
to other models referencing the same pool.
6061
enum:
@@ -124,7 +125,11 @@ spec:
124125
minimum: 0
125126
type: integer
126127
type: object
128+
maxItems: 10
129+
minItems: 1
127130
type: array
131+
required:
132+
- poolRef
128133
type: object
129134
status:
130135
description: InferenceModelStatus defines the observed state of InferenceModel

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

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ spec:
6363
maximum: 65535
6464
minimum: 0
6565
type: integer
66+
required:
67+
- selector
68+
- targetPort
6669
type: object
6770
status:
6871
description: InferencePoolStatus defines the observed state of InferencePool

0 commit comments

Comments
 (0)