From 41aad67d7fe861be227d7a15c0ece19a65ba1f21 Mon Sep 17 00:00:00 2001 From: Daniele Martinoli Date: Thu, 7 Nov 2024 10:25:30 +0100 Subject: [PATCH] added IsValidOfflineStoreFilePersistenceType to the API definitions Signed-off-by: Daniele Martinoli --- .../api/v1alpha1/featurestore_types.go | 17 +++++++++++++++++ .../controller/featurestore_controller.go | 6 +++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/infra/feast-operator/api/v1alpha1/featurestore_types.go b/infra/feast-operator/api/v1alpha1/featurestore_types.go index 440518db74..2b6c92bca9 100644 --- a/infra/feast-operator/api/v1alpha1/featurestore_types.go +++ b/infra/feast-operator/api/v1alpha1/featurestore_types.go @@ -17,6 +17,8 @@ limitations under the License. package v1alpha1 import ( + "fmt" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -91,6 +93,21 @@ var ValidOfflineStoreFilePersistenceTypes = []string{ "duckdb", } +var validOfflineStoreFilePersistenceType = []string{ + "dask", + "duckdb", +} + +// A function to validate the file persistence types for offline stores +func IsValidOfflineStoreFilePersistenceType(value string) (bool, error) { + for _, v := range validOfflineStoreFilePersistenceType { + if v == value { + return true, nil + } + } + return false, fmt.Errorf("invalid file type %s for offline store", value) +} + // OnlineStore configures the deployed online store service type OnlineStore struct { ServiceConfigs `json:",inline"` diff --git a/infra/feast-operator/internal/controller/featurestore_controller.go b/infra/feast-operator/internal/controller/featurestore_controller.go index 7c78b79d59..708e17efae 100644 --- a/infra/feast-operator/internal/controller/featurestore_controller.go +++ b/infra/feast-operator/internal/controller/featurestore_controller.go @@ -77,7 +77,11 @@ func (r *FeatureStoreReconciler) Reconcile(ctx context.Context, req ctrl.Request currentStatus := cr.Status.DeepCopy() // initial status defaults must occur before feast deployment - services.ApplyDefaultsToStatus(cr) + if err := services.ApplyDefaultsToStatus(cr); err != nil { + logger.Error(err, "Error updating the FeatureStore status") + result = ctrl.Result{Requeue: true, RequeueAfter: RequeueDelayError} + return result, err + } result, recErr = r.deployFeast(ctx, cr) if cr.DeletionTimestamp == nil && !reflect.DeepEqual(currentStatus, cr.Status) { if err = r.Client.Status().Update(ctx, cr); err != nil {