Skip to content

Commit 7007553

Browse files
committed
HTTP/3 add quic to default server, filter out backlog parameter for quic, fix Helm Chart containerUdpPort value type
1 parent f794185 commit 7007553

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

charts/ingress-nginx/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ metadata:
318318
| controller.containerName | string | `"controller"` | Configures the controller container name |
319319
| controller.containerPort | object | `{"http":80,"https":443}` | Configures the TCP ports that the nginx-controller listens on |
320320
| controller.containerSecurityContext | object | `{}` | Security context for controller containers |
321-
| controller.containerUdpPort | list | `[]` | Configures the UDP ports that the nginx-controller listens on |
321+
| controller.containerUdpPort | object | `{}` | Configures the UDP ports that the nginx-controller listens on |
322322
| controller.customTemplate.configMapKey | string | `""` | |
323323
| controller.customTemplate.configMapName | string | `""` | |
324324
| controller.disableLeaderElection | bool | `false` | This configuration disable Nginx Controller Leader Election |

charts/ingress-nginx/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ controller:
5252
http: 80
5353
https: 443
5454
# -- Configures the UDP ports that the nginx-controller listens on
55-
containerUdpPort: []
55+
containerUdpPort: {}
5656
# quic: 443
5757
# -- Global configuration passed to the ConfigMap consumed by the controller. Values may contain Helm templates.
5858
# Ref.: https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/

internal/ingress/controller/template/template.go

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ func buildHTTPListener(t, s interface{}) string {
13841384
addrV4 = tc.Cfg.BindAddressIpv4
13851385
}
13861386

1387-
co := commonListenOptions(&tc, hostname)
1387+
co := commonListenOptions(&tc, hostname, true)
13881388

13891389
out = append(out, httpListener(addrV4, co, &tc)...)
13901390

@@ -1417,14 +1417,18 @@ func buildHTTPSListener(t, s interface{}) string {
14171417
return ""
14181418
}
14191419

1420-
co := commonListenOptions(&tc, hostname)
1420+
httpsCo := commonListenOptions(&tc, hostname, true)
1421+
quicCo := commonListenOptions(&tc, hostname, false)
14211422

14221423
addrV4 := []string{""}
14231424
if len(tc.Cfg.BindAddressIpv4) > 0 {
14241425
addrV4 = tc.Cfg.BindAddressIpv4
14251426
}
14261427

1427-
out = append(out, httpsListener(addrV4, co, &tc)...)
1428+
out = append(out, httpsListener(addrV4, httpsCo, &tc)...)
1429+
if tc.IsQUICEnabled {
1430+
out = append(out, quicListener(addrV4, quicCo, &tc)...)
1431+
}
14281432

14291433
if !tc.IsIPV6Enabled {
14301434
return strings.Join(out, "\n")
@@ -1435,12 +1439,15 @@ func buildHTTPSListener(t, s interface{}) string {
14351439
addrV6 = tc.Cfg.BindAddressIpv6
14361440
}
14371441

1438-
out = append(out, httpsListener(addrV6, co, &tc)...)
1442+
out = append(out, httpsListener(addrV6, httpsCo, &tc)...)
1443+
if tc.IsQUICEnabled {
1444+
out = append(out, quicListener(addrV6, quicCo, &tc)...)
1445+
}
14391446

14401447
return strings.Join(out, "\n")
14411448
}
14421449

1443-
func commonListenOptions(template *config.TemplateConfig, hostname string) string {
1450+
func commonListenOptions(template *config.TemplateConfig, hostname string, withBacklog bool) string {
14441451
var out []string
14451452

14461453
if template.Cfg.UseProxyProtocol {
@@ -1459,7 +1466,9 @@ func commonListenOptions(template *config.TemplateConfig, hostname string) strin
14591466
out = append(out, "reuseport")
14601467
}
14611468

1462-
out = append(out, fmt.Sprintf("backlog=%v", template.BacklogSize))
1469+
if withBacklog {
1470+
out = append(out, fmt.Sprintf("backlog=%v", template.BacklogSize))
1471+
}
14631472

14641473
return strings.Join(out, " ")
14651474
}
@@ -1509,13 +1518,12 @@ func httpsListener(addresses []string, co string, tc *config.TemplateConfig) []s
15091518

15101519
out = append(out, strings.Join(lo, " "))
15111520
}
1512-
if !tc.IsQUICEnabled {
1513-
return out
1514-
}
1515-
if strings.Contains(co, "backlog=") {
1516-
klog.V(3).InfoS("Skipping HTTP/3 because of incompatible backlog parameter")
1517-
return out
1518-
}
1521+
1522+
return out
1523+
}
1524+
1525+
func quicListener(addresses []string, co string, tc *config.TemplateConfig) []string {
1526+
out := make([]string, 0)
15191527
for _, address := range addresses {
15201528
lo := []string{"listen"}
15211529

0 commit comments

Comments
 (0)