IaC Worker Node - Naina #29

Merged
tepichord merged 13 commits from feat/17-iac-worker-node into main 2026-09-08 15:24:34 -07:00
Owner

Closes #17

Automated PR created by forgejo-done adapter.

Closes #17 Automated PR created by forgejo-done adapter.
Add worker_dhcp_hosts variable and 6 new outputs (machine_secrets,
client_configuration, cluster_name, cluster_endpoint, talos_version,
kubernetes_version) to control-plane root so the worker root can
read cluster identity via terraform_remote_state.

Append worker DHCP reservation to libvirt_network DHCP hosts via concat().
Add test assertions for worker reservation and output presence.

Refs: #17
Add worker/main.tf: remote-state read from control-plane, worker
volumes/domain (20480 MiB, 6 vCPU, 40 GiB qcow2, MAC 52:54:00:10:00:04
on control-plane-net), and talos_machine_configuration_apply.worker
(joining via shared machine secrets, no bootstrap/kubeconfig).

Add worker/terraform.tfvars with repo defaults matching ARCHITECTURE.md
sizing. Add mock-provider test suite (plan.tftest.hcl) with fixture CP
state for offline testing.

Refs: #17
Add worker/cleanup.sh: confirm-gated terraform destroy of worker
resources only (no pool sweep — pool is CP-owned). Mirrors
control-plane/cleanup.sh style.

Add worker/README.md: runbook covering deploy, ISO eject, talosctl
usage, VM replacement, full teardown, apply-order constraints, and
cross-root resource ownership.

Refs: #17
Delete worker/vm-setup/create-worker-vm.sh, worker/tests/
test_create_worker_vm.bats, worker/patches/worker-patch-1.yaml, and
tests/test_shell.py. These are superseded by the worker Terraform root
(main.tf + tests/plan.tftest.hcl). Shell config patches are now inline
config_patches in the Talos machine config apply.

Refs: #17
Add test_terraform_test_worker to run terraform test in worker/ alongside
the existing CP test. Extend terraform fmt -check to include worker/.
Update shellcheck list to replace deleted bats script with worker/cleanup.sh.

Refs: #17
Add worker node runbook to root README.md. Update AGENTS.md repo-map
(worker/ = Terraform, not shell scripts) and testing commands. Mark
PLAN.md Phase 4 as complete (worker-large node is Terraform-managed).

Refs: #17
Refs: #17
The worker test fixture cp.tfstate provided machine_secrets and
client_configuration as plain strings, but the talos provider expects
nested objects. Update the fixture to use proper Terraform state v4
complex type encoding with all required fields.

Also add the worker .terraform.lock.hcl (previously untracked) to
match the control-plane convention.
The worker duplicated talos_version/kubernetes_version as local knobs that
had to be manually kept in sync, while the control-plane root publishes
them as remote-state outputs specifically for the worker and the worker's
own tests and README document reading them via terraform_remote_state.
Read the versions from the CP state (single source of truth) for the
machine config, installer ISO URL, and install image, and drop the
now-unused variables.
The no_network_or_pool_resources run claimed to verify the worker declares
no network or pool resources but actually asserted an unrelated remote-state
output count, so it passed regardless. Absence of network/pool resources is
structural (nothing undeclared can be planned), so drop the run and instead
assert the sensitive machine_secrets/client_configuration outputs the worker
actually requires are published by the control-plane state.
Both runbooks claimed the installer-ISO volume is owned by the
control-plane root and never re-declared by the worker, but worker/main.tf
declares its own talos-metal-arm64-worker.iso volume (destroyed at eject).
Describe the actual ownership split: network and pool are CP-owned and
referenced by name; the worker owns its own installer ISO.
This branch removed the only bats consumers (tests/test_shell.py harness
and worker/tests/*.bats), leaving bats in the dev shell as a stale
dependency.
tepichord added this to the MVP project 2026-09-08 14:10:30 -07:00
- worker/README.md: a DHCP-reservation edit replaces the libvirt network
  (previously claimed to be an in-place dnsmasq restart); the recreation
  strands every attached VM until it is hard-restarted (ACPI reboot does not
  re-create the host-side tap). Add an 'Adding a worker node' section that
  prescribes batching reservations to keep network churn near zero.
- control-plane/terraform.tfvars: pre-reserve workers 2-4 (:05 -> 10.5.0.21,
  :06 -> 10.5.0.22, :07 -> 10.5.0.23) extending worker-1's .20, so future
  workers add domains only, never network changes; document the MAC scheme.
- worker/terraform.tfvars: point the identity comment at the CP table.
- worker/tests/plan.tftest.hcl: pin memory_mb/vcpu_count alongside
  installer_iso so plan tests stay deterministic against local *.auto.tfvars
  overrides.
tepichord deleted branch feat/17-iac-worker-node 2026-09-08 15:24:34 -07:00
tepichord referenced this pull request from a commit 2026-09-08 15:24:34 -07:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
tepichord/milner!29
No description provided.