@@ -60,6 +60,7 @@ var _ = Describe("ProxyConfigHandler", func() {
6060 containerProxyVerifySubjectAltName []string
6161 containerProxyRequireClientCerts bool
6262 adsServers []string
63+ http2Enabled bool
6364 )
6465
6566 BeforeEach (func () {
@@ -101,6 +102,7 @@ var _ = Describe("ProxyConfigHandler", func() {
101102 "10.255.217.2:15010" ,
102103 "10.255.217.3:15010" ,
103104 }
105+ http2Enabled = true
104106 })
105107
106108 JustBeforeEach (func () {
@@ -114,6 +116,7 @@ var _ = Describe("ProxyConfigHandler", func() {
114116 reloadDuration ,
115117 reloadClock ,
116118 adsServers ,
119+ http2Enabled ,
117120 )
118121 Eventually (rotatingCredChan ).Should (BeSent (containerstore.Credential {
119122 Cert : "some-cert" ,
@@ -394,6 +397,7 @@ var _ = Describe("ProxyConfigHandler", func() {
394397 statPrefix : "0-stats" ,
395398 clusterName : "0-service-cluster" ,
396399 requireClientCertificate : false ,
400+ alpnProtocols : []string {"h2,http/1.1" },
397401 }.check (proxyConfig .StaticResources .Listeners [0 ])
398402 })
399403 })
@@ -548,6 +552,7 @@ var _ = Describe("ProxyConfigHandler", func() {
548552 statPrefix : "0-stats" ,
549553 clusterName : "0-service-cluster" ,
550554 requireClientCertificate : true ,
555+ alpnProtocols : []string {"h2,http/1.1" },
551556 }.check (proxyConfig .StaticResources .Listeners [0 ])
552557
553558 adsConfigSource := & envoy_core.ConfigSource {
@@ -621,6 +626,31 @@ var _ = Describe("ProxyConfigHandler", func() {
621626 })
622627 })
623628
629+ Context ("when HTTP/2 is disabled" , func () {
630+ BeforeEach (func () {
631+ http2Enabled = false
632+ })
633+
634+ It ("creates a proxy config without ALPN for listeners" , func () {
635+ err := proxyConfigHandler .Update (containerstore.Credential {Cert : "cert" , Key : "key" }, container )
636+ Expect (err ).NotTo (HaveOccurred ())
637+ Eventually (proxyConfigFile ).Should (BeAnExistingFile ())
638+
639+ var proxyConfig envoy_bootstrap.Bootstrap
640+ Expect (yamlFileToProto (proxyConfigFile , & proxyConfig )).To (Succeed ())
641+
642+ Expect (proxyConfig .StaticResources .Listeners ).To (HaveLen (1 ))
643+ expectedListener {
644+ name : "listener-8080" ,
645+ listenPort : 61001 ,
646+ statPrefix : "0-stats" ,
647+ clusterName : "0-service-cluster" ,
648+ requireClientCertificate : true ,
649+ alpnProtocols : nil ,
650+ }.check (proxyConfig .StaticResources .Listeners [0 ])
651+ })
652+ })
653+
624654 Context ("with multiple port mappings" , func () {
625655 BeforeEach (func () {
626656 container .Ports = []executor.PortMapping {
@@ -683,6 +713,7 @@ var _ = Describe("ProxyConfigHandler", func() {
683713 statPrefix : "0-stats" ,
684714 clusterName : "0-service-cluster" ,
685715 requireClientCertificate : true ,
716+ alpnProtocols : []string {"h2,http/1.1" },
686717 }.check (proxyConfig .StaticResources .Listeners [0 ])
687718
688719 expectedListener {
@@ -691,6 +722,7 @@ var _ = Describe("ProxyConfigHandler", func() {
691722 statPrefix : "1-stats" ,
692723 clusterName : "1-service-cluster" ,
693724 requireClientCertificate : true ,
725+ alpnProtocols : []string {"h2,http/1.1" },
694726 }.check (proxyConfig .StaticResources .Listeners [1 ])
695727 })
696728
@@ -846,6 +878,7 @@ type expectedListener struct {
846878 statPrefix string
847879 clusterName string
848880 requireClientCertificate bool
881+ alpnProtocols []string
849882}
850883
851884func (l expectedListener ) check (listener * envoy_listener.Listener ) {
@@ -869,7 +902,7 @@ func (l expectedListener) check(listener *envoy_listener.Listener) {
869902 Expect (filterChain .TransportSocket .Name ).To (Equal (l .name ))
870903
871904 Expect (downstreamTlsContext .RequireClientCertificate .Value ).To (Equal (l .requireClientCertificate ))
872- Expect (downstreamTlsContext .CommonTlsContext .AlpnProtocols ).To (Equal ([] string { "h2,http/1.1" } ))
905+ Expect (downstreamTlsContext .CommonTlsContext .AlpnProtocols ).To (Equal (l . alpnProtocols ))
873906 Expect (downstreamTlsContext .CommonTlsContext .TlsCertificateSdsSecretConfigs ).To (ConsistOf (
874907 & envoy_tls.SdsSecretConfig {
875908 Name : "server-cert-and-key" ,
0 commit comments