Skip to content

Commit d78f57b

Browse files
haywoodshvepatel
andauthored
Add command line argument to manually disable IPV6 listeners for unsupported clusters (#3040)
* Add command line argument to disable IPV6 listeners * update helm chart and documentation * Add automated test * update documentation * fix import Co-authored-by: Venktesh <[email protected]>
1 parent d18631e commit d78f57b

29 files changed

+347
-20
lines changed

cmd/nginx-ingress/flags.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ var (
180180
includeYearInLogs = flag.Bool("include-year", false,
181181
"Option to include the year in the log header")
182182

183+
disableIPV6 = flag.Bool("disable-ipv6", false,
184+
`Disable IPV6 listeners explicitly for nodes that do not support the IPV6 stack`)
185+
183186
startupCheckFn func() error
184187
)
185188

cmd/nginx-ingress/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func main() {
7575
cfgParams = processConfigMaps(kubeClient, cfgParams, nginxManager, templateExecutor)
7676

7777
staticCfgParams := &configs.StaticConfigParams{
78+
DisableIPV6: *disableIPV6,
7879
HealthStatus: *healthStatus,
7980
HealthStatusURI: *healthStatusURI,
8081
NginxStatus: *nginxStatus,
@@ -149,6 +150,7 @@ func main() {
149150
SnippetsEnabled: *enableSnippets,
150151
CertManagerEnabled: *enableCertManager,
151152
ExternalDNSEnabled: *enableExternalDNS,
153+
IsIPV6Disabled: *disableIPV6,
152154
}
153155

154156
lbc := k8s.NewLoadBalancerController(lbcInput)

deployments/helm-chart/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ Parameter | Description | Default
245245
`controller.enableLatencyMetrics` | Enable collection of latency metrics for upstreams. Requires `prometheus.create`. | false
246246
`controller.minReadySeconds` | Specifies the minimum number of seconds for which a newly created Pod should be ready without any of its containers crashing, for it to be considered available. [docs](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#min-ready-seconds) | 0
247247
`controller.strategy` | Specifies the strategy used to replace old Pods by new ones. [docs](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy) | {}
248+
`controller.disableIPV6` | Disable IPV6 listeners explicitly for nodes that do not support the IPV6 stack. | false
248249
`rbac.create` | Configures RBAC. | true
249250
`prometheus.create` | Expose NGINX or NGINX Plus metrics in the Prometheus format. | false
250251
`prometheus.port` | Configures the port to scrape the metrics. | 9113

deployments/helm-chart/templates/controller-daemonset.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ spec:
192192
- -enable-custom-resources={{ .Values.controller.enableCustomResources }}
193193
- -enable-snippets={{ .Values.controller.enableSnippets }}
194194
- -include-year={{ .Values.controller.includeYear }}
195+
- -disable-ipv6={{ .Values.controller.disableIPV6 }}
195196
{{- if .Values.controller.enableCustomResources }}
196197
- -enable-tls-passthrough={{ .Values.controller.enableTLSPassthrough }}
197198
- -enable-preview-policies={{ .Values.controller.enablePreviewPolicies }}

deployments/helm-chart/templates/controller-deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ spec:
195195
- -enable-custom-resources={{ .Values.controller.enableCustomResources }}
196196
- -enable-snippets={{ .Values.controller.enableSnippets }}
197197
- -include-year={{ .Values.controller.includeYear }}
198+
- -disable-ipv6={{ .Values.controller.disableIPV6 }}
198199
{{- if .Values.controller.enableCustomResources }}
199200
- -enable-tls-passthrough={{ .Values.controller.enableTLSPassthrough }}
200201
- -enable-preview-policies={{ .Values.controller.enablePreviewPolicies }}

deployments/helm-chart/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@ controller:
382382
## Enable collection of latency metrics for upstreams. Requires prometheus.create.
383383
enableLatencyMetrics: false
384384

385+
## Disable IPV6 listeners explicitly for nodes that do not support the IPV6 stack.
386+
disableIPV6: false
387+
385388
rbac:
386389
## Configures RBAC.
387390
create: true

docs/content/configuration/global-configuration/command-line-arguments.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,3 +459,11 @@ The HTTP port for the readiness endpoint.
459459

460460
Format: `[1024 - 65535]` (default `8081`)
461461
&nbsp;
462+
463+
### -disable-ipv6
464+
465+
Disable IPV6 listeners explicitly for nodes that do not support the IPV6 stack.
466+
467+
Default `false`.
468+
&nbsp;
469+
<a name="cmdoption-disable-ipv6"></a>

docs/content/installation/installation-with-helm.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ The following tables lists the configurable parameters of the NGINX Ingress Cont
237237
|``controller.enableLatencyMetrics`` | Enable collection of latency metrics for upstreams. Requires ``prometheus.create``. | false |
238238
|``controller.minReadySeconds`` | Specifies the minimum number of seconds for which a newly created Pod should be ready, without any of its containers crashing, for it to be considered available. [docs](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#min-ready-seconds) | 0 |
239239
|``controller.strategy`` | Specifies the strategy used to replace old Pods with new ones. [docs](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy) | {} |
240+
| `controller.disableIPV6` | Disable IPV6 listeners explicitly for nodes that do not support the IPV6 stack. | false |
240241
|``rbac.create`` | Configures RBAC. | true |
241242
|``prometheus.create`` | Expose NGINX or NGINX Plus metrics in the Prometheus format. | false |
242243
|``prometheus.port`` | Configures the port to scrape the metrics. | 9113 |

internal/configs/config_params.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ type ConfigParams struct {
111111

112112
// StaticConfigParams holds immutable NGINX configuration parameters that affect the main NGINX config.
113113
type StaticConfigParams struct {
114+
DisableIPV6 bool
114115
HealthStatus bool
115116
HealthStatusURI string
116117
NginxStatus bool

internal/configs/configmaps.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ func GenerateNginxMainConfig(staticCfgParams *StaticConfigParams, config *Config
553553
AccessLogOff: config.MainAccessLogOff,
554554
DefaultServerAccessLogOff: config.DefaultServerAccessLogOff,
555555
DefaultServerReturn: config.DefaultServerReturn,
556+
DisableIPV6: staticCfgParams.DisableIPV6,
556557
ErrorLogLevel: config.MainErrorLogLevel,
557558
HealthStatus: staticCfgParams.HealthStatus,
558559
HealthStatusURI: staticCfgParams.HealthStatusURI,

0 commit comments

Comments
 (0)