Skip to content

Commit

Permalink
Adding the Volume and volumeMount with code review comments. and reba…
Browse files Browse the repository at this point in the history
…sed with the master.

Signed-off-by: lrangine <[email protected]>

Signed-off-by: lrangine <[email protected]>
  • Loading branch information
lokeshrangineni committed Jan 29, 2025
1 parent 7593bb3 commit 348ec68
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 5 deletions.
27 changes: 25 additions & 2 deletions infra/feast-operator/api/v1alpha1/featurestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ type FeatureStoreServices struct {
DeploymentStrategy *appsv1.DeploymentStrategy `json:"deploymentStrategy,omitempty"`
// Disable the 'feast repo initialization' initContainer
DisableInitContainers bool `json:"disableInitContainers,omitempty"`
// Volumes specifies the volumes to mount in the FeatureStore deployment. A corresponding `VolumeMount` should be added to whichever feast service(s) require access to said volume(s).
Volumes []corev1.Volume `json:"volumes,omitempty"`
}

// OfflineStore configures the deployed offline store service
Expand All @@ -89,6 +91,11 @@ type OfflineStore struct {
// Allowed values: "debug", "info", "warning", "error", "critical".
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
LogLevel string `json:"logLevel,omitempty"`
// VolumeMounts defines the list of volumes that should be mounted into the feast container.
// This allows attaching persistent storage, config files, secrets, or other resources
// required by the Feast components. Ensure that each volume mount has a corresponding
// volume definition in the Volumes field.
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

// OfflineStorePersistence configures the persistence settings for the offline store service
Expand Down Expand Up @@ -142,6 +149,12 @@ type OnlineStore struct {
// Allowed values: "debug", "info", "warning", "error", "critical".
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
LogLevel string `json:"logLevel,omitempty"`

// VolumeMounts defines the list of volumes that should be mounted into the feast container.
// This allows attaching persistent storage, config files, secrets, or other resources
// required by the Feast components. Ensure that each volume mount has a corresponding
// volume definition in the Volumes field.
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

// OnlineStorePersistence configures the persistence settings for the online store service
Expand All @@ -151,7 +164,7 @@ type OnlineStorePersistence struct {
DBPersistence *OnlineStoreDBStorePersistence `json:"store,omitempty"`
}

// OnlineStoreFilePersistence configures the file-based persistence for the offline store service
// OnlineStoreFilePersistence configures the file-based persistence for the online 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://')) : true",message="Online store does not support S3 or GS buckets."
Expand All @@ -160,7 +173,7 @@ type OnlineStoreFilePersistence struct {
PvcConfig *PvcConfig `json:"pvc,omitempty"`
}

// OnlineStoreDBStorePersistence configures the DB store persistence for the offline store service
// OnlineStoreDBStorePersistence configures the DB store persistence for the online store service
type OnlineStoreDBStorePersistence struct {
// +kubebuilder:validation:Enum=snowflake.online;redis;ikv;datastore;dynamodb;bigtable;postgres;cassandra;mysql;hazelcast;singlestore;hbase;elasticsearch;qdrant;couchbase;milvus
Type string `json:"type"`
Expand Down Expand Up @@ -198,6 +211,11 @@ type LocalRegistryConfig struct {
// Allowed values: "debug", "info", "warning", "error", "critical".
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
LogLevel string `json:"logLevel,omitempty"`
// VolumeMounts defines the list of volumes that should be mounted into the feast container.
// This allows attaching persistent storage, config files, secrets, or other resources
// required by the Feast components. Ensure that each volume mount has a corresponding
// volume definition in the Volumes field.
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

// RegistryPersistence configures the persistence settings for the registry service
Expand Down Expand Up @@ -290,6 +308,11 @@ type UIService struct {
// Allowed values: "debug", "info", "warning", "error", "critical".
// +kubebuilder:validation:Enum=debug;info;warning;error;critical
LogLevel string `json:"logLevel,omitempty"`
// VolumeMounts defines the list of volumes that should be mounted into the feast UI container.
// This allows attaching persistent storage, config files, secrets, or other resources
// required by the Feast components. Ensure that each volume mount has a corresponding
// volume definition in the Volumes field.
VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
}

// FeatureStoreRef defines which existing FeatureStore's registry should be used
Expand Down
35 changes: 35 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.

9 changes: 7 additions & 2 deletions infra/feast-operator/docs/api/markdown/ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ _Appears in:_
| `ui` _[UIService](#uiservice)_ | |
| `deploymentStrategy` _[DeploymentStrategy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentstrategy-v1-apps)_ | |
| `disableInitContainers` _boolean_ | Disable the 'feast repo initialization' initContainer |
| `volumes` _[Volume](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volume-v1-core) array_ | Volumes specifies the list of volumes to mount in the FeatureStore deployment. |


#### FeatureStoreSpec
Expand Down Expand Up @@ -195,6 +196,7 @@ _Appears in:_
| `tls` _[TlsConfigs](#tlsconfigs)_ | |
| `logLevel` _string_ | LogLevel sets the logging level for the offline store service
Allowed values: "debug", "info", "warning", "error", "critical". |
| `volumeMounts` _[VolumeMount](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volumemount-v1-core) array_ | |


#### OfflineStoreDBStorePersistence
Expand Down Expand Up @@ -278,13 +280,14 @@ _Appears in:_
| `tls` _[TlsConfigs](#tlsconfigs)_ | |
| `logLevel` _string_ | LogLevel sets the logging level for the online store service
Allowed values: "debug", "info", "warning", "error", "critical". |
| `volumeMounts` _[VolumeMount](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volumemount-v1-core) array_ | |


#### OnlineStoreDBStorePersistence



OnlineStoreDBStorePersistence configures the DB store persistence for the offline store service
OnlineStoreDBStorePersistence configures the DB store persistence for the online store service

_Appears in:_
- [OnlineStorePersistence](#onlinestorepersistence)
Expand All @@ -300,7 +303,7 @@ _Appears in:_



OnlineStoreFilePersistence configures the file-based persistence for the offline store service
OnlineStoreFilePersistence configures the file-based persistence for the online store service

_Appears in:_
- [OnlineStorePersistence](#onlinestorepersistence)
Expand Down Expand Up @@ -375,6 +378,7 @@ _Appears in:_
| --- | --- |
| `local` _[LocalRegistryConfig](#localregistryconfig)_ | |
| `remote` _[RemoteRegistryConfig](#remoteregistryconfig)_ | |
| `volumeMounts` _[VolumeMount](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volumemount-v1-core) array_ | |


#### RegistryDBStorePersistence
Expand Down Expand Up @@ -537,5 +541,6 @@ _Appears in:_
| `tls` _[TlsConfigs](#tlsconfigs)_ | |
| `logLevel` _string_ | LogLevel sets the logging level for the UI service
Allowed values: "debug", "info", "warning", "error", "critical". |
| `volumeMounts` _[VolumeMount](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#volumemount-v1-core) array_ | |


Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,38 @@ func createFeatureStoreResource(resourceName string, image string, pullPolicy co
Spec: feastdevv1alpha1.FeatureStoreSpec{
FeastProject: feastProject,
Services: &feastdevv1alpha1.FeatureStoreServices{
Volumes: []corev1.Volume{
{
Name: "config-volume",
VolumeSource: corev1.VolumeSource{
ConfigMap: &corev1.ConfigMapVolumeSource{
LocalObjectReference: corev1.LocalObjectReference{
Name: "my-config",
},
},
},
},
},
OfflineStore: &feastdevv1alpha1.OfflineStore{
VolumeMounts: []corev1.VolumeMount{
{
Name: "config-volume",
MountPath: "/etc/service-config",
},
},
ServiceConfigs: feastdevv1alpha1.ServiceConfigs{
OptionalConfigs: feastdevv1alpha1.OptionalConfigs{
EnvFrom: envFromVar,
},
},
},
OnlineStore: &feastdevv1alpha1.OnlineStore{
VolumeMounts: []corev1.VolumeMount{
{
Name: "config-volume",
MountPath: "/etc/service-config",
},
},
ServiceConfigs: feastdevv1alpha1.ServiceConfigs{
DefaultConfigs: feastdevv1alpha1.DefaultConfigs{
Image: &image,
Expand Down
40 changes: 39 additions & 1 deletion infra/feast-operator/internal/controller/services/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,13 @@ func (feast *FeastServices) createPVC(pvcCreate *feastdevv1alpha1.PvcCreate, fea
}

func (feast *FeastServices) setDeployment(deploy *appsv1.Deployment) error {
var volumes []corev1.Volume
if feast.Handler.FeatureStore.Spec.Services != nil {
volumes = feast.Handler.FeatureStore.Spec.Services.Volumes
}
if volumes == nil {
volumes = []corev1.Volume{} // Ensure it's an empty slice instead of nil
}
deploy.Labels = feast.getLabels()
deploy.Spec = appsv1.DeploymentSpec{
Replicas: &DefaultReplicas,
Expand All @@ -336,6 +343,7 @@ func (feast *FeastServices) setDeployment(deploy *appsv1.Deployment) error {
},
Spec: corev1.PodSpec{
ServiceAccountName: feast.initFeastSA().Name,
Volumes: volumes,
},
},
}
Expand Down Expand Up @@ -379,7 +387,8 @@ func (feast *FeastServices) setContainers(podSpec *corev1.PodSpec) error {
return nil
}

func (feast *FeastServices) setContainer(containers *[]corev1.Container, feastType FeastServiceType, fsYamlB64 string) {
func (feast *FeastServices) setContainer(containers *[]corev1.Container, feastType FeastServiceType,
fsYamlB64 string) {
tls := feast.getTlsConfigs(feastType)
serviceConfigs := feast.getServiceConfigs(feastType)
defaultServiceConfigs := serviceConfigs.DefaultConfigs
Expand Down Expand Up @@ -416,11 +425,40 @@ func (feast *FeastServices) setContainer(containers *[]corev1.Container, feastTy
ProbeHandler: probeHandler,
PeriodSeconds: 10,
},
VolumeMounts: feast.getVolumeMounts(feastType),
}
applyOptionalContainerConfigs(container, serviceConfigs.OptionalConfigs)
*containers = append(*containers, *container)
}

func (feast *FeastServices) getVolumeMounts(feastType FeastServiceType) (volumeMounts []corev1.VolumeMount) {
appliedServices := feast.Handler.FeatureStore.Status.Applied.Services
if appliedServices == nil {
return []corev1.VolumeMount{} // Return an empty slice to avoid nil issues
}

switch feastType {
case OfflineFeastType:
if feast.isOfflinStore() {
return appliedServices.OfflineStore.VolumeMounts
}
case OnlineFeastType:
if feast.isOnlinStore() {
return appliedServices.OnlineStore.VolumeMounts
}
case RegistryFeastType:
if feast.isLocalRegistry() {
return appliedServices.Registry.Local.VolumeMounts
}
case UIFeastType:
if feast.isUI() {
return appliedServices.UI.VolumeMounts
}
}

return []corev1.VolumeMount{} // Default empty slice
}

func (feast *FeastServices) setRoute(route *routev1.Route, feastType FeastServiceType) error {

svcName := feast.GetFeastServiceName(feastType)
Expand Down

0 comments on commit 348ec68

Please sign in to comment.