From 65f39962a4ef8e71ce5841c44a880349b93e51a2 Mon Sep 17 00:00:00 2001 From: Ricardo Maraschini Date: Tue, 5 Nov 2024 16:38:22 +0100 Subject: [PATCH] feat: add preflight for ip forwarding (#1449) we require users to manually enable ip forwarding on their nodes before installing. this preflight checks if ip forwarding is enabled and fails if it is not. --- pkg/preflights/host-preflight.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/preflights/host-preflight.yaml b/pkg/preflights/host-preflight.yaml index 546a45c7b..4314c81f3 100644 --- a/pkg/preflights/host-preflight.yaml +++ b/pkg/preflights/host-preflight.yaml @@ -148,6 +148,10 @@ spec: exclude: '{{ eq .GlobalCIDR.CIDR "" }}' CIDRRangeAlloc: '{{ .GlobalCIDR.CIDR }}' desiredCIDR: {{.GlobalCIDR.Size}} + - run: + collectorName: "kernel-parameters" + command: "sysctl" + args: ["-a"] analyzers: - cpu: checkName: CPU @@ -834,3 +838,14 @@ spec: - pass: when: "a-subnet-is-available" message: Specified CIDR is available. + - textAnalyze: + checkName: IP forwarding + fileName: host-collectors/run-host/kernel-parameters.txt + regex: 'net.ipv4.ip_forward = 1' + outcomes: + - pass: + when: "true" + message: IP forwarding is enabled. + - fail: + when: "false" + message: IP forwarding must be enabled. To enable it, edit /etc/sysctl.conf, add or uncomment the line 'net.ipv4.ip_forward=1', and run 'sudo sysctl -p'.