Skip to content

Check net.ipv4.ip_forward in validate-cks-node - #14773

Open
bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:cks-validate-node-ip-forward
Open

bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:cks-validate-node-ip-forward

Conversation

@bhouse-nexthop

Copy link
Copy Markdown
Collaborator

Description

Fixes #14772

validate-cks-node now also checks net.ipv4.ip_forward, which kubeadm join preflight requires.

Before After
ip_forward=0, packages OK exit 0, join fails later in kubeadm preflight message + exit 1, add rejected up front
ip_forward=0, packages missing packages reported both reported in one run
ip_forward=1 unchanged unchanged
  • Reads /proc/sys/net/ipv4/ip_forward rather than calling sysctl, which is not on a non-root user's PATH on Debian.
  • Checks the live value. A value set at runtime but not persisted will pass here and still be lost on the reboot that follows.

Touches the same script as #14756 (missing-package array). The two merge cleanly; at most a trivial conflict depending on merge order.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Bug Severity

  • Minor

How Has This Been Tested?

Ran the script in bash with dpkg stubbed and the /proc path pointed at a temp file:

dpkg ip_forward Exit Output
installed 1 0 0 / 0
installed 0 1 ip_forward message, 0 / 0
installed file missing 1 ip_forward message, 0 / 0
missing 1 1 package list
missing 0 1 ip_forward message + package list

bash -n clean.

- validate-cks-node now fails when /proc/sys/net/ipv4/ip_forward is not 1
- kubeadm join preflight requires it; without it an added external node
  passes validation, is rebooted into the join userdata and then fails
  kubeadm preflight with a less obvious error
- reported together with any missing packages, so both show in one run
- reads /proc rather than calling sysctl, which is not on a non-root
  user's PATH on Debian

Signed-off-by: Brad House <bhouse@nexthop.ai>
@codecov

codecov Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.32%. Comparing base (b56bbc2) to head (70ee63a).

Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14773      +/-   ##
============================================
- Coverage     18.32%   18.32%   -0.01%     
+ Complexity    16644    16643       -1     
============================================
  Files          5939     5939              
  Lines        537787   537787              
  Branches      65932    65932              
============================================
- Hits          98544    98543       -1     
- Misses       428033   428034       +1     
  Partials      11210    11210              
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.41% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

exit 1
else
echo 0
exit ${IP_FORWARD_DISABLED:-0}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is ok.
but if there are more checks in the future, this is not a good way.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants