Skip to content

Commit b97da6c

Browse files
dandawgtchughesiv
andauthored
feat: Add online/offline replica support (feast-dev#4812)
* added replica support to online/offline store services Signed-off-by: dandawg <12484302+dandawg@users.noreply.github.com> * Removed unneaded if statement Co-authored-by: Tommy Hughes IV <tchughesiv@gmail.com> Signed-off-by: dandawg <12484302+dandawg@users.noreply.github.com> * fixed missing bracket Signed-off-by: dandawg <12484302+dandawg@users.noreply.github.com> * added doc comments describing replicas Signed-off-by: dandawg <12484302+dandawg@users.noreply.github.com> * Replicas doc wording change Signed-off-by: dandawg <12484302+dandawg@users.noreply.github.com> --------- Signed-off-by: dandawg <12484302+dandawg@users.noreply.github.com> Co-authored-by: Tommy Hughes IV <tchughesiv@gmail.com>
1 parent df74ee9 commit b97da6c

13 files changed

+244
-27
lines changed

infra/feast-operator/api/v1alpha1/featurestore_types.go

+14-6
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ type FeatureStoreServices struct {
7474

7575
// OfflineStore configures the deployed offline store service
7676
type OfflineStore struct {
77-
ServiceConfigs `json:",inline"`
78-
Persistence *OfflineStorePersistence `json:"persistence,omitempty"`
79-
TLS *OfflineTlsConfigs `json:"tls,omitempty"`
77+
StoreServiceConfigs `json:",inline"`
78+
Persistence *OfflineStorePersistence `json:"persistence,omitempty"`
79+
TLS *OfflineTlsConfigs `json:"tls,omitempty"`
8080
// LogLevel sets the logging level for the offline store service
8181
// Allowed values: "debug", "info", "warning", "error", "critical".
8282
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
@@ -134,9 +134,9 @@ var ValidOfflineStoreDBStorePersistenceTypes = []string{
134134

135135
// OnlineStore configures the deployed online store service
136136
type OnlineStore struct {
137-
ServiceConfigs `json:",inline"`
138-
Persistence *OnlineStorePersistence `json:"persistence,omitempty"`
139-
TLS *TlsConfigs `json:"tls,omitempty"`
137+
StoreServiceConfigs `json:",inline"`
138+
Persistence *OnlineStorePersistence `json:"persistence,omitempty"`
139+
TLS *TlsConfigs `json:"tls,omitempty"`
140140
// LogLevel sets the logging level for the online store service
141141
// Allowed values: "debug", "info", "warning", "error", "critical".
142142
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
@@ -297,6 +297,14 @@ type DefaultConfigs struct {
297297
Image *string `json:"image,omitempty"`
298298
}
299299

300+
// StoreServiceConfigs k8s deployment settings
301+
type StoreServiceConfigs struct {
302+
// Replicas determines the number of pods for the feast service.
303+
// When Replicas > 1, persistence is recommended.
304+
Replicas *int32 `json:"replicas,omitempty"`
305+
ServiceConfigs `json:",inline"`
306+
}
307+
300308
// OptionalConfigs k8s container settings that are optional
301309
type OptionalConfigs struct {
302310
Env *[]corev1.EnvVar `json:"env,omitempty"`

infra/feast-operator/api/v1alpha1/zz_generated.deepcopy.go

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

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

+24
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,12 @@ spec:
369369
x-kubernetes-validations:
370370
- message: One selection required between file or store.
371371
rule: '[has(self.file), has(self.store)].exists_one(c, c)'
372+
replicas:
373+
description: |-
374+
Replicas determines the number of pods for the feast service.
375+
When Replicas > 1, persistence is recommended.
376+
format: int32
377+
type: integer
372378
resources:
373379
description: ResourceRequirements describes the compute resource
374380
requirements.
@@ -745,6 +751,12 @@ spec:
745751
x-kubernetes-validations:
746752
- message: One selection required between file or store.
747753
rule: '[has(self.file), has(self.store)].exists_one(c, c)'
754+
replicas:
755+
description: |-
756+
Replicas determines the number of pods for the feast service.
757+
When Replicas > 1, persistence is recommended.
758+
format: int32
759+
type: integer
748760
resources:
749761
description: ResourceRequirements describes the compute resource
750762
requirements.
@@ -1614,6 +1626,12 @@ spec:
16141626
- message: One selection required between file or store.
16151627
rule: '[has(self.file), has(self.store)].exists_one(c,
16161628
c)'
1629+
replicas:
1630+
description: |-
1631+
Replicas determines the number of pods for the feast service.
1632+
When Replicas > 1, persistence is recommended.
1633+
format: int32
1634+
type: integer
16171635
resources:
16181636
description: ResourceRequirements describes the compute
16191637
resource requirements.
@@ -1997,6 +2015,12 @@ spec:
19972015
- message: One selection required between file or store.
19982016
rule: '[has(self.file), has(self.store)].exists_one(c,
19992017
c)'
2018+
replicas:
2019+
description: |-
2020+
Replicas determines the number of pods for the feast service.
2021+
When Replicas > 1, persistence is recommended.
2022+
format: int32
2023+
type: integer
20002024
resources:
20012025
description: ResourceRequirements describes the compute
20022026
resource requirements.

infra/feast-operator/dist/install.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,12 @@ spec:
377377
x-kubernetes-validations:
378378
- message: One selection required between file or store.
379379
rule: '[has(self.file), has(self.store)].exists_one(c, c)'
380+
replicas:
381+
description: |-
382+
Replicas determines the number of pods for the feast service.
383+
When Replicas > 1, persistence is recommended.
384+
format: int32
385+
type: integer
380386
resources:
381387
description: ResourceRequirements describes the compute resource
382388
requirements.
@@ -753,6 +759,12 @@ spec:
753759
x-kubernetes-validations:
754760
- message: One selection required between file or store.
755761
rule: '[has(self.file), has(self.store)].exists_one(c, c)'
762+
replicas:
763+
description: |-
764+
Replicas determines the number of pods for the feast service.
765+
When Replicas > 1, persistence is recommended.
766+
format: int32
767+
type: integer
756768
resources:
757769
description: ResourceRequirements describes the compute resource
758770
requirements.
@@ -1622,6 +1634,12 @@ spec:
16221634
- message: One selection required between file or store.
16231635
rule: '[has(self.file), has(self.store)].exists_one(c,
16241636
c)'
1637+
replicas:
1638+
description: |-
1639+
Replicas determines the number of pods for the feast service.
1640+
When Replicas > 1, persistence is recommended.
1641+
format: int32
1642+
type: integer
16251643
resources:
16261644
description: ResourceRequirements describes the compute
16271645
resource requirements.
@@ -2005,6 +2023,12 @@ spec:
20052023
- message: One selection required between file or store.
20062024
rule: '[has(self.file), has(self.store)].exists_one(c,
20072025
c)'
2026+
replicas:
2027+
description: |-
2028+
Replicas determines the number of pods for the feast service.
2029+
When Replicas > 1, persistence is recommended.
2030+
format: int32
2031+
type: integer
20082032
resources:
20092033
description: ResourceRequirements describes the compute
20102034
resource requirements.

infra/feast-operator/internal/controller/featurestore_controller_db_store_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ var _ = Describe("FeatureStore Controller - db storage services", func() {
127127
Context("When deploying a resource with all db storage services", func() {
128128
const resourceName = "cr-name"
129129
var pullPolicy = corev1.PullAlways
130+
var replicas = int32(1)
130131

131132
ctx := context.Background()
132133

@@ -205,7 +206,7 @@ var _ = Describe("FeatureStore Controller - db storage services", func() {
205206
By("creating the custom resource for the Kind FeatureStore")
206207
err = k8sClient.Get(ctx, typeNamespacedName, featurestore)
207208
if err != nil && errors.IsNotFound(err) {
208-
resource := createFeatureStoreResource(resourceName, image, pullPolicy, &[]corev1.EnvVar{})
209+
resource := createFeatureStoreResource(resourceName, image, pullPolicy, replicas, &[]corev1.EnvVar{})
209210
resource.Spec.Services.OfflineStore.Persistence = &feastdevv1alpha1.OfflineStorePersistence{
210211
DBPersistence: &feastdevv1alpha1.OfflineStoreDBStorePersistence{
211212
Type: string(offlineType),

infra/feast-operator/internal/controller/featurestore_controller_ephemeral_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ var _ = Describe("FeatureStore Controller-Ephemeral services", func() {
4848
const resourceName = "services-ephemeral"
4949
const offlineType = "duckdb"
5050
var pullPolicy = corev1.PullAlways
51+
var replicas = int32(1)
5152
var testEnvVarName = "testEnvVarName"
5253
var testEnvVarValue = "testEnvVarValue"
5354

@@ -65,7 +66,7 @@ var _ = Describe("FeatureStore Controller-Ephemeral services", func() {
6566
By("creating the custom resource for the Kind FeatureStore")
6667
err := k8sClient.Get(ctx, typeNamespacedName, featurestore)
6768
if err != nil && errors.IsNotFound(err) {
68-
resource := createFeatureStoreResource(resourceName, image, pullPolicy, &[]corev1.EnvVar{{Name: testEnvVarName, Value: testEnvVarValue},
69+
resource := createFeatureStoreResource(resourceName, image, pullPolicy, replicas, &[]corev1.EnvVar{{Name: testEnvVarName, Value: testEnvVarValue},
6970
{Name: "fieldRefName", ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{APIVersion: "v1", FieldPath: "metadata.namespace"}}}})
7071
resource.Spec.Services.OfflineStore.Persistence = &feastdevv1alpha1.OfflineStorePersistence{
7172
FilePersistence: &feastdevv1alpha1.OfflineStoreFilePersistence{

infra/feast-operator/internal/controller/featurestore_controller_kubernetes_auth_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ var _ = Describe("FeatureStore Controller-Kubernetes authorization", func() {
4848
Context("When deploying a resource with all ephemeral services and Kubernetes authorization", func() {
4949
const resourceName = "kubernetes-authorization"
5050
var pullPolicy = corev1.PullAlways
51+
var replicas = int32(1)
5152

5253
ctx := context.Background()
5354

@@ -62,7 +63,7 @@ var _ = Describe("FeatureStore Controller-Kubernetes authorization", func() {
6263
By("creating the custom resource for the Kind FeatureStore")
6364
err := k8sClient.Get(ctx, typeNamespacedName, featurestore)
6465
if err != nil && errors.IsNotFound(err) {
65-
resource := createFeatureStoreResource(resourceName, image, pullPolicy, &[]corev1.EnvVar{})
66+
resource := createFeatureStoreResource(resourceName, image, pullPolicy, replicas, &[]corev1.EnvVar{})
6667
resource.Spec.AuthzConfig = &feastdevv1alpha1.AuthzConfig{KubernetesAuthz: &feastdevv1alpha1.KubernetesAuthz{
6768
Roles: roles,
6869
}}

infra/feast-operator/internal/controller/featurestore_controller_objectstore_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ var _ = Describe("FeatureStore Controller-Ephemeral services", func() {
4646
Context("When deploying a resource with all ephemeral services", func() {
4747
const resourceName = "services-object-store"
4848
var pullPolicy = corev1.PullAlways
49+
var replicas = int32(1)
4950
var testEnvVarName = "testEnvVarName"
5051
var testEnvVarValue = "testEnvVarValue"
5152

@@ -67,7 +68,7 @@ var _ = Describe("FeatureStore Controller-Ephemeral services", func() {
6768
By("creating the custom resource for the Kind FeatureStore")
6869
err := k8sClient.Get(ctx, typeNamespacedName, featurestore)
6970
if err != nil && errors.IsNotFound(err) {
70-
resource := createFeatureStoreResource(resourceName, image, pullPolicy, &[]corev1.EnvVar{{Name: testEnvVarName, Value: testEnvVarValue},
71+
resource := createFeatureStoreResource(resourceName, image, pullPolicy, replicas, &[]corev1.EnvVar{{Name: testEnvVarName, Value: testEnvVarValue},
7172
{Name: "fieldRefName", ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{APIVersion: "v1", FieldPath: "metadata.namespace"}}}})
7273
resource.Spec.Services.OnlineStore = nil
7374
resource.Spec.Services.OfflineStore = nil

infra/feast-operator/internal/controller/featurestore_controller_oidc_auth_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ var _ = Describe("FeatureStore Controller-OIDC authorization", func() {
4949
const resourceName = "oidc-authorization"
5050
const oidcSecretName = "oidc-secret"
5151
var pullPolicy = corev1.PullAlways
52+
var replicas = int32(1)
5253

5354
ctx := context.Background()
5455

@@ -73,7 +74,7 @@ var _ = Describe("FeatureStore Controller-OIDC authorization", func() {
7374
By("creating the custom resource for the Kind FeatureStore")
7475
err = k8sClient.Get(ctx, typeNamespacedName, featurestore)
7576
if err != nil && errors.IsNotFound(err) {
76-
resource := createFeatureStoreResource(resourceName, image, pullPolicy, &[]corev1.EnvVar{})
77+
resource := createFeatureStoreResource(resourceName, image, pullPolicy, replicas, &[]corev1.EnvVar{})
7778
resource.Spec.AuthzConfig = &feastdevv1alpha1.AuthzConfig{OidcAuthz: &feastdevv1alpha1.OidcAuthz{
7879
SecretRef: corev1.LocalObjectReference{
7980
Name: oidcSecretName,

infra/feast-operator/internal/controller/featurestore_controller_pvc_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ var _ = Describe("FeatureStore Controller-Ephemeral services", func() {
5050
Context("When deploying a resource with all ephemeral services", func() {
5151
const resourceName = "services-pvc"
5252
var pullPolicy = corev1.PullAlways
53+
var replicas = int32(1)
5354
var testEnvVarName = "testEnvVarName"
5455
var testEnvVarValue = "testEnvVarValue"
5556

@@ -77,7 +78,7 @@ var _ = Describe("FeatureStore Controller-Ephemeral services", func() {
7778
By("creating the custom resource for the Kind FeatureStore")
7879
err := k8sClient.Get(ctx, typeNamespacedName, featurestore)
7980
if err != nil && errors.IsNotFound(err) {
80-
resource := createFeatureStoreResource(resourceName, image, pullPolicy, &[]corev1.EnvVar{{Name: testEnvVarName, Value: testEnvVarValue},
81+
resource := createFeatureStoreResource(resourceName, image, pullPolicy, replicas, &[]corev1.EnvVar{{Name: testEnvVarName, Value: testEnvVarValue},
8182
{Name: "fieldRefName", ValueFrom: &corev1.EnvVarSource{FieldRef: &corev1.ObjectFieldSelector{APIVersion: "v1", FieldPath: "metadata.namespace"}}}})
8283
resource.Spec.Services.OfflineStore.Persistence = &feastdevv1alpha1.OfflineStorePersistence{
8384
FilePersistence: &feastdevv1alpha1.OfflineStoreFilePersistence{

0 commit comments

Comments
 (0)