fix(config): route legacy dev ingresses (*.dev.intern.nav.no) to the dev collector - #31
Merged
Merged
Conversation
…dev collector The interim hostname fallback matched dev only on the .dev.nav.no suffix, so the modern ingress pattern (ung.intern.dev.nav.no) routed correctly while the legacy dev-fss pattern (k9.dev.intern.nav.no — dev label before intern) fell through to the .nav.no catch-all and sent DEV telemetry to the PROD collector (reported by k9saksbehandling, who ran both patterns side by side). The derivation now treats a literal dev DNS label anywhere in a nav.no hostname as a dev-cluster ingress: by nav domain conventions the bare label dev always marks a dev environment, wherever the zone puts it. The label must match exactly — devtools.intern.nav.no stays prod.
There was a problem hiding this comment.
Pull request overview
This PR fixes NAV tenant collector derivation so legacy dev ingresses under *.dev.intern.nav.no route to the dev telemetry collector instead of incorrectly falling through to the prod collector.
Changes:
- Update
navTenant.telemetryUrlFromHostnameto only derive fornav.nohostnames and treat a literaldevDNS label anywhere in the hostname as a dev-cluster signal. - Add unit tests covering modern dev patterns, the reported legacy pattern, prod routing, partial-label safety (
devtools), and non-nav hostnames.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/config.ts | Adjusts NAV hostname-based collector derivation to detect a dev label anywhere within *.nav.no. |
| src/config.test.ts | Adds targeted unit tests for modern/legacy dev hostnames and validates prod/non-nav behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Problem (reported by k9saksbehandling)
Two apps with identical
init()calls routed to different collectors:ung.intern.dev.nav.no(modern dev ingress) → dev collector ✅k9.dev.intern.nav.no(legacy dev-fss ingress) → prod collector ❌The interim hostname fallback (ADR-0001 decision 7) recognized dev only via the
.dev.nav.nosuffix. The legacy pattern puts thedevlabel beforeintern, so it missed the dev branch and fell through to the.nav.nocatch-all — sending dev telemetry to the prod collector.Fix
A literal
devDNS label anywhere in anav.nohostname now routes to the dev collector. By nav domain conventions a baredevlabel always marks a dev-cluster ingress, wherever the zone puts it (dev.nav.no,*.intern.dev.nav.no,*.dev.intern.nav.no, …). The label must match exactly —devtools.intern.nav.nostays prod. Non-nav hosts still derive nothing.Tests
New unit block for
navTenant.telemetryUrlFromHostnamecovering modern + legacy dev patterns (including the reportedk9.dev.intern.nav.no), prod hosts, the partial-label case, and non-nav hosts. 218 tests passing.Note: the hostname derivation remains INTERIM — the platform channels (meta tags / generatedConfig / env) always win, and teams on legacy ingress can already get correct routing today by serving
<meta name="nais-cluster">or the generated config.