Skip to content

Commit 785a190

Browse files
authored
feat: PVC configuration and impl (#4750)
* PVC configuration and impl Signed-off-by: Daniele Martinoli <[email protected]> * typo in sample manifest Signed-off-by: Daniele Martinoli <[email protected]> * removing private images Signed-off-by: Daniele Martinoli <[email protected]> * More logs for PVC deletion and changing create strategy Signed-off-by: Daniele Martinoli <[email protected]> * using createNewPVC Signed-off-by: Daniele Martinoli <[email protected]> * fixed broken test Signed-off-by: Daniele Martinoli <[email protected]> * validating PVC config in applied status Signed-off-by: Daniele Martinoli <[email protected]> * simplified PVC deletion logic Signed-off-by: Daniele Martinoli <[email protected]> * ignoring err when PVC is deleted Signed-off-by: Daniele Martinoli <[email protected]> * object store validation and additional field Signed-off-by: Daniele Martinoli <[email protected]> --------- Signed-off-by: Daniele Martinoli <[email protected]>
1 parent 5d8d03f commit 785a190

17 files changed

+2891
-509
lines changed

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

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ type OfflineStorePersistence struct {
8282
// OfflineStorePersistence configures the file-based persistence for the offline store service
8383
type OfflineStoreFilePersistence struct {
8484
// +kubebuilder:validation:Enum=dask;duckdb
85-
Type string `json:"type,omitempty"`
85+
Type string `json:"type,omitempty"`
86+
PvcConfig *PvcConfig `json:"pvc,omitempty"`
8687
}
8788

8889
var ValidOfflineStoreFilePersistenceTypes = []string{
@@ -102,8 +103,11 @@ type OnlineStorePersistence struct {
102103
}
103104

104105
// OnlineStoreFilePersistence configures the file-based persistence for the offline store service
106+
// +kubebuilder:validation:XValidation:rule="(!has(self.pvc) && has(self.path)) ? self.path.startsWith('/') : true",message="Ephemeral stores must have absolute paths."
107+
// +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."
105108
type OnlineStoreFilePersistence struct {
106-
Path string `json:"path,omitempty"`
109+
Path string `json:"path,omitempty"`
110+
PvcConfig *PvcConfig `json:"pvc,omitempty"`
107111
}
108112

109113
// LocalRegistryConfig configures the deployed registry service
@@ -118,8 +122,40 @@ type RegistryPersistence struct {
118122
}
119123

120124
// 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('/') : true",message="PVC path must be a file name only, with no slashes."
121127
type RegistryFilePersistence struct {
122-
Path string `json:"path,omitempty"`
128+
Path string `json:"path,omitempty"`
129+
PvcConfig *PvcConfig `json:"pvc,omitempty"`
130+
}
131+
132+
// PvcConfig defines the settings for a persistent file store based on PVCs.
133+
// We can refer to an existing PVC using the `Ref` field, or create a new one using the `Create` field.
134+
// +kubebuilder:validation:XValidation:rule="[has(self.ref), has(self.create)].exists_one(c, c)",message="One selection is required between ref and create."
135+
// +kubebuilder:validation:XValidation:rule="self.mountPath.matches('^/[^:]*$')",message="Mount path must start with '/' and must not contain ':'"
136+
type PvcConfig struct {
137+
// Reference to an existing field
138+
Ref *corev1.LocalObjectReference `json:"ref,omitempty"`
139+
// Settings for creating a new PVC
140+
Create *PvcCreate `json:"create,omitempty"`
141+
// MountPath within the container at which the volume should be mounted.
142+
// Must start by "/" and cannot contain ':'.
143+
MountPath string `json:"mountPath,omitempty"`
144+
}
145+
146+
// PvcCreate defines the immutable settings to create a new PVC mounted at the given path.
147+
// The PVC name is the same as the associated deployment name.
148+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="PvcCreate is immutable"
149+
type PvcCreate struct {
150+
// StorageClassName is the name of an existing StorageClass to which this persistent volume belongs. Empty value
151+
// means that this volume does not belong to any StorageClass and the cluster default will be used.
152+
StorageClassName *string `json:"storageClassName,omitempty"`
153+
// Resources describes the storage resource requirements for a volume.
154+
// Default requested storage size depends on the associated service:
155+
// - 10Gi for offline store
156+
// - 5Gi for online store
157+
// - 5Gi for registry
158+
Resources corev1.VolumeResourceRequirements `json:"resources,omitempty"`
123159
}
124160

125161
// Registry configures the registry service. One selection is required. Local is the default setting.

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

Lines changed: 64 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)