Skip to content

Commit acbe09f

Browse files
NopeCharonntkathole
authored andcommitted
fix: Allow scaling a FeatureStore whose online store is disabled
The CEL rule that guards horizontal scaling required services.onlineStore.persistence.store unconditionally. That made it impossible to set spec.replicas > 1 or services.scaling.autoscaling on a FeatureStore that sets services.onlineStore.disabled, such as a registry-only or offline-only FeatureStore, even though no online store pod or persistence is deployed for it. The scaling docs already say the DB-backed requirement applies to enabled services only. Let the online store rule also pass when the online store is explicitly disabled. An omitted onlineStore block is still rejected, because the operator deploys the online store with file-based defaults in that case. The offline store and registry rules are unchanged, so a disabled online store still needs a DB-backed, object-store or remote registry to scale. Regenerate the CRD and dist/install.yaml, add envtest cases for static replicas and autoscaling with a disabled online store, and document the behaviour in the scaling guide. Fixes feast-dev#6865 Signed-off-by: NopeCharon <[email protected]>
1 parent 4714523 commit acbe09f

5 files changed

Lines changed: 72 additions & 17 deletions

File tree

‎docs/how-to-guides/scaling-feast.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ The operator enforces the following rules:
118118
- `spec.replicas > 1` and `services.scaling.autoscaling` are **mutually exclusive** -- you cannot set both.
119119
- Scaling with `replicas > 1` or any `autoscaling` config is **rejected** if any enabled service uses file-based persistence.
120120
- S3 (`s3://`) and GCS (`gs://`) backed registry file persistence is allowed with scaling, since these object stores support concurrent readers.
121+
- The online store is deployed with file-based defaults when `services.onlineStore` is omitted, so it counts as an enabled service. Set `services.onlineStore.disabled: true` to scale a FeatureStore that runs only the registry, offline store, or UI.
121122

122123
#### High Availability
123124

