Skip to content

Commit d81d4e3

Browse files
nikolauspschuetzntkathole
authored andcommitted
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 (#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 <nikolauspschuetz@gmail.com>
1 parent 0f149a9 commit d81d4e3

8 files changed

Lines changed: 131 additions & 18 deletions

File tree

.secrets.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@
957957
"filename": "infra/feast-operator/api/v1/featurestore_types.go",
958958
"hashed_secret": "44e17306b837162269a410204daaa5ecee4ec22c",
959959
"is_verified": false,
960-
"line_number": 937
960+
"line_number": 942
961961
}
962962
],
963963
"infra/feast-operator/api/v1/zz_generated.deepcopy.go": [

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
@@ -8562,6 +8567,11 @@ spec:
85628567
onlineStore:
85638568
description: OnlineStore configures the online store service
85648569
properties:
8570+
disabled:
8571+
description: |-
8572+
Disabled skips deploying the online store service entirely, including its
8573+
serving pod and persistence.
8574+
type: boolean
85658575
persistence:
85668576
description: OnlineStorePersistence configures the persistence
85678577
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
@@ -8570,6 +8575,11 @@ spec:
85708575
onlineStore:
85718576
description: OnlineStore configures the online store service
85728577
properties:
8578+
disabled:
8579+
description: |-
8580+
Disabled skips deploying the online store service entirely, including its
8581+
serving pod and persistence.
8582+
type: boolean
85738583
persistence:
85748584
description: OnlineStorePersistence configures the persistence
85758585
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
@@ -1291,7 +1291,7 @@ func (feast *FeastServices) isOnlineServer() bool {
12911291

12921292
func (feast *FeastServices) isOnlineStore() bool {
12931293
appliedServices := feast.Handler.FeatureStore.Status.Applied.Services
1294-
return appliedServices != nil && appliedServices.OnlineStore != nil
1294+
return appliedServices != nil && appliedServices.OnlineStore != nil && !appliedServices.OnlineStore.Disabled
12951295
}
12961296

12971297
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)