Skip to content

Commit f9dcfb5

Browse files
patelchaitanyntkathole
authored andcommitted
fix(operator): Set grpc appProtocol on the offline Service port
The offline server is an Arrow Flight (gRPC) server, but its Service port was rendered with name "http" and no appProtocol. Protocol-aware meshes such as Istio then fall back to HTTP/1.1 and break gRPC traffic. Extend getServiceAppProtocol() to return "grpc" for OfflineFeastType, following the same pattern used for the registry gRPC Service. Signed-off-by: Chaitany Patel <[email protected]>
1 parent d4e9619 commit f9dcfb5

2 files changed

Lines changed: 30 additions & 6 deletions

File tree

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -922,11 +922,13 @@ func (feast *FeastServices) setInitContainer(podSpec *corev1.PodSpec, fsYamlB64
922922
}
923923

924924
// getServiceAppProtocol returns the appProtocol for a Service port.
925-
// The registry gRPC service uses the gRPC protocol, which requires HTTP/2.
926-
// Setting appProtocol allows service meshes (e.g. Istio) and load balancers
927-
// to correctly classify the traffic and avoid downgrading to HTTP/1.1.
925+
// The registry gRPC service and the offline (Arrow Flight) service use the gRPC
926+
// protocol, which requires HTTP/2. Setting appProtocol allows service meshes
927+
// (e.g. Istio) and load balancers to correctly classify the traffic and avoid
928+
// downgrading to HTTP/1.1.
928929
func (feast *FeastServices) getServiceAppProtocol(feastType FeastServiceType, isRestService bool) *string {
929-
if feastType == RegistryFeastType && !isRestService && feast.isRegistryGrpcEnabled() {
930+
if (feastType == RegistryFeastType && !isRestService && feast.isRegistryGrpcEnabled()) ||
931+
feastType == OfflineFeastType {
930932
return ptr.To("grpc")
931933
}
932934
return nil

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

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,8 @@ var _ = Describe("Service AppProtocol Configuration", func() {
857857
Expect(feast.getServiceAppProtocol(OnlineFeastType, false)).To(BeNil())
858858
})
859859

860-
It("should return nil appProtocol for the offline store service", func() {
861-
Expect(feast.getServiceAppProtocol(OfflineFeastType, false)).To(BeNil())
860+
It("should return grpc appProtocol for the offline store service", func() {
861+
Expect(feast.getServiceAppProtocol(OfflineFeastType, false)).To(Equal(ptr.To("grpc")))
862862
})
863863

864864
It("should return nil appProtocol when registry gRPC is disabled", func() {
@@ -896,6 +896,28 @@ var _ = Describe("Service AppProtocol Configuration", func() {
896896
Expect(restSvc.Spec.Ports).To(HaveLen(1))
897897
Expect(restSvc.Spec.Ports[0].AppProtocol).To(BeNil())
898898
})
899+
900+
It("should set grpc appProtocol on the offline Service port", func() {
901+
featureStore.Spec.Services.OfflineStore = &feastdevv1.OfflineStore{
902+
Server: &feastdevv1.ServerConfigs{
903+
ContainerConfigs: feastdevv1.ContainerConfigs{
904+
DefaultCtrConfigs: feastdevv1.DefaultCtrConfigs{
905+
Image: ptr.To("test-image"),
906+
},
907+
},
908+
},
909+
}
910+
Expect(k8sClient.Update(ctx, featureStore)).To(Succeed())
911+
Expect(feast.ApplyDefaults()).To(Succeed())
912+
applySpecToStatus(featureStore)
913+
914+
svc := feast.initFeastSvc(OfflineFeastType)
915+
Expect(svc).NotTo(BeNil())
916+
Expect(feast.setService(svc, OfflineFeastType, false)).To(Succeed())
917+
918+
Expect(svc.Spec.Ports).To(HaveLen(1))
919+
Expect(svc.Spec.Ports[0].AppProtocol).To(Equal(ptr.To("grpc")))
920+
})
899921
})
900922

901923
var _ = Describe("Pod Container Failure Messages", func() {

0 commit comments

Comments
 (0)