ci: check that OpenTofu and Ansible agree on ingress ports and subnet #612
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
priority
high
priority
low
priority
medium
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-infra#612
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "%!s()"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
What
The perimeter is defined twice. OpenTofu has
ingress_tcp_ports,admin_ssh_portand the subnet (opentofu/variables.tofu:77-81,175-187,250-260). Ansible hasadmin_ssh_port,git_ssh_port,bitborg_subnet_cidrandmonitoring_ingestion_ports(ansible/group_vars/all/vars.yml:147-173,414,group_vars/monitoring.yml:17-23). The tofu comment says the list is the single source of truth and to keep both in sync. Nothing checks it.Why
A one-sided change locks the operator out, and CI stays green.
Failing case
Set
admin_ssh_port: 2223in Ansible only. nftables allows 2223. The security group has no rule for it and keeps the stale 2222 rule. Ansible loses SSH after the sshd cutover. The same applies togit_ssh_port(the group keeps opening 22), tomonitoring_ingestion_ports(8428 and 3100) and to the 192.168.42.0/24 subnet.Fix
Add
scripts/check-ingress-parity.py. It reads the tofu defaults and the Ansible values and asserts the same ports and subnet. Wire it intoci.ymlfor changes underopentofu/oransible/group_vars/. Give it a self-test that proves it can fail, likecheck-alert-rules.py.Done when
Plan outline
yamldecodeof two scalars).scripts/check-ingress-parity.pywith a self-test.ci.ymlbehind the same change detection as the other checks.variables.tofuandvars.yml.