From b2ad9c5db0feec3c9b8cddeb56948d57a1444609 Mon Sep 17 00:00:00 2001 From: Nick Stogner Date: Thu, 17 Oct 2024 20:49:01 -0400 Subject: [PATCH] Remove replica bounds check, and allow reconciliation take care it --- api/v1/model_types.go | 1 - .../kubeai/templates/crds/kubeai.org_models.yaml | 3 --- test/integration/model_validation_test.go | 14 -------------- 3 files changed, 18 deletions(-) diff --git a/api/v1/model_types.go b/api/v1/model_types.go index 8d1f5463..fb2d28b6 100644 --- a/api/v1/model_types.go +++ b/api/v1/model_types.go @@ -22,7 +22,6 @@ import ( // ModelSpec defines the desired state of Model. // +kubebuilder:validation:XValidation:rule="!has(self.cacheProfile) || self.url.startsWith(\"hf://\")", message="cacheProfile is only supported with a huggingface url (\"hf://...\") at the moment." -// +kubebuilder:validation:XValidation:rule="!has(self.replicas) || (self.minReplicas <= self.replicas) && (!has(self.maxReplicas) || self.replicas <= self.maxReplicas)", message="replicas should be in the range minReplicas..maxReplicas." // +kubebuilder:validation:XValidation:rule="!has(self.maxReplicas) || self.minReplicas <= self.maxReplicas", message="minReplicas should be less than or equal to maxReplicas." type ModelSpec struct { // URL of the model to be served. diff --git a/charts/kubeai/templates/crds/kubeai.org_models.yaml b/charts/kubeai/templates/crds/kubeai.org_models.yaml index 04fec206..4eda918c 100644 --- a/charts/kubeai/templates/crds/kubeai.org_models.yaml +++ b/charts/kubeai/templates/crds/kubeai.org_models.yaml @@ -158,9 +158,6 @@ spec: - message: cacheProfile is only supported with a huggingface url ("hf://...") at the moment. rule: '!has(self.cacheProfile) || self.url.startsWith("hf://")' - - message: replicas should be in the range minReplicas..maxReplicas. - rule: '!has(self.replicas) || (self.minReplicas <= self.replicas) && - (!has(self.maxReplicas) || self.replicas <= self.maxReplicas)' - message: minReplicas should be less than or equal to maxReplicas. rule: '!has(self.maxReplicas) || self.minReplicas <= self.maxReplicas' status: diff --git a/test/integration/model_validation_test.go b/test/integration/model_validation_test.go index 8351701a..0a175639 100644 --- a/test/integration/model_validation_test.go +++ b/test/integration/model_validation_test.go @@ -137,20 +137,6 @@ func TestModelValidation(t *testing.T) { }, expValid: true, }, - { - model: v1.Model{ - ObjectMeta: metadata("replicas-1-3-2-invalid"), - Spec: v1.ModelSpec{ - URL: "hf://test-repo/test-model", - Engine: "VLLM", - Features: []v1.ModelFeature{}, - MinReplicas: 1, - Replicas: ptr.To[int32](3), - MaxReplicas: ptr.To[int32](2), - }, - }, - expErrContain: "replicas should be in the range minReplicas..maxReplicas", - }, { model: v1.Model{ ObjectMeta: metadata("replicas-3-nil-2-invalid"),