Skip to content

Commit 0ae86da

Browse files
authored
feat: Object store persistence in operator (feast-dev#4758)
* object store validation and additional field Signed-off-by: Daniele Martinoli <[email protected]> * s3 additional kwargs Signed-off-by: Daniele Martinoli <[email protected]> * adding extra line Signed-off-by: Daniele Martinoli <[email protected]> * updated registry validation message Signed-off-by: Daniele Martinoli <[email protected]> * renamed S3AddtlKwargs to S3AdditionalKwargs Signed-off-by: Daniele Martinoli <[email protected]> * generalized similar test functions Signed-off-by: Daniele Martinoli <[email protected]> --------- Signed-off-by: Daniele Martinoli <[email protected]>
1 parent d8ccb00 commit 0ae86da

9 files changed

Lines changed: 634 additions & 18 deletions

File tree

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ type OnlineStorePersistence struct {
105105
// OnlineStoreFilePersistence configures the file-based persistence for the offline store service
106106
// +kubebuilder:validation:XValidation:rule="(!has(self.pvc) && has(self.path)) ? self.path.startsWith('/') : true",message="Ephemeral stores must have absolute paths."
107107
// +kubebuilder:validation:XValidation:rule="(has(self.pvc) && has(self.path)) ? !self.path.startsWith('/') : true",message="PVC path must be a file name only, with no slashes."
108+
// +kubebuilder:validation:XValidation:rule="has(self.path) && !self.path.startsWith('s3://') && !self.path.startsWith('gs://')",message="Online store does not support S3 or GS buckets."
108109
type OnlineStoreFilePersistence struct {
109110
Path string `json:"path,omitempty"`
110111
PvcConfig *PvcConfig `json:"pvc,omitempty"`
@@ -122,11 +123,14 @@ type RegistryPersistence struct {
122123
}
123124

124125
// RegistryFilePersistence configures the file-based persistence for the registry service
125-
// +kubebuilder:validation:XValidation:rule="(!has(self.pvc) && has(self.path)) ? self.path.startsWith('/') : true",message="Ephemeral stores must have absolute paths."
126+
// +kubebuilder:validation:XValidation:rule="(!has(self.pvc) && has(self.path)) ? (self.path.startsWith('/') || self.path.startsWith('s3://') || self.path.startsWith('gs://')) : true",message="Registry files must use absolute paths or be S3 ('s3://') or GS ('gs://') object store URIs."
126127
// +kubebuilder:validation:XValidation:rule="(has(self.pvc) && has(self.path)) ? !self.path.startsWith('/') : true",message="PVC path must be a file name only, with no slashes."
128+
// +kubebuilder:validation:XValidation:rule="(has(self.pvc) && has(self.path)) ? !(self.path.startsWith('s3://') || self.path.startsWith('gs://')) : true",message="PVC persistence does not support S3 or GS object store URIs."
129+
// +kubebuilder:validation:XValidation:rule="(has(self.s3_additional_kwargs) && has(self.path)) ? self.path.startsWith('s3://') : true",message="Additional S3 settings are available only for S3 object store URIs."
127130
type RegistryFilePersistence struct {
128-
Path string `json:"path,omitempty"`
129-
PvcConfig *PvcConfig `json:"pvc,omitempty"`
131+
Path string `json:"path,omitempty"`
132+
PvcConfig *PvcConfig `json:"pvc,omitempty"`
133+
S3AdditionalKwargs *map[string]string `json:"s3_additional_kwargs,omitempty"`
130134
}
131135

132136
// PvcConfig defines the settings for a persistent file store based on PVCs.

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

Lines changed: 11 additions & 0 deletions
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

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,9 @@ spec:
545545
slashes.
546546
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
547547
: true'
548+
- message: Online store does not support S3 or GS buckets.
549+
rule: has(self.path) && !self.path.startsWith('s3://')
550+
&& !self.path.startsWith('gs://')
548551
type: object
549552
resources:
550553
description: ResourceRequirements describes the compute resource
@@ -816,15 +819,30 @@ spec:
816819
- message: Mount path must start with '/' and
817820
must not contain ':'
818821
rule: self.mountPath.matches('^/[^:]*$')
822+
s3_additional_kwargs:
823+
additionalProperties:
824+
type: string
825+
type: object
819826
type: object
820827
x-kubernetes-validations:
821-
- message: Ephemeral stores must have absolute paths.
822-
rule: '(!has(self.pvc) && has(self.path)) ? self.path.startsWith(''/'')
828+
- message: Registry files must use absolute paths
829+
or be S3 ('s3://') or GS ('gs://') object store
830+
URIs.
831+
rule: '(!has(self.pvc) && has(self.path)) ? (self.path.startsWith(''/'')
832+
|| self.path.startsWith(''s3://'') || self.path.startsWith(''gs://''))
823833
: true'
824834
- message: PVC path must be a file name only, with
825835
no slashes.
826836
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
827837
: true'
838+
- message: PVC persistence does not support S3 or
839+
GS object store URIs.
840+
rule: '(has(self.pvc) && has(self.path)) ? !(self.path.startsWith(''s3://'')
841+
|| self.path.startsWith(''gs://'')) : true'
842+
- message: Additional S3 settings are available only
843+
for S3 object store URIs.
844+
rule: '(has(self.s3_additional_kwargs) && has(self.path))
845+
? self.path.startsWith(''s3://'') : true'
828846
type: object
829847
resources:
830848
description: ResourceRequirements describes the compute
@@ -1427,6 +1445,10 @@ spec:
14271445
no slashes.
14281446
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
14291447
: true'
1448+
- message: Online store does not support S3 or GS
1449+
buckets.
1450+
rule: has(self.path) && !self.path.startsWith('s3://')
1451+
&& !self.path.startsWith('gs://')
14301452
type: object
14311453
resources:
14321454
description: ResourceRequirements describes the compute
@@ -1705,16 +1727,30 @@ spec:
17051727
- message: Mount path must start with '/'
17061728
and must not contain ':'
17071729
rule: self.mountPath.matches('^/[^:]*$')
1730+
s3_additional_kwargs:
1731+
additionalProperties:
1732+
type: string
1733+
type: object
17081734
type: object
17091735
x-kubernetes-validations:
1710-
- message: Ephemeral stores must have absolute
1711-
paths.
1736+
- message: Registry files must use absolute paths
1737+
or be S3 ('s3://') or GS ('gs://') object
1738+
store URIs.
17121739
rule: '(!has(self.pvc) && has(self.path)) ?
1713-
self.path.startsWith(''/'') : true'
1740+
(self.path.startsWith(''/'') || self.path.startsWith(''s3://'')
1741+
|| self.path.startsWith(''gs://'')) : true'
17141742
- message: PVC path must be a file name only,
17151743
with no slashes.
17161744
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
17171745
: true'
1746+
- message: PVC persistence does not support S3
1747+
or GS object store URIs.
1748+
rule: '(has(self.pvc) && has(self.path)) ? !(self.path.startsWith(''s3://'')
1749+
|| self.path.startsWith(''gs://'')) : true'
1750+
- message: Additional S3 settings are available
1751+
only for S3 object store URIs.
1752+
rule: '(has(self.s3_additional_kwargs) && has(self.path))
1753+
? self.path.startsWith(''s3://'') : true'
17181754
type: object
17191755
resources:
17201756
description: ResourceRequirements describes the compute
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: feast.dev/v1alpha1
2+
kind: FeatureStore
3+
metadata:
4+
name: sample-s3-registry
5+
spec:
6+
feastProject: my_project
7+
services:
8+
onlineStore:
9+
persistence:
10+
file:
11+
path: /data/online_store.db
12+
offlineStore:
13+
persistence:
14+
file:
15+
type: dask
16+
registry:
17+
local:
18+
persistence:
19+
file:
20+
path: s3://bucket/registry.db
21+
s3_additional_kwargs:
22+
ServerSideEncryption: AES256
23+
ACL: bucket-owner-full-control
24+
CacheControl: max-age=3600

infra/feast-operator/dist/install.yaml

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,9 @@ spec:
553553
slashes.
554554
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
555555
: true'
556+
- message: Online store does not support S3 or GS buckets.
557+
rule: has(self.path) && !self.path.startsWith('s3://')
558+
&& !self.path.startsWith('gs://')
556559
type: object
557560
resources:
558561
description: ResourceRequirements describes the compute resource
@@ -824,15 +827,30 @@ spec:
824827
- message: Mount path must start with '/' and
825828
must not contain ':'
826829
rule: self.mountPath.matches('^/[^:]*$')
830+
s3_additional_kwargs:
831+
additionalProperties:
832+
type: string
833+
type: object
827834
type: object
828835
x-kubernetes-validations:
829-
- message: Ephemeral stores must have absolute paths.
830-
rule: '(!has(self.pvc) && has(self.path)) ? self.path.startsWith(''/'')
836+
- message: Registry files must use absolute paths
837+
or be S3 ('s3://') or GS ('gs://') object store
838+
URIs.
839+
rule: '(!has(self.pvc) && has(self.path)) ? (self.path.startsWith(''/'')
840+
|| self.path.startsWith(''s3://'') || self.path.startsWith(''gs://''))
831841
: true'
832842
- message: PVC path must be a file name only, with
833843
no slashes.
834844
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
835845
: true'
846+
- message: PVC persistence does not support S3 or
847+
GS object store URIs.
848+
rule: '(has(self.pvc) && has(self.path)) ? !(self.path.startsWith(''s3://'')
849+
|| self.path.startsWith(''gs://'')) : true'
850+
- message: Additional S3 settings are available only
851+
for S3 object store URIs.
852+
rule: '(has(self.s3_additional_kwargs) && has(self.path))
853+
? self.path.startsWith(''s3://'') : true'
836854
type: object
837855
resources:
838856
description: ResourceRequirements describes the compute
@@ -1435,6 +1453,10 @@ spec:
14351453
no slashes.
14361454
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
14371455
: true'
1456+
- message: Online store does not support S3 or GS
1457+
buckets.
1458+
rule: has(self.path) && !self.path.startsWith('s3://')
1459+
&& !self.path.startsWith('gs://')
14381460
type: object
14391461
resources:
14401462
description: ResourceRequirements describes the compute
@@ -1713,16 +1735,30 @@ spec:
17131735
- message: Mount path must start with '/'
17141736
and must not contain ':'
17151737
rule: self.mountPath.matches('^/[^:]*$')
1738+
s3_additional_kwargs:
1739+
additionalProperties:
1740+
type: string
1741+
type: object
17161742
type: object
17171743
x-kubernetes-validations:
1718-
- message: Ephemeral stores must have absolute
1719-
paths.
1744+
- message: Registry files must use absolute paths
1745+
or be S3 ('s3://') or GS ('gs://') object
1746+
store URIs.
17201747
rule: '(!has(self.pvc) && has(self.path)) ?
1721-
self.path.startsWith(''/'') : true'
1748+
(self.path.startsWith(''/'') || self.path.startsWith(''s3://'')
1749+
|| self.path.startsWith(''gs://'')) : true'
17221750
- message: PVC path must be a file name only,
17231751
with no slashes.
17241752
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
17251753
: true'
1754+
- message: PVC persistence does not support S3
1755+
or GS object store URIs.
1756+
rule: '(has(self.pvc) && has(self.path)) ? !(self.path.startsWith(''s3://'')
1757+
|| self.path.startsWith(''gs://'')) : true'
1758+
- message: Additional S3 settings are available
1759+
only for S3 object store URIs.
1760+
rule: '(has(self.s3_additional_kwargs) && has(self.path))
1761+
? self.path.startsWith(''s3://'') : true'
17261762
type: object
17271763
resources:
17281764
description: ResourceRequirements describes the compute

0 commit comments

Comments
 (0)