Skip to content

Commit 20adb99

Browse files
committed
Feedback updates
1 parent e44ce80 commit 20adb99

10 files changed

+95
-48
lines changed

api/v1alpha1/inferencemodel_types.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ type InferenceModelSpec struct {
6060
// modelName is often in reference to a LoRA adapter.
6161
//
6262
// +optional
63-
// +kubebuilder:validation:MinItems=1
6463
// +kubebuilder:validation:MaxItems=10
6564
TargetModels []TargetModel `json:"targetModels,omitempty"`
6665
// Reference to the inference pool, the pool must exist in the same namespace.
@@ -132,7 +131,7 @@ type TargetModel struct {
132131
// +kubebuilder:default=1
133132
// +kubebuilder:validation:Minimum=0
134133
// +kubebuilder:validation:Maximum=1000000
135-
Weight int `json:"weight,omitempty"`
134+
Weight int32 `json:"weight,omitempty"`
136135
}
137136

138137
// InferenceModelStatus defines the observed state of InferenceModel

api/v1alpha1/inferencepool_types.go

+42-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type InferencePoolSpec struct {
3333
// map used for Service selectors instead of the full Kubernetes LabelSelector type.
3434
//
3535
// +kubebuilder:validation:Required
36-
Selector map[LabelString]LabelString `json:"selector,omitempty"`
36+
Selector map[LabelKey]LabelValue `json:"selector,omitempty"`
3737

3838
// TargetPort is the port number that the model servers within the pool expect
3939
// to recieve traffic from.
@@ -42,22 +42,56 @@ type InferencePoolSpec struct {
4242
// +kubebuilder:validation:Minimum=0
4343
// +kubebuilder:validation:Maximum=65535
4444
// +kubebuilder:validation:Required
45-
TargetPort int32 `json:"targetPort,omitempty"`
45+
TargetPortNumber int32 `json:"targetPortNumber,omitempty"`
4646
}
4747

48+
// Originally copied from: https://github.com/kubernetes-sigs/gateway-api/blob/99a3934c6bc1ce0874f3a4c5f20cafd8977ffcb4/apis/v1/shared_types.go#L694-L731
49+
// Duplicated as to not take an unexpected dependency on gw's API.
50+
//
51+
// LabelKey is the key of a label. This is used for validation
52+
// of maps. This matches the Kubernetes "qualified name" validation that is used for labels.
53+
//
54+
// Valid values include:
55+
//
56+
// * example
57+
// * example.com
58+
// * example.com/path
59+
// * example.com/path.html
60+
//
61+
// Invalid values include:
62+
//
63+
// * example~ - "~" is an invalid character
64+
// * example.com. - can not start or end with "."
65+
//
66+
// +kubebuilder:validation:MinLength=1
67+
// +kubebuilder:validation:MaxLength=253
68+
// +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][-A-Za-z0-9_.]{0,61})?[A-Za-z0-9]$`
69+
type LabelKey string
70+
71+
// LabelValue is the value of a label. This is used for validation
72+
// of maps. This matches the Kubernetes label validation rules:
73+
// * must be 63 characters or less (can be empty),
74+
// * unless empty, must begin and end with an alphanumeric character ([a-z0-9A-Z]),
75+
// * could contain dashes (-), underscores (_), dots (.), and alphanumerics between.
76+
//
77+
// Valid values include:
78+
//
79+
// * MyValue
80+
// * my.name
81+
// * 123-my-value
82+
//
83+
// +kubebuilder:validation:MinLength=0
84+
// +kubebuilder:validation:MaxLength=63
85+
// +kubebuilder:validation:Pattern=`^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$`
86+
type LabelValue string
87+
4888
// InferencePoolStatus defines the observed state of InferencePool
4989
type InferencePoolStatus struct {
5090

5191
// Conditions track the state of the InferencePool.
5292
Conditions []metav1.Condition `json:"conditions,omitempty"`
5393
}
5494

55-
// This indirection allows us to validate this type, since there is not native map validation support
56-
//
57-
// +kubebuilder:validation:MinLength=1
58-
// +kubebuilder:validation:MaxLength=63
59-
type LabelString string
60-
6195
// +kubebuilder:object:root=true
6296
// +kubebuilder:subresource:status
6397
// +genclient

api/v1alpha1/zz_generated.deepcopy.go

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/api/v1alpha1/inferencemodelspec.go

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/api/v1alpha1/inferencepoolspec.go

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/api/v1alpha1/localobjectreference.go renamed to client-go/applyconfiguration/api/v1alpha1/poolobjectreference.go

+8-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/api/v1alpha1/targetmodel.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client-go/applyconfiguration/utils.go

+2-2
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_inferencemodels.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ spec:
7676
maxLength: 253
7777
type: string
7878
poolRef:
79-
description: Reference to the poolIt must exist in the same namespace.
79+
description: Reference to the inference pool, the pool must exist
80+
in the same namespace.
8081
properties:
8182
group:
8283
default: inference.networking.x-k8s.io
@@ -96,6 +97,8 @@ spec:
9697
maxLength: 253
9798
minLength: 1
9899
type: string
100+
required:
101+
- name
99102
type: object
100103
targetModels:
101104
description: |-
@@ -121,12 +124,12 @@ spec:
121124
description: |-
122125
Weight is used to determine the proportion of traffic that should be
123126
sent to this target model when multiple versions of the model are specified.
127+
format: int32
124128
maximum: 1000000
125129
minimum: 0
126130
type: integer
127131
type: object
128132
maxItems: 10
129-
minItems: 1
130133
type: array
131134
required:
132135
- poolRef

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

+16-5
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,21 @@ spec:
4141
properties:
4242
selector:
4343
additionalProperties:
44-
description: This indirection allows us to validate this type, since
45-
there is not native map validation support
44+
description: |-
45+
LabelValue is the value of a label. This is used for validation
46+
of maps. This matches the Kubernetes label validation rules:
47+
* must be 63 characters or less (can be empty),
48+
* unless empty, must begin and end with an alphanumeric character ([a-z0-9A-Z]),
49+
* could contain dashes (-), underscores (_), dots (.), and alphanumerics between.
50+
51+
Valid values include:
52+
53+
* MyValue
54+
* my.name
55+
* 123-my-value
4656
maxLength: 63
47-
minLength: 1
57+
minLength: 0
58+
pattern: ^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$
4859
type: string
4960
description: |-
5061
Selector uses a map of label to watch model server pods
@@ -54,7 +65,7 @@ spec:
5465
In some cases, implementations may translate this to a Service selector, so this matches the simple
5566
map used for Service selectors instead of the full Kubernetes LabelSelector type.
5667
type: object
57-
targetPort:
68+
targetPortNumber:
5869
description: |-
5970
TargetPort is the port number that the model servers within the pool expect
6071
to recieve traffic from.
@@ -65,7 +76,7 @@ spec:
6576
type: integer
6677
required:
6778
- selector
68-
- targetPort
79+
- targetPortNumber
6980
type: object
7081
status:
7182
description: InferencePoolStatus defines the observed state of InferencePool

0 commit comments

Comments
 (0)