@@ -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+
771783func (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