fix: Improve status.applied updates & add offline pvc unit test by tchughesiv · Pull Request #4871 · feast-dev/feast
func getOfflineMountPath(featureStore *feastdevv1alpha1.FeatureStore) string { if featureStore.Status.Applied.Services != nil { if pvcConfig, ok := hasPvcConfig(featureStore, OfflineFeastType); ok { return pvcConfig.MountPath } if pvcConfig, ok := hasPvcConfig(featureStore, OfflineFeastType); ok { return pvcConfig.MountPath } return EphemeralPath }
func ApplyDefaultsToStatus(cr *feastdevv1alpha1.FeatureStore) { // overwrite status.applied with every reconcile cr.Spec.DeepCopyInto(&cr.Status.Applied) cr.Status.FeastVersion = feastversion.FeastVersion applied := cr.Spec.DeepCopy()
applied := &cr.Status.Applied if applied.Services == nil { applied.Services = &feastdevv1alpha1.FeatureStoreServices{} }
if services.Registry.Local.Persistence.FilePersistence.PvcConfig != nil { pvc := services.Registry.Local.Persistence.FilePersistence.PvcConfig ensurePVCDefaults(pvc, RegistryFeastType) } ensurePVCDefaults(services.Registry.Local.Persistence.FilePersistence.PvcConfig, RegistryFeastType) }
setServiceDefaultConfigs(&services.Registry.Local.ServiceConfigs.DefaultConfigs)
if services.OfflineStore.Persistence.FilePersistence.PvcConfig != nil { pvc := services.OfflineStore.Persistence.FilePersistence.PvcConfig ensurePVCDefaults(pvc, OfflineFeastType) } ensurePVCDefaults(services.OfflineStore.Persistence.FilePersistence.PvcConfig, OfflineFeastType) }
setServiceDefaultConfigs(&services.OfflineStore.ServiceConfigs.DefaultConfigs)
if services.OnlineStore.Persistence.FilePersistence.PvcConfig != nil { pvc := services.OnlineStore.Persistence.FilePersistence.PvcConfig ensurePVCDefaults(pvc, OnlineFeastType) } ensurePVCDefaults(services.OnlineStore.Persistence.FilePersistence.PvcConfig, OnlineFeastType) }
setServiceDefaultConfigs(&services.OnlineStore.ServiceConfigs.DefaultConfigs) } // overwrite status.applied with every reconcile applied.DeepCopyInto(&cr.Status.Applied) }
func setServiceDefaultConfigs(defaultConfigs *feastdevv1alpha1.DefaultConfigs) {
func ensurePVCDefaults(pvc *feastdevv1alpha1.PvcConfig, feastType FeastServiceType) { var storageRequest string switch feastType { case OnlineFeastType: storageRequest = DefaultOnlineStorageRequest case OfflineFeastType: storageRequest = DefaultOfflineStorageRequest case RegistryFeastType: storageRequest = DefaultRegistryStorageRequest } if pvc.Create != nil { ensureRequestedStorage(&pvc.Create.Resources, storageRequest) if pvc.Create.AccessModes == nil { pvc.Create.AccessModes = DefaultPVCAccessModes if pvc != nil { var storageRequest string switch feastType { case OnlineFeastType: storageRequest = DefaultOnlineStorageRequest case OfflineFeastType: storageRequest = DefaultOfflineStorageRequest case RegistryFeastType: storageRequest = DefaultRegistryStorageRequest } if pvc.Create != nil { ensureRequestedStorage(&pvc.Create.Resources, storageRequest) if pvc.Create.AccessModes == nil { pvc.Create.AccessModes = DefaultPVCAccessModes } } } }