fix worker node external conectivity - #49
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe bootstrap role removes default iptables reject rules and adds default-interface NAT masquerading. The values-prep role assigns ChangesNetwork setup
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
ansible/roles/bootstrap/tasks/main.yml (1)
54-57: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winMake the MASQUERADE rule idempotent.
iptables -Aadds a duplicate rule every time this role runs, and stale rules remain if the default interface changes. Useansible.posix.iptableswithstate: present, or check withiptables -Cbefore appending.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ansible/roles/bootstrap/tasks/main.yml` around lines 54 - 57, Update the “masquerade on public interface” task to manage the MASQUERADE rule idempotently, preferably using ansible.posix.iptables with state: present and the existing default_route.stdout interface. Ensure reruns do not duplicate the rule and changes to the default interface remove the stale rule.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ansible/roles/bootstrap/tasks/main.yml`:
- Around line 48-56: Update the “get default route” task to extract the
interface following the dev field from exactly one default route, and fail
explicitly when no default interface is found. Ensure the “masquerade on public
interface” task uses that validated single interface value when constructing the
iptables command.
---
Nitpick comments:
In `@ansible/roles/bootstrap/tasks/main.yml`:
- Around line 54-57: Update the “masquerade on public interface” task to manage
the MASQUERADE rule idempotently, preferably using ansible.posix.iptables with
state: present and the existing default_route.stdout interface. Ensure reruns do
not duplicate the rule and changes to the default interface remove the stale
rule.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: a857bbc3-6de6-419d-ab5f-ec52a19ab676
📒 Files selected for processing (2)
ansible/roles/bootstrap/tasks/main.ymlansible/roles/values-prep/tasks/main.yml
💤 Files with no reviewable changes (1)
- ansible/roles/values-prep/tasks/main.yml
| - name: get default route | ||
| shell: | | ||
| ip r | grep default | cut -d ' ' -f5 | ||
| register: default_route | ||
| become: yes | ||
|
|
||
| - name: masquerade on public interface | ||
| shell: | | ||
| iptables -t nat -A POSTROUTING -o {{ default_route.stdout }} -j MASQUERADE |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
git ls-files ansible/roles/bootstrap/tasks/main.yml
wc -l ansible/roles/bootstrap/tasks/main.yml
cat -n ansible/roles/bootstrap/tasks/main.yml | sed -n '1,120p'Repository: redhat-performance/JetBrew
Length of output: 3374
Select one default interface before building the NAT rule. (ansible/roles/bootstrap/tasks/main.yml:48-56) ip r | grep default | cut -d ' ' -f5 can return multiple or empty values depending on route output, which makes the iptables command invalid; parse the dev field from a single default route and fail when none is found.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@ansible/roles/bootstrap/tasks/main.yml` around lines 48 - 56, Update the “get
default route” task to extract the interface following the dev field from
exactly one default route, and fail explicitly when no default interface is
found. Ensure the “masquerade on public interface” task uses that validated
single interface value when constructing the iptables command.
|
LGTM! |
No description provided.