Skip to content

Commit 1008ca2

Browse files
fix(operator): add spec.services.onlineStore.disabled to opt out of the online store
The operator always deploys an online store, forcing a serving pod and persistence onto registry-only or offline-only FeatureStores (feast-dev#6586). Add a `disabled` field on the online store spec to opt those deployments out explicitly. Deployment is gated through isOnlineStore(), so disabling also skips the serving pod, metrics, and service monitor. The default is unchanged -- omitting the online store block still deploys it with defaults -- so this is not a breaking change on upgrade. Signed-off-by: Nikolaus Schuetz <[email protected]>
1 parent 1669661 commit 1008ca2

7 files changed

Lines changed: 130 additions & 17 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,11 @@ type OnlineStore struct {
544544
// Controls metrics granularity, offline push batching, and MCP.
545545
// +optional
546546
Serving *ServingConfig `json:"serving,omitempty"`
547+
// Disabled skips deploying the online store service entirely, including its
548+
// serving pod and persistence. Omitting the online store block, or setting
549+
// this to false, deploys the online store with defaults as before.
550+
// +optional
551+
Disabled bool `json:"disabled,omitempty"`
547552
}
548553

549554
// ServingConfig configures the feature_server section of the generated feature_store.yaml.

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2258,6 +2258,11 @@ spec:
22582258
onlineStore:
22592259
description: OnlineStore configures the online store service
22602260
properties:
2261+
disabled:
2262+
description: |-
2263+
Disabled skips deploying the online store service entirely, including its
2264+
serving pod and persistence.
2265+
type: boolean
22612266
persistence:
22622267
description: OnlineStorePersistence configures the persistence
22632268
settings for the online store service
@@ -8561,6 +8566,11 @@ spec:
85618566
onlineStore:
85628567
description: OnlineStore configures the online store service
85638568
properties:
8569+
disabled:
8570+
description: |-
8571+
Disabled skips deploying the online store service entirely, including its
8572+
serving pod and persistence.
8573+
type: boolean
85648574
persistence:
85658575
description: OnlineStorePersistence configures the persistence
85668576
settings for the online store service

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,6 +2266,11 @@ spec:
22662266
onlineStore:
22672267
description: OnlineStore configures the online store service
22682268
properties:
2269+
disabled:
2270+
description: |-
2271+
Disabled skips deploying the online store service entirely, including its
2272+
serving pod and persistence.
2273+
type: boolean
22692274
persistence:
22702275
description: OnlineStorePersistence configures the persistence
22712276
settings for the online store service
@@ -8569,6 +8574,11 @@ spec:
85698574
onlineStore:
85708575
description: OnlineStore configures the online store service
85718576
properties:
8577+
disabled:
8578+
description: |-
8579+
Disabled skips deploying the online store service entirely, including its
8580+
serving pod and persistence.
8581+
type: boolean
85728582
persistence:
85738583
description: OnlineStorePersistence configures the persistence
85748584
settings for the online store service

‎infra/feast-operator/docs/api/markdown/ref.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,9 @@ _Appears in:_
654654
| `persistence` _[OnlineStorePersistence](#onlinestorepersistence)_ | |
655655
| `serving` _[ServingConfig](#servingconfig)_ | Serving configures the Feast feature_server section written into feature_store.yaml for the online serve pod.
656656
Controls metrics granularity, offline push batching, and MCP. |
657+
| `disabled` _boolean_ | Disabled skips deploying the online store service entirely, including its
658+
serving pod and persistence. Omitting the online store block, or setting
659+
this to false, deploys the online store with defaults as before. |
657660

658661

659662
#### OnlineStoreDBStorePersistence

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ func (feast *FeastServices) isOnlineServer() bool {
12741274

12751275
func (feast *FeastServices) isOnlineStore() bool {
12761276
appliedServices := feast.Handler.FeatureStore.Status.Applied.Services
1277-
return appliedServices != nil && appliedServices.OnlineStore != nil
1277+
return appliedServices != nil && appliedServices.OnlineStore != nil && !appliedServices.OnlineStore.Disabled
12781278
}
12791279

12801280
func (feast *FeastServices) noLocalCoreServerConfigured() bool {

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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -163,30 +163,32 @@ func ApplyDefaultsToStatus(cr *feastdevv1.FeatureStore) {
163163
}
164164
}
165165

166-
// default to onlineStore service deployment
166+
// default to onlineStore service deployment unless it is explicitly disabled
167167
if services.OnlineStore == nil {
168168
services.OnlineStore = &feastdevv1.OnlineStore{}
169169
}
170-
if services.OnlineStore.Persistence == nil {
171-
services.OnlineStore.Persistence = &feastdevv1.OnlineStorePersistence{}
172-
}
173-
174-
if services.OnlineStore.Persistence.DBPersistence == nil {
175-
if services.OnlineStore.Persistence.FilePersistence == nil {
176-
services.OnlineStore.Persistence.FilePersistence = &feastdevv1.OnlineStoreFilePersistence{}
170+
if !services.OnlineStore.Disabled {
171+
if services.OnlineStore.Persistence == nil {
172+
services.OnlineStore.Persistence = &feastdevv1.OnlineStorePersistence{}
177173
}
178174

179-
if len(services.OnlineStore.Persistence.FilePersistence.Path) == 0 {
180-
services.OnlineStore.Persistence.FilePersistence.Path = defaultOnlineStorePath(cr)
181-
}
175+
if services.OnlineStore.Persistence.DBPersistence == nil {
176+
if services.OnlineStore.Persistence.FilePersistence == nil {
177+
services.OnlineStore.Persistence.FilePersistence = &feastdevv1.OnlineStoreFilePersistence{}
178+
}
182179

183-
ensurePVCDefaults(services.OnlineStore.Persistence.FilePersistence.PvcConfig, OnlineFeastType)
184-
}
180+
if len(services.OnlineStore.Persistence.FilePersistence.Path) == 0 {
181+
services.OnlineStore.Persistence.FilePersistence.Path = defaultOnlineStorePath(cr)
182+
}
183+
184+
ensurePVCDefaults(services.OnlineStore.Persistence.FilePersistence.PvcConfig, OnlineFeastType)
185+
}
185186

186-
if services.OnlineStore.Server == nil {
187-
services.OnlineStore.Server = &feastdevv1.ServerConfigs{}
187+
if services.OnlineStore.Server == nil {
188+
services.OnlineStore.Server = &feastdevv1.ServerConfigs{}
189+
}
190+
setDefaultCtrConfigs(&services.OnlineStore.Server.ContainerConfigs.DefaultCtrConfigs)
188191
}
189-
setDefaultCtrConfigs(&services.OnlineStore.Server.ContainerConfigs.DefaultCtrConfigs)
190192

191193
if services.UI != nil {
192194
setDefaultCtrConfigs(&services.UI.ContainerConfigs.DefaultCtrConfigs)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*
2+
Copyright 2024 Feast Community.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package services
18+
19+
import (
20+
. "github.com/onsi/ginkgo/v2"
21+
. "github.com/onsi/gomega"
22+
23+
feastdevv1 "github.com/feast-dev/feast/infra/feast-operator/api/v1"
24+
)
25+
26+
var _ = Describe("ApplyDefaultsToStatus", func() {
27+
It("deploys the online store with defaults when it is not declared", func() {
28+
cr := &feastdevv1.FeatureStore{
29+
Spec: feastdevv1.FeatureStoreSpec{
30+
FeastProject: "test_project",
31+
Services: &feastdevv1.FeatureStoreServices{},
32+
},
33+
}
34+
35+
ApplyDefaultsToStatus(cr)
36+
37+
online := cr.Status.Applied.Services.OnlineStore
38+
Expect(online).ToNot(BeNil())
39+
Expect(online.Disabled).To(BeFalse())
40+
Expect(online.Persistence).ToNot(BeNil())
41+
Expect(online.Server).ToNot(BeNil())
42+
})
43+
44+
It("applies online store defaults when it is declared", func() {
45+
cr := &feastdevv1.FeatureStore{
46+
Spec: feastdevv1.FeatureStoreSpec{
47+
FeastProject: "test_project",
48+
Services: &feastdevv1.FeatureStoreServices{
49+
OnlineStore: &feastdevv1.OnlineStore{},
50+
},
51+
},
52+
}
53+
54+
ApplyDefaultsToStatus(cr)
55+
56+
online := cr.Status.Applied.Services.OnlineStore
57+
Expect(online).ToNot(BeNil())
58+
Expect(online.Persistence).ToNot(BeNil())
59+
Expect(online.Server).ToNot(BeNil())
60+
})
61+
62+
// #6586: disabling the online store opts out of its persistence and serving
63+
// pod, letting a registry-only or offline-only FeatureStore skip it while
64+
// leaving the default-on behavior unchanged for everyone else.
65+
It("does not apply persistence or server defaults when the online store is disabled", func() {
66+
cr := &feastdevv1.FeatureStore{
67+
Spec: feastdevv1.FeatureStoreSpec{
68+
FeastProject: "test_project",
69+
Services: &feastdevv1.FeatureStoreServices{
70+
OnlineStore: &feastdevv1.OnlineStore{Disabled: true},
71+
},
72+
},
73+
}
74+
75+
ApplyDefaultsToStatus(cr)
76+
77+
online := cr.Status.Applied.Services.OnlineStore
78+
Expect(online).ToNot(BeNil())
79+
Expect(online.Disabled).To(BeTrue())
80+
Expect(online.Persistence).To(BeNil())
81+
Expect(online.Server).To(BeNil())
82+
})
83+
})

0 commit comments

Comments
 (0)