Skip to content

Commit

Permalink
object store validation and additional field
Browse files Browse the repository at this point in the history
Signed-off-by: Daniele Martinoli <[email protected]>
  • Loading branch information
dmartinol committed Nov 12, 2024
1 parent 6644853 commit 206f3a7
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 12 deletions.
7 changes: 6 additions & 1 deletion infra/feast-operator/api/v1alpha1/featurestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ type OnlineStorePersistence struct {
// OnlineStoreFilePersistence configures the file-based persistence for the offline store service
// +kubebuilder:validation:XValidation:rule="(!has(self.pvc) && has(self.path)) ? self.path.startsWith('/') : true",message="Ephemeral stores must have absolute paths."
// +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."
// +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."
type OnlineStoreFilePersistence struct {
Path string `json:"path,omitempty"`
PvcConfig *PvcConfig `json:"pvc,omitempty"`
Expand All @@ -122,11 +123,15 @@ type RegistryPersistence struct {
}

// RegistryFilePersistence configures the file-based persistence for the registry service
// +kubebuilder:validation:XValidation:rule="(!has(self.pvc) && has(self.path)) ? self.path.startsWith('/') : true",message="Ephemeral stores must have absolute paths."
// +kubebuilder:validation:XValidation:rule="(!has(self.pvc) && has(self.path)) ? (self.path.startsWith('/') || self.path.startsWith('s3://') || self.path.startsWith('gs://')) : true",message="Ephemeral stores must use absolute paths or be S3 ('s3://') or GS ('gs://') object store URIs."
// +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."
// +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."
// +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."
type RegistryFilePersistence struct {
Path string `json:"path,omitempty"`
PvcConfig *PvcConfig `json:"pvc,omitempty"`
// +optional
S3AddtlKwargs *map[string]string `json:"s3_additional_kwargs,omitempty"`
}

// PvcConfig defines the settings for a persistent file store based on PVCs.
Expand Down
11 changes: 11 additions & 0 deletions infra/feast-operator/api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 41 additions & 5 deletions infra/feast-operator/config/crd/bases/feast.dev_featurestores.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,9 @@ spec:
slashes.
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
: true'
- message: Online store does not support S3 or GS buckets.
rule: has(self.path) && !self.path.startsWith('s3://')
&& !self.path.startsWith('gs://')
type: object
resources:
description: ResourceRequirements describes the compute resource
Expand Down Expand Up @@ -816,15 +819,30 @@ spec:
- message: Mount path must start with '/' and
must not contain ':'
rule: self.mountPath.matches('^/[^:]*$')
s3_additional_kwargs:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-validations:
- message: Ephemeral stores must have absolute paths.
rule: '(!has(self.pvc) && has(self.path)) ? self.path.startsWith(''/'')
- message: Ephemeral stores must use absolute paths
or be S3 ('s3://') or GS ('gs://') object store
URIs.
rule: '(!has(self.pvc) && has(self.path)) ? (self.path.startsWith(''/'')
|| self.path.startsWith(''s3://'') || self.path.startsWith(''gs://''))
: true'
- message: PVC path must be a file name only, with
no slashes.
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
: true'
- message: PVC persistence does not support S3 or
GS object store URIs.
rule: '(has(self.pvc) && has(self.path)) ? !(self.path.startsWith(''s3://'')
|| self.path.startsWith(''gs://'')) : true'
- message: Additional S3 settings are available only
for S3 object store URIs.
rule: '(has(self.s3_additional_kwargs) && has(self.path))
? self.path.startsWith(''s3://'') : true'
type: object
resources:
description: ResourceRequirements describes the compute
Expand Down Expand Up @@ -1427,6 +1445,10 @@ spec:
no slashes.
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
: true'
- message: Online store does not support S3 or GS
buckets.
rule: has(self.path) && !self.path.startsWith('s3://')
&& !self.path.startsWith('gs://')
type: object
resources:
description: ResourceRequirements describes the compute
Expand Down Expand Up @@ -1705,16 +1727,30 @@ spec:
- message: Mount path must start with '/'
and must not contain ':'
rule: self.mountPath.matches('^/[^:]*$')
s3_additional_kwargs:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-validations:
- message: Ephemeral stores must have absolute
paths.
- message: Ephemeral stores must use absolute
paths or be S3 ('s3://') or GS ('gs://') object
store URIs.
rule: '(!has(self.pvc) && has(self.path)) ?
self.path.startsWith(''/'') : true'
(self.path.startsWith(''/'') || self.path.startsWith(''s3://'')
|| self.path.startsWith(''gs://'')) : true'
- message: PVC path must be a file name only,
with no slashes.
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
: true'
- message: PVC persistence does not support S3
or GS object store URIs.
rule: '(has(self.pvc) && has(self.path)) ? !(self.path.startsWith(''s3://'')
|| self.path.startsWith(''gs://'')) : true'
- message: Additional S3 settings are available
only for S3 object store URIs.
rule: '(has(self.s3_additional_kwargs) && has(self.path))
? self.path.startsWith(''s3://'') : true'
type: object
resources:
description: ResourceRequirements describes the compute
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: feast.dev/v1alpha1
kind: FeatureStore
metadata:
name: sample-s3-registry
spec:
feastProject: my_project
services:
onlineStore:
persistence:
file:
path: /data/online_store.db
offlineStore:
persistence:
file:
type: dask
registry:
local:
persistence:
file:
path: s3://bucket/registry.db
s3_additional_kwargs:
ServerSideEncryption: AES256
ACL: bucket-owner-full-control
CacheControl: max-age=3600
46 changes: 41 additions & 5 deletions infra/feast-operator/dist/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,9 @@ spec:
slashes.
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
: true'
- message: Online store does not support S3 or GS buckets.
rule: has(self.path) && !self.path.startsWith('s3://')
&& !self.path.startsWith('gs://')
type: object
resources:
description: ResourceRequirements describes the compute resource
Expand Down Expand Up @@ -824,15 +827,30 @@ spec:
- message: Mount path must start with '/' and
must not contain ':'
rule: self.mountPath.matches('^/[^:]*$')
s3_additional_kwargs:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-validations:
- message: Ephemeral stores must have absolute paths.
rule: '(!has(self.pvc) && has(self.path)) ? self.path.startsWith(''/'')
- message: Ephemeral stores must use absolute paths
or be S3 ('s3://') or GS ('gs://') object store
URIs.
rule: '(!has(self.pvc) && has(self.path)) ? (self.path.startsWith(''/'')
|| self.path.startsWith(''s3://'') || self.path.startsWith(''gs://''))
: true'
- message: PVC path must be a file name only, with
no slashes.
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
: true'
- message: PVC persistence does not support S3 or
GS object store URIs.
rule: '(has(self.pvc) && has(self.path)) ? !(self.path.startsWith(''s3://'')
|| self.path.startsWith(''gs://'')) : true'
- message: Additional S3 settings are available only
for S3 object store URIs.
rule: '(has(self.s3_additional_kwargs) && has(self.path))
? self.path.startsWith(''s3://'') : true'
type: object
resources:
description: ResourceRequirements describes the compute
Expand Down Expand Up @@ -1435,6 +1453,10 @@ spec:
no slashes.
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
: true'
- message: Online store does not support S3 or GS
buckets.
rule: has(self.path) && !self.path.startsWith('s3://')
&& !self.path.startsWith('gs://')
type: object
resources:
description: ResourceRequirements describes the compute
Expand Down Expand Up @@ -1713,16 +1735,30 @@ spec:
- message: Mount path must start with '/'
and must not contain ':'
rule: self.mountPath.matches('^/[^:]*$')
s3_additional_kwargs:
additionalProperties:
type: string
type: object
type: object
x-kubernetes-validations:
- message: Ephemeral stores must have absolute
paths.
- message: Ephemeral stores must use absolute
paths or be S3 ('s3://') or GS ('gs://') object
store URIs.
rule: '(!has(self.pvc) && has(self.path)) ?
self.path.startsWith(''/'') : true'
(self.path.startsWith(''/'') || self.path.startsWith(''s3://'')
|| self.path.startsWith(''gs://'')) : true'
- message: PVC path must be a file name only,
with no slashes.
rule: '(has(self.pvc) && has(self.path)) ? !self.path.startsWith(''/'')
: true'
- message: PVC persistence does not support S3
or GS object store URIs.
rule: '(has(self.pvc) && has(self.path)) ? !(self.path.startsWith(''s3://'')
|| self.path.startsWith(''gs://'')) : true'
- message: Additional S3 settings are available
only for S3 object store URIs.
rule: '(has(self.s3_additional_kwargs) && has(self.path))
? self.path.startsWith(''s3://'') : true'
type: object
resources:
description: ResourceRequirements describes the compute
Expand Down
Loading

0 comments on commit 206f3a7

Please sign in to comment.