Skip to content

Commit b991093

Browse files
committed
feat: Added check for remote registry of referenced FeatureStore
Signed-off-by: ntkathole <[email protected]>
1 parent 06f559c commit b991093

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

‎infra/feast-operator/internal/controller/featurestore_controller_test.go‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,6 +1476,59 @@ var _ = Describe("FeatureStore Controller", func() {
14761476
err = k8sClient.Update(ctx, resource)
14771477
Expect(err).NotTo(HaveOccurred())
14781478
})
1479+
1480+
It("should error if referencing a remote registry without gRPC server enabled", func() {
1481+
const remoteStoreName = "remote-featurestore"
1482+
remoteNamespacedName := types.NamespacedName{
1483+
Name: remoteStoreName,
1484+
Namespace: "default",
1485+
}
1486+
1487+
// Create remote FeatureStore with gRPC disabled
1488+
remote := &feastdevv1alpha1.FeatureStore{
1489+
ObjectMeta: metav1.ObjectMeta{
1490+
Name: remoteStoreName,
1491+
Namespace: "default",
1492+
},
1493+
Spec: feastdevv1alpha1.FeatureStoreSpec{
1494+
FeastProject: feastProject,
1495+
Services: &feastdevv1alpha1.FeatureStoreServices{
1496+
Registry: &feastdevv1alpha1.Registry{
1497+
Local: &feastdevv1alpha1.LocalRegistryConfig{
1498+
Server: &feastdevv1alpha1.RegistryServerConfigs{
1499+
GRPC: ptr(false),
1500+
RestAPI: ptr(true),
1501+
},
1502+
},
1503+
},
1504+
},
1505+
},
1506+
}
1507+
Expect(k8sClient.Create(ctx, remote)).To(Succeed())
1508+
reconciler := &FeatureStoreReconciler{
1509+
Client: k8sClient,
1510+
Scheme: k8sClient.Scheme(),
1511+
}
1512+
_, err := reconciler.Reconcile(ctx, reconcile.Request{
1513+
NamespacedName: remoteNamespacedName,
1514+
})
1515+
Expect(err).NotTo(HaveOccurred())
1516+
1517+
// Update main FeatureStore to reference the remote registry
1518+
Expect(k8sClient.Get(ctx, typeNamespacedName, featurestore)).To(Succeed())
1519+
featurestore.Spec.FeastProject = feastProject
1520+
featurestore.Spec.Services.Registry = &feastdevv1alpha1.Registry{
1521+
Remote: &feastdevv1alpha1.RemoteRegistryConfig{
1522+
FeastRef: &feastdevv1alpha1.FeatureStoreRef{Name: remoteStoreName},
1523+
},
1524+
}
1525+
Expect(k8sClient.Update(ctx, featurestore)).To(Succeed())
1526+
_, err = reconciler.Reconcile(ctx, reconcile.Request{
1527+
NamespacedName: typeNamespacedName,
1528+
})
1529+
Expect(err).To(HaveOccurred())
1530+
Expect(err.Error()).To(ContainSubstring("must have gRPC server enabled"))
1531+
})
14791532
})
14801533
})
14811534

‎infra/feast-operator/internal/controller/services/services.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,11 @@ func (feast *FeastServices) setRemoteRegistryURL() error {
877877
remoteFeast.isRegistryServer() &&
878878
apimeta.IsStatusConditionTrue(remoteFeast.Handler.FeatureStore.Status.Conditions, feastdevv1alpha1.RegistryReadyType) &&
879879
len(remoteFeast.Handler.FeatureStore.Status.ServiceHostnames.Registry) > 0 {
880+
// Check if gRPC server is enabled
881+
registry := remoteFeast.Handler.FeatureStore.Status.Applied.Services.Registry
882+
if registry.Local.Server.GRPC == nil || !*registry.Local.Server.GRPC {
883+
return errors.New("Remote feast registry of referenced FeatureStore '" + remoteFeast.Handler.FeatureStore.Name + "' must have gRPC server enabled")
884+
}
880885
feast.Handler.FeatureStore.Status.ServiceHostnames.Registry = remoteFeast.Handler.FeatureStore.Status.ServiceHostnames.Registry
881886
} else {
882887
return errors.New("Remote feast registry of referenced FeatureStore '" + remoteFeast.Handler.FeatureStore.Name + "' is not ready")

0 commit comments

Comments
 (0)