‎infra/feast-operator/api/v1/featurestore_types.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ type MlflowConfig struct {
232232

233233
// FeatureStoreSpec defines the desired state of FeatureStore
234234
// +kubebuilder:validation:XValidation:rule="self.replicas <= 1 || !has(self.services) || !has(self.services.scaling) || !has(self.services.scaling.autoscaling)",message="replicas > 1 and services.scaling.autoscaling are mutually exclusive."
235-
// +kubebuilder:validation:XValidation:rule="self.replicas <= 1 && (!has(self.services) || !has(self.services.scaling) || !has(self.services.scaling.autoscaling)) || (has(self.services) && has(self.services.onlineStore) && has(self.services.onlineStore.persistence) && has(self.services.onlineStore.persistence.store))",message="Scaling requires DB-backed persistence for the online store. Configure services.onlineStore.persistence.store when using replicas > 1 or autoscaling."
235+
// +kubebuilder:validation:XValidation:rule="self.replicas <= 1 && (!has(self.services) || !has(self.services.scaling) || !has(self.services.scaling.autoscaling)) || (has(self.services) && has(self.services.onlineStore) && ((has(self.services.onlineStore.disabled) && self.services.onlineStore.disabled) || (has(self.services.onlineStore.persistence) && has(self.services.onlineStore.persistence.store))))",message="Scaling requires DB-backed persistence for the online store. Configure services.onlineStore.persistence.store, or set services.onlineStore.disabled, when using replicas > 1 or autoscaling."
236236
// +kubebuilder:validation:XValidation:rule="self.replicas <= 1 && (!has(self.services) || !has(self.services.scaling) || !has(self.services.scaling.autoscaling)) || (!has(self.services) || !has(self.services.offlineStore) || (has(self.services.offlineStore.persistence) && has(self.services.offlineStore.persistence.store)))",message="Scaling requires DB-backed persistence for the offline store. Configure services.offlineStore.persistence.store when using replicas > 1 or autoscaling."
237237
// +kubebuilder:validation:XValidation:rule="self.replicas <= 1 && (!has(self.services) || !has(self.services.scaling) || !has(self.services.scaling.autoscaling)) || (has(self.services) && has(self.services.registry) && (has(self.services.registry.remote) || (has(self.services.registry.local) && has(self.services.registry.local.persistence) && (has(self.services.registry.local.persistence.store) || (has(self.services.registry.local.persistence.file) && has(self.services.registry.local.persistence.file.path) && (self.services.registry.local.persistence.file.path.startsWith('s3://') || self.services.registry.local.persistence.file.path.startsWith('gs://')))))))",message="Scaling requires DB-backed or remote registry. Configure registry.local.persistence.store or use a remote registry when using replicas > 1 or autoscaling. S3/GCS-backed registry is also allowed."
238238
type FeatureStoreSpec struct {

‎infra/feast-operator/config/crd/bases/feast.dev_featurestores.yaml‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7321,12 +7321,13 @@ spec:
73217321
rule: self.replicas <= 1 || !has(self.services) || !has(self.services.scaling)
73227322
|| !has(self.services.scaling.autoscaling)
73237323
- message: Scaling requires DB-backed persistence for the online store.
7324-
Configure services.onlineStore.persistence.store when using replicas
7325-
> 1 or autoscaling.
7324+
Configure services.onlineStore.persistence.store, or set services.onlineStore.disabled,
7325+
when using replicas > 1 or autoscaling.
73267326
rule: self.replicas <= 1 && (!has(self.services) || !has(self.services.scaling)
73277327
|| !has(self.services.scaling.autoscaling)) || (has(self.services)
7328-
&& has(self.services.onlineStore) && has(self.services.onlineStore.persistence)
7329-
&& has(self.services.onlineStore.persistence.store))
7328+
&& has(self.services.onlineStore) && ((has(self.services.onlineStore.disabled)
7329+
&& self.services.onlineStore.disabled) || (has(self.services.onlineStore.persistence)
7330+
&& has(self.services.onlineStore.persistence.store))))
73307331
- message: Scaling requires DB-backed persistence for the offline store.
73317332
Configure services.offlineStore.persistence.store when using replicas
73327333
> 1 or autoscaling.
@@ -14718,12 +14719,13 @@ spec:
1471814719
rule: self.replicas <= 1 || !has(self.services) || !has(self.services.scaling)
1471914720
|| !has(self.services.scaling.autoscaling)
1472014721
- message: Scaling requires DB-backed persistence for the online store.
14721-
Configure services.onlineStore.persistence.store when using replicas
14722-
> 1 or autoscaling.
14722+
Configure services.onlineStore.persistence.store, or set services.onlineStore.disabled,
14723+
when using replicas > 1 or autoscaling.
1472314724
rule: self.replicas <= 1 && (!has(self.services) || !has(self.services.scaling)
1472414725
|| !has(self.services.scaling.autoscaling)) || (has(self.services)
14725-
&& has(self.services.onlineStore) && has(self.services.onlineStore.persistence)
14726-
&& has(self.services.onlineStore.persistence.store))
14726+
&& has(self.services.onlineStore) && ((has(self.services.onlineStore.disabled)
14727+
&& self.services.onlineStore.disabled) || (has(self.services.onlineStore.persistence)
14728+
&& has(self.services.onlineStore.persistence.store))))
1472714729
- message: Scaling requires DB-backed persistence for the offline
1472814730
store. Configure services.offlineStore.persistence.store when
1472914731
using replicas > 1 or autoscaling.

