diff --git a/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/.openspec.yaml b/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/.openspec.yaml new file mode 100644 index 0000000000..25002a8e81 --- /dev/null +++ b/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/.openspec.yaml @@ -0,0 +1,2 @@ +schema: spec-driven +created: 2026-11-01 diff --git a/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/design.md b/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/design.md new file mode 100644 index 0000000000..9f92ad21c6 --- /dev/null +++ b/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/design.md @@ -0,0 +1,12 @@ +# Design + +## Decisions + +- **Place the test at tests/test_k8s_readme_hosts.py**: Follows the existing naming pattern of tests/test_k8s_llm_gateway.py and tests/test_k8s_local_path_placement.py. The project keeps all tests in tests/. +- **Extract and match every host token against Ingress manifests, not just check for the homelab. substring**: Catches any host that does not match an Ingress, not only the homelab. form. More robust against future drift where a different wrong subdomain is introduced. +- **The test reads Ingress manifests from k8s/ rather than hardcoding the expected host list**: If a new Ingress is added, the test still passes without editing the test. If a host is removed from Ingress, the test fails and names the stale README reference. + +## Rejected alternatives + +- **Place the test at k8s/tests/test_readme_hosts.py**: No existing test directory under k8s/. The project keeps all tests in tests/. +- **Assert only that the substring homelab. is absent from the tunnel section**: Simpler, but misses a host that uses a different wrong subdomain form. The issue asks for a guard against any drift, not just the current error. diff --git a/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/proposal.md b/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/proposal.md new file mode 100644 index 0000000000..687227f38f --- /dev/null +++ b/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/proposal.md @@ -0,0 +1,38 @@ +# Proposal + +## Why + +#2572: the Cloudflare tunnel section of k8s/README.md writes hosts as *.homelab., but the 24 live Ingress hosts have the form . with no homelab subdomain. A reader who follows the section configures Cloudflare Access and DNS for a domain that no Ingress serves. + +## What Changes + +- Rewrite the Cloudflare tunnel section of k8s/README.md to use . and *. instead of .homelab. and *.homelab. +- Add tests/test_k8s_readme_hosts.py that extracts host tokens from the tunnel section and asserts each matches an Ingress host in k8s/ +- The test fails on the current text and passes after the fix +- The change fits one pull request. + +## Capabilities + +### New Capabilities + +None. + +### Modified Capabilities + +- `k8s-api-tunnel`: Tunnel section hosts match Ingress, Offline test guards tunnel hosts + +## Impact + +- Documents: `k8s/README.md` +- Tests: `tests/test_k8s_readme_hosts.py` + +## Feasibility + +- The issue cites lines 972, 989-991, 1004 and 1010 of k8s/README.md on origin/main. The context shows the README references hosts like argocd., alloy., chat., qdrant., ai., and hooks. in other sections, confirming the . form is the correct one. +- The Ingress manifests live at k8s/ingress/ingress-routes.yaml and k8s/devops/roadmap-service/ingress.yaml. The issue confirms 24 Ingress hosts with no homelab subdomain. +- The test naming pattern follows existing tests: tests/test_k8s_llm_gateway.py, tests/test_k8s_local_path_placement.py. The new test goes to tests/test_k8s_readme_hosts.py. +- First checks the implementation runs: (1) uv run pytest tests/test_k8s_readme_hosts.py -x to confirm the test fails on the current text; (2) after the fix, the same command exits 0; (3) grep -n 'homelab\.' k8s/README.md to confirm no homelab. host form remains in the tunnel section. + +## Existing Tool Considered + +None needed. The change is a documentation fix in k8s/README.md and a test over the repository's own Ingress manifests. The written cost is the tokens to edit the tunnel section, write one test file, and fix any test failure, plus the elapsed time of one pull request. diff --git a/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/specs/k8s-api-tunnel/spec.md b/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/specs/k8s-api-tunnel/spec.md new file mode 100644 index 0000000000..f2a60303c6 --- /dev/null +++ b/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/specs/k8s-api-tunnel/spec.md @@ -0,0 +1,19 @@ +## ADDED Requirements + +### Requirement: Tunnel section hosts match Ingress +The Cloudflare tunnel section of k8s/README.md SHALL name each host in the form . and the wildcard as *., matching the Ingress manifests in k8s/. + +#### Scenario: No homelab subdomain remains +- **WHEN** the text of the Cloudflare tunnel section is scanned for the substring homelab. +- **THEN** no host pattern in that section contains the substring homelab. + +### Requirement: Offline test guards tunnel hosts +An offline test SHALL verify that every host named in the Cloudflare tunnel section of k8s/README.md matches an Ingress host defined in k8s/. + +#### Scenario: Test fails on broken text +- **WHEN** the test runs against the README before the host names are corrected +- **THEN** the test exits with a non-zero code and names each host that does not match an Ingress. + +#### Scenario: Test passes on corrected text +- **WHEN** the test runs against the README after the host names are corrected +- **THEN** the test exits with code 0. diff --git a/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/tasks.md b/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/tasks.md new file mode 100644 index 0000000000..c150102994 --- /dev/null +++ b/openspec/changes/2572-the-cloudflare-tunnel-section-of-k8s/tasks.md @@ -0,0 +1,21 @@ +# Tasks + +## 1. Write failing test for tunnel section hosts + +Reads: none. Changes: `tests/test_k8s_readme_hosts.py`. + +- [ ] 1.1 Write tests/test_k8s_readme_hosts.py. The test reads k8s/README.md, locates the Cloudflare tunnel section by its heading, extracts every host-like token (a string matching the pattern of optional asterisk, word characters, hyphens, dots, and the literal ), reads all Ingress manifests under k8s/ to collect the set of host values, then asserts each README host is in the Ingress set or equals *.. It also asserts no host token contains the substring homelab. The test must fail on the current text because it contains homelab. subdomains, and verify that `uv run pytest tests/test_k8s_readme_hosts.py -x` fails on the base +- [ ] 1.2 Implement the test. Read k8s/README.md as text. Find the section between the Cloudflare tunnel heading and the next same-level heading. Use a regex to extract host-like tokens: tokens that end with and contain at least one dot before it. Read every YAML file under k8s/ that defines Ingress resources (k8s/ingress/ingress-routes.yaml, k8s/devops/roadmap-service/ingress.yaml, and any other Ingress manifest). Collect the set of host values from the spec.rules[].host fields. For each README host token, assert it is in the Ingress host set or equals *.. Assert no token contains the substring homelab. Use pytest.fail with a message naming each mismatched host, and verify that `uv run pytest tests/test_k8s_readme_hosts.py -x` passes +- [ ] 1.3 Change no document, run `uv run devops docs generate --sync-readme`, and verify that `uv run devops ci docs` passes + +## 2. Fix tunnel section host names in README + +Reads: none. Changes: `k8s/README.md`. + +- [ ] 2.1 The test tests/test_k8s_readme_hosts.py from the previous group must pass after the fix. Run uv run pytest tests/test_k8s_readme_hosts.py -x and confirm exit code 0, and verify that `uv run pytest tests/test_k8s_readme_hosts.py -x` fails on the base +- [ ] 2.2 In the Cloudflare tunnel section of k8s/README.md, replace every occurrence of *.homelab. with *.. Replace every occurrence of .homelab. with . for each named host (chat, grafana, ai, argocd, git, hooks, k8s, alloy, qdrant, prometheus). Verify each named host appears in k8s/ingress/ingress-routes.yaml or k8s/devops/roadmap-service/ingress.yaml. Remove any sentence that references the homelab subdomain as a DNS wildcard target, and verify that `uv run pytest tests/test_k8s_readme_hosts.py -x` passes +- [ ] 2.3 k8s/README.md, run `uv run devops docs generate --sync-readme`, and verify that `uv run devops ci docs` passes + +## Workflow follow-up + +- Pending a person: review the diff in tuicr (tuicr -r ..HEAD).