emissary-ingress / emissary

open source Kubernetes-native API gateway for microservices built on the Envoy Proxy
https://www.getambassador.io
Apache License 2.0
4.38k stars 688 forks source link

Support HTTP/2 upstream #1936

Open psalaberria002 opened 5 years ago

psalaberria002 commented 5 years ago

Please describe your use case / problem. In Envoy it is possible to set alpn_protocols: h2 for upstream services so the connections are HTTP/2. For that to work http2_protocol_options must be set as explained in https://www.envoyproxy.io/docs/envoy/latest/api-v2/api/v2/cds.proto#cluster .

I noticed that the grpc flag in the Mappings sets http2_protocol_options already, but my service is not grpc, and it seems hacky to abuse the flag for making HTTP/2 work :) See https://github.com/datawire/ambassador/blob/4b57121fdf8289f0baa71de6dc9d4d94e486b49c/python/ambassador/envoy/v2/v2cluster.py#L67-L68

Describe the solution you'd like If alpn_protocols contains h2, http2_protocol_options should be set in the cluster config. I assume the grpc flag does more than just setting that field in the configs.

---
apiVersion: getambassador.io/v1
kind: Mapping
metadata:
  name: http2-test
spec:
  prefix: /http2-test
  service: "https://http2-test"
  tls: http2-test
  grpc: True # ??? What's the purpose of this flag? Is it only there for adding http2_protocol_options? If so, maybe that should be renamed.
---
apiVersion: getambassador.io/v1
kind: TLSContext
metadata:
  name: http2-test
spec:
  alpn_protocols: h2
  min_tls_version: v1.2
  secret: ambassador-dev-certs
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

psalaberria002 commented 4 years ago

Should not be closed

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

psalaberria002 commented 4 years ago

Still an issue.

daudo commented 4 years ago

jumping on board, too. I'm quite surprised that it doesn't seem to be (officially) supported yet.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

psalaberria002 commented 4 years ago

should not be closed

kflynn commented 4 years ago

Pinning this so it won't go stale again. @psalaberria002, the http2_protocol_options is currently the only thing the grpc flag affects, but... yeah, I hear you, it's not the Right Way™ to manage that.

iNoahNothing commented 4 years ago

It appears we forgot to reopen it along with pinning 🙂