Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(preflights): replace run collector with host sysctl for ip_forwarding #1507

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions pkg/preflights/host-preflight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ spec:
exclude: '{{ eq .GlobalCIDR.CIDR "" }}'
CIDRRangeAlloc: '{{ .GlobalCIDR.CIDR }}'
desiredCIDR: {{.GlobalCIDR.Size}}
- run:
collectorName: "kernel-parameters"
command: "sysctl"
args: ["-a"]
- sysctl: {}
analyzers:
- cpu:
Expand Down Expand Up @@ -839,17 +835,6 @@ 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'.
- sysctl:
checkName: "ARP Filter default value for newly created interfaces"
outcomes:
Expand Down Expand Up @@ -886,3 +871,12 @@ spec:
- pass:
when: 'net.ipv4.conf.all.arp_ignore == 0'
message: "ARP ignore is disabled for all interfaces on the host."
- sysctl:
checkName: "IP forwarding"
outcomes:
- fail:
when: 'net.ipv4.ip_forward == 0'
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'."
- pass:
when: 'net.ipv4.ip_forward > 0'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs - https://www.kernel.org/doc/html/latest/networking/ip-sysctl.html:

ip_forward - BOOLEAN

   0 - disabled (default)

   not 0 - enabled

message: "IP forwarding is enabled."
Loading