contour icon indicating copy to clipboard operation
contour copied to clipboard

Infer type of transport from service port name

Open bobbytables opened this issue 7 years ago • 1 comments

The Istio project does this and I think it's a nice feature. Basically if you define a port with a prefix of http, it sets the codec to http1.1 for the envoy cluster / endpoints.

If you specify grpc for the port name, it infers http2 and sets it accordingly. I think this is much nice than the annotation that you must add to the services as you may have ports that are http and grpc accordingly.

Basically:

apiVersion: v1
kind: Service
metadata:
  name: sessions-grpc-gateway
  namespace: applications
spec:
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    load-balancer-sessions: 'true'
  sessionAffinity: None
  type: ClusterIP

The port http would automatically be assigned http1.1, whereas if it were set to grpc or http2 then we could automatically set that codec to http2 too.

bobbytables avatar May 07 '18 21:05 bobbytables

Thank you for this suggestion. I can't promise I can get too it soon, but I think this is possible to add in a backward compatible way with the current annotation.

davecheney avatar May 11 '18 06:05 davecheney