Repository navigation
fix(local-ca): map app hosts to the internal address when 321 runs alone - #146
Merged
Merged
Conversation
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>
lkirc
approved these changes
Nov 13, 2026
lkirc
left a comment
There was a problem hiding this comment.
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.
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On a 1:1-NAT node, the inventory's
k3s_node_ipis the public address (the SSH target). Playbook 300 rebinds it to the node's local address throughtasks/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/hostsand the born inventory. In-cluster traffic to the app hosts then left the node and came back through the provider's NAT.Changes
k3s_node_nat_declared_ipwhen it rebinds. It doesn't touch non-NAT nodes.public_ipon NAT nodes only. Other nodes keep the default-route address.ansible_hostforpublic_ip. It now records what a full bootstrap run records. The play header says so, and a test pins it.docs/repo-strategy.mdexplains how the resolver treats NAT nodes.Tests
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.ymlasserts the new fact.filter:to setup, usingk3s_node_external_ipaspublic_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/hostsstayed on the node's internal address.Closes dmfdeploy/dmfdeploy#901