Skip to content

fix(local-ca): map app hosts to the internal address when 321 runs alone - #146

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/901-internal-zone-target
Nov 13, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/901-internal-zone-target

Conversation

@znerol2

@znerol2 znerol2 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Summary

On a 1:1-NAT node, the inventory's k3s_node_ip is the public address (the SSH target). Playbook 300 rebinds it to the node's local address through tasks/resolve-k3s-node-ip.yml. Playbooks 321 and 694 didn't, so running either on its own wrote the public address into the CoreDNS custom zone, the node's /etc/hosts and the born inventory. In-cluster traffic to the app hosts then left the node and came back through the provider's NAT.

Changes

  • 321 and 694 gather network facts and import the same resolver, so the result no longer depends on which plays ran earlier in the run. In 321 this happens only in the local-CA lane.
  • Resolver records the declared address in k3s_node_nat_declared_ip when it rebinds. It doesn't touch non-NAT nodes.
  • Born inventory uses that fact as public_ip on NAT nodes only. Other nodes keep the default-route address.
  • Contract change, on purpose: a standalone 694 run used to skip fact gathering, so it fell back to ansible_host for public_ip. It now records what a full bootstrap run records. The play header says so, and a test pins it.
  • docs/repo-strategy.md explains how the resolver treats NAT nodes.

Tests

  • New tests/test_local_ca_node_address.py (8 tests, wired into CI): a fresh standalone run with NAT-shaped facts from the plays' own setup task, a repeat resolver call after 300 with unset, equal and different preset external addresses, non-NAT nodes, and a check that each play's real setup arguments return the facts the resolver needs.
  • tests/test-k3s-nat-bind-ip.yml asserts the new fact.
  • Several of the new tests fail on origin/main. Each of these mutations fails a test: removing the resolver import, removing either play's setup task, adding a filter: to setup, using k3s_node_external_ip as public_ip, and overwriting the declared address on a repeat call.

Live check

On a 1:1-NAT sandbox node, 321 ran on its own from this branch with no address override: failed=0, changed=0. The resolver rebound the address, and all app hosts in the zone and in /etc/hosts stayed on the node's internal address.

Closes dmfdeploy/dmfdeploy#901

On a 1:1-NAT node the inventory's k3s_node_ip is the public address.
Playbook 300 rebinds it through tasks/resolve-k3s-node-ip.yml, but 321
and 694 didn't, so running either on its own wrote the public address
into the CoreDNS zone, /etc/hosts and the born inventory. In-cluster
traffic to the app hosts then left the node through the provider's NAT.

- 321 and 694 gather network facts and import the same resolver, so
  the result no longer depends on which plays ran first.
- The resolver records the declared address in k3s_node_nat_declared_ip
  when it rebinds. The born inventory uses it as public_ip on NAT
  nodes only; other nodes keep the default-route address.
- A standalone 694 run now records what a full bootstrap run records.
- Tests cover a fresh standalone run, a repeat resolver call after 300,
  and non-NAT nodes, with documentation-range addresses.

Closes dmfdeploy/dmfdeploy#901

Signed-off-by: znerol2 <6800371+znerol2@users.noreply.github.com>
@znerol2
znerol2 requested a review from a team as a code owner November 13, 2026 08:19
@znerol2
znerol2 requested a review from lkirc November 13, 2026 08:19
@github-actions
github-actions Bot enabled auto-merge (rebase) November 13, 2026 08:19

@lkirc lkirc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Static review of current head 646d9d6: the standalone NAT address resolution and born-inventory handling are correct, and the added test runs under the existing required ansible check. No blocking findings.

@github-actions
github-actions Bot merged commit 350dd44 into main Nov 13, 2026
13 checks passed
@znerol2
znerol2 deleted the fix/901-internal-zone-target branch November 13, 2026 08:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local-CA zone maps app hosts to the public address when 321 runs on its own on a NAT node

2 participants