PMM-15295 Warn on Nomad without public address. - #5849
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5849 +/- ##
==========================================
+ Coverage 43.59% 45.56% +1.97%
==========================================
Files 415 217 -198
Lines 43134 28116 -15018
==========================================
- Hits 18804 12811 -5993
+ Misses 22454 13920 -8534
+ Partials 1876 1385 -491 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. Walkthrough
Merge Risk: ⚪ Minimal · up to This change warns operators when Nomad is enabled without the required public address, without altering service behavior or access controls. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Full details: Description checkExplanation The description includes the required ticket number and feature build, explains what, why, and how, documents behavior and testing, and identifies out-of-scope work. The API documentation checkbox is not required because this PR does not alter API endpoints. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Ticket number: PMM-15295
Feature build: SUBMODULES-0
What
Emit a configuration warning when
PMM_ENABLE_NOMADis set butPMM_PUBLIC_ADDRESSis not, instead of silently skipping the Nomad server.Why
Nomad needs both variables. With the flag alone,
Settings.IsNomadEnabled()returns false andsupervisordskips thenomad-servertemplate — no error, no warning. The container is healthy and PMM works, so nothing indicates why nothing can be executed.This cost real debugging time during SEP integration testing: SEP dispatches task execution through PMM's embedded Nomad, so the failure surfaces as "SEP cannot run anything", several layers away from one unset variable. The requirement is documented in
documentation/docs/reference/nomad.md, but the runtime said nothing.How
A post-loop cross-check in
ParseEnvVarsappending to the existingwarnslist — no new plumbing:The warning reaches the operator through the same channel as every other environment-variable warning:
pmm-managed-init/main.gologs it asConfiguration warning: %s, andserver.govias.l.WarnlnonUpdateSettingsFromEnv.This is a diagnostic, not a new failure mode. Only
warnsis appended to;errsis untouched, sopmm-managed-initdoes not exit and PMM starts exactly as before.Behaviour
Environment | Warning -- | -- PMM_ENABLE_NOMAD=1, no public address | yes PMM_ENABLE_NOMAD=1, PMM_PUBLIC_ADDRESS= (empty) | yes — IsNomadEnabled() also treats empty as disabled PMM_ENABLE_NOMAD=1 + public address | no PMM_ENABLE_NOMAD=0 | no Neither set | no Public address only | no PMM_ENABLE_NOMAD=maybe | no — the existing parse error already reports itTesting
TestNomadWithoutPublicAddressinmanaged/utils/envvars/parser_test.gocovers every row above. Statement and branch coverage of the new block is complete, and each sub-term of the predicate is exercised both true and false.go test ./managed/utils/envvars/...— passbin/golangci-lint run managed/utils/envvars/...— 0 issuesgo build ./managed/...,go vet— cleanOut of scope
Changing the requirement itself — Nomad genuinely needs the public address.