‎infra/feast-operator/dist/install.yaml‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7329,12 +7329,13 @@ spec:
73297329
rule: self.replicas <= 1 || !has(self.services) || !has(self.services.scaling)
73307330
|| !has(self.services.scaling.autoscaling)
73317331
- message: Scaling requires DB-backed persistence for the online store.
7332-
Configure services.onlineStore.persistence.store when using replicas
7333-
> 1 or autoscaling.
7332+
Configure services.onlineStore.persistence.store, or set services.onlineStore.disabled,
7333+
when using replicas > 1 or autoscaling.
73347334
rule: self.replicas <= 1 && (!has(self.services) || !has(self.services.scaling)
73357335
|| !has(self.services.scaling.autoscaling)) || (has(self.services)
7336-
&& has(self.services.onlineStore) && has(self.services.onlineStore.persistence)
7337-
&& has(self.services.onlineStore.persistence.store))
7336+
&& has(self.services.onlineStore) && ((has(self.services.onlineStore.disabled)
7337+
&& self.services.onlineStore.disabled) || (has(self.services.onlineStore.persistence)
7338+
&& has(self.services.onlineStore.persistence.store))))
73387339
- message: Scaling requires DB-backed persistence for the offline store.
73397340
Configure services.offlineStore.persistence.store when using replicas
73407341
> 1 or autoscaling.
@@ -14726,12 +14727,13 @@ spec:
1472614727
rule: self.replicas <= 1 || !has(self.services) || !has(self.services.scaling)
1472714728
|| !has(self.services.scaling.autoscaling)
1472814729
- message: Scaling requires DB-backed persistence for the online store.
14729-
Configure services.onlineStore.persistence.store when using replicas
14730-
> 1 or autoscaling.
14730+
Configure services.onlineStore.persistence.store, or set services.onlineStore.disabled,
14731+
when using replicas > 1 or autoscaling.
1473114732
rule: self.replicas <= 1 && (!has(self.services) || !has(self.services.scaling)
1473214733
|| !has(self.services.scaling.autoscaling)) || (has(self.services)
14733-
&& has(self.services.onlineStore) && has(self.services.onlineStore.persistence)
14734-
&& has(self.services.onlineStore.persistence.store))
14734+
&& has(self.services.onlineStore) && ((has(self.services.onlineStore.disabled)
14735+
&& self.services.onlineStore.disabled) || (has(self.services.onlineStore.persistence)
14736+
&& has(self.services.onlineStore.persistence.store))))
1473514737
- message: Scaling requires DB-backed persistence for the offline
1473614738
store. Configure services.offlineStore.persistence.store when
1473714739
using replicas > 1 or autoscaling.

‎infra/feast-operator/internal/controller/services/scaling_test.go‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,56 @@ var _ = Describe("Horizontal Scaling", func() {
409409
Expect(err.Error()).To(ContainSubstring("online store"))
410410
})
411411

412+
It("should accept scaling when the online store is disabled", func() {
413+
fs := &feastdevv1.FeatureStore{
414+
ObjectMeta: metav1.ObjectMeta{Name: "cel-online-disabled", Namespace: "default"},
415+
Spec: feastdevv1.FeatureStoreSpec{
416+
FeastProject: celTestProject,
417+
Replicas: ptr.To(int32(3)),
418+
Services: &feastdevv1.FeatureStoreServices{
419+
OnlineStore: &feastdevv1.OnlineStore{Disabled: true},
420+
Registry: dbRegistry,
421+
},
422+
},
423+
}
424+
Expect(k8sClient.Create(ctx, fs)).To(Succeed())
425+
Expect(k8sClient.Delete(ctx, fs)).To(Succeed())
426+
})
427+
428+
It("should accept autoscaling when the online store is disabled", func() {
429+
fs := &feastdevv1.FeatureStore{
430+
ObjectMeta: metav1.ObjectMeta{Name: "cel-hpa-online-disabled", Namespace: "default"},
431+
Spec: feastdevv1.FeatureStoreSpec{
432+
FeastProject: celTestProject,
433+
Services: &feastdevv1.FeatureStoreServices{
434+
Scaling: &feastdevv1.ScalingConfig{
435+
Autoscaling: &feastdevv1.AutoscalingConfig{MaxReplicas: 5},
436+
},
437+
OnlineStore: &feastdevv1.OnlineStore{Disabled: true},
438+
Registry: dbRegistry,
439+
},
440+
},
441+
}
442+
Expect(k8sClient.Create(ctx, fs)).To(Succeed())
443+
Expect(k8sClient.Delete(ctx, fs)).To(Succeed())
444+
})
445+
446+
It("should still reject scaling without a registry when the online store is disabled", func() {
447+
fs := &feastdevv1.FeatureStore{
448+
ObjectMeta: metav1.ObjectMeta{Name: "cel-online-disabled-file-reg", Namespace: "default"},
449+
Spec: feastdevv1.FeatureStoreSpec{
450+
FeastProject: celTestProject,
451+
Replicas: ptr.To(int32(3)),
452+
Services: &feastdevv1.FeatureStoreServices{
453+
OnlineStore: &feastdevv1.OnlineStore{Disabled: true},
454+
},
455+
},
456+
}
457+
err := k8sClient.Create(ctx, fs)
458+
Expect(err).To(HaveOccurred())
459+
Expect(err.Error()).To(ContainSubstring("registry"))
460+
})
461+
412462
It("should reject replicas and autoscaling set simultaneously", func() {
413463
fs := &feastdevv1.FeatureStore{
414464
ObjectMeta: metav1.ObjectMeta{Name: "cel-mutual-excl", Namespace: "default"},

0 commit comments

Comments
 (0)