Skip to content

Commit 15e640c

Browse files
committed
fix(operator): set appProtocol: grpc on registry gRPC Service
The registry Service was created with port name 'http' and no appProtocol. This caused service meshes (notably Istio) to mis-classify the gRPC traffic as HTTP/1.1, breaking connections in two places simultaneously: - Client-side envoy: downgrades to HTTP/1.1 because it sees name='http' - Server-side envoy: builds its inbound listener as HTTP/1.1 and rejects incoming HTTP/2 (gRPC) frames with a protocol error Setting appProtocol: 'grpc' on the Service port corrects both sidecars' view of the port. In Istio's sidecar mode this allows normal mTLS to flow end-to-end with no workarounds. The same field is respected by other service meshes and cloud load balancers that do protocol detection. The fix only applies to the registry gRPC Service (not REST, not online/ offline stores) via a new getServiceAppProtocol helper.
1 parent 50ad181 commit 15e640c

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

  • infra/feast-operator/internal/controller/services

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3333
"k8s.io/apimachinery/pkg/types"
3434
"k8s.io/apimachinery/pkg/util/intstr"
35+
"k8s.io/utils/ptr"
3536
"sigs.k8s.io/controller-runtime/pkg/client"
3637
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
3738
"sigs.k8s.io/controller-runtime/pkg/log"
@@ -768,6 +769,17 @@ func (feast *FeastServices) setInitContainer(podSpec *corev1.PodSpec, fsYamlB64
768769
}
769770
}
770771

772+
// getServiceAppProtocol returns the appProtocol for a Service port.
773+
// The registry gRPC service uses the gRPC protocol, which requires HTTP/2.
774+
// Setting appProtocol allows service meshes (e.g. Istio) and load balancers
775+
// to correctly classify the traffic and avoid downgrading to HTTP/1.1.
776+
func (feast *FeastServices) getServiceAppProtocol(feastType FeastServiceType, isRestService bool) *string {
777+
if feastType == RegistryFeastType && !isRestService && feast.isRegistryGrpcEnabled() {
778+
return ptr.To("grpc")
779+
}
780+
return nil
781+
}
782+
771783
func (feast *FeastServices) setService(svc *corev1.Service, feastType FeastServiceType, isRestService bool) error {
772784
svc.Labels = feast.getFeastTypeLabels(feastType)
773785
if feast.isOpenShiftTls(feastType) {
@@ -829,10 +841,11 @@ func (feast *FeastServices) setService(svc *corev1.Service, feastType FeastServi
829841
Type: corev1.ServiceTypeClusterIP,
830842
Ports: []corev1.ServicePort{
831843
{
832-
Name: scheme,
833-
Port: port,
834-
Protocol: corev1.ProtocolTCP,
835-
TargetPort: intstr.FromInt(int(targetPort)),
844+
Name: scheme,
845+
Port: port,
846+
Protocol: corev1.ProtocolTCP,
847+
TargetPort: intstr.FromInt(int(targetPort)),
848+
AppProtocol: feast.getServiceAppProtocol(feastType, isRestService),
836849
},
837850
},
838851
}

0 commit comments

Comments
 (0)