Skip to content

Commit dfcb447

Browse files
authored
Merge pull request kubernetes#122176 from slashpai/disable_http2_flag
Expose DisableHTTP2 flag in SecureServingOptions
2 parents 57b406a + e2503e5 commit dfcb447

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

staging/src/k8s.io/apiserver/pkg/server/options/serving.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ type SecureServingOptions struct {
4444
// BindNetwork is the type of network to bind to - defaults to "tcp", accepts "tcp",
4545
// "tcp4", and "tcp6".
4646
BindNetwork string
47+
// DisableHTTP2Serving indicates that http2 serving should not be enabled.
48+
DisableHTTP2Serving bool
4749
// Required set to true means that BindPort cannot be zero.
4850
Required bool
4951
// ExternalAddress is the address advertised, even if BindAddress is a loopback. By default this
@@ -163,6 +165,9 @@ func (s *SecureServingOptions) AddFlags(fs *pflag.FlagSet) {
163165
}
164166
fs.IntVar(&s.BindPort, "secure-port", s.BindPort, desc)
165167

168+
fs.BoolVar(&s.DisableHTTP2Serving, "disable-http2-serving", s.DisableHTTP2Serving,
169+
"If true, HTTP2 serving will be disabled [default=false]")
170+
166171
fs.StringVar(&s.ServerCert.CertDirectory, "cert-dir", s.ServerCert.CertDirectory, ""+
167172
"The directory where the TLS certs are located. "+
168173
"If --tls-cert-file and --tls-private-key-file are provided, this flag will be ignored.")
@@ -256,6 +261,7 @@ func (s *SecureServingOptions) ApplyTo(config **server.SecureServingInfo) error
256261
*config = &server.SecureServingInfo{
257262
Listener: s.Listener,
258263
HTTP2MaxStreamsPerConnection: s.HTTP2MaxStreamsPerConnection,
264+
DisableHTTP2: s.DisableHTTP2Serving,
259265
}
260266
c := *config
261267

staging/src/k8s.io/apiserver/pkg/server/options/serving_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,8 @@ func TestServerRunWithSNI(t *testing.T) {
290290
KeyFile: serverKeyFile,
291291
},
292292
},
293-
SNICertKeys: namedCertKeys,
293+
DisableHTTP2Serving: true,
294+
SNICertKeys: namedCertKeys,
294295
}).WithLoopback()
295296
// use a random free port
296297
ln, err := net.Listen("tcp", "127.0.0.1:0")

0 commit comments

Comments
 (0)