Skip to content

alertmanager: add package documentation for contributors - #8720

Open
locker95 wants to merge 2 commits into
prometheus-operator:mainfrom
locker95:fix/alertmanager-contrib-docs-6429
Open

alertmanager: add package documentation for contributors#8720
locker95 wants to merge 2 commits into
prometheus-operator:mainfrom
locker95:fix/alertmanager-contrib-docs-6429

Conversation

@locker95

Copy link
Copy Markdown

Description

Adding a new Alertmanager configuration option requires coordinated changes across several places (both AlertmanagerConfig CRD versions, the conversion and validation logic, the config generation in amcfg.go, and the operator's mirror of the upstream config types in pkg/alertmanager/types.go). This isn't obvious for new contributors and maintainers end up repeating the same explanations on issues (the motivation behind #6429).

This PR documents the involved files, the generated assets to refresh with make generate, the golden-file testing workflow and an example contribution flow, as doc comments of the pkg/alertmanager package (rendered on pkg.go.dev and by go doc).

It picks up where #6897 left off (closed as stale): the review suggestions from that PR are applied, and two gaps are filled — the mirror types in types.go used for strict parsing of the global configuration secret (the "static config" part of the original issue), and the make generate / golden files workflow.

Type of change

  • CHANGE (fix or feature that would cause existing functionality to not work as expected)
  • FEATURE (non-breaking change which adds functionality)
  • BUGFIX (non-breaking change which fixes an issue)
  • ENHANCEMENT (non-breaking change which improves existing functionality)
  • NONE (if none of the other choices apply. Example, tooling, build system, CI, docs, etc.)

Verification

  • gofmt -l pkg/alertmanager/ is clean and go build ./pkg/alertmanager/ passes.
  • go test -short -count=1 ./pkg/alertmanager/... passes.
  • Rendering checked with go doc ./pkg/alertmanager (headings and lists parse correctly).

Per the AI use policy: AI tooling assisted with drafting this documentation; the content was verified against the current code base and the review feedback of #6897 by the author.

Fixes #6429

Adding a new Alertmanager configuration option requires coordinated
changes across the AlertmanagerConfig CRD versions, the conversion and
validation logic, the configuration generation and the operator's
mirror of the upstream configuration types. This isn't obvious for new
contributors and maintainers have to repeat the same explanations on
issues.

Document the involved files and the expected contribution flow as doc
comments of the alertmanager package.

Picks up the work started in prometheus-operator#6897, addressing the review comments.

Fixes prometheus-operator#6429

Signed-off-by: Dean Chen <862469039@qq.com>
@locker95
locker95 requested a review from a team as a code owner July 24, 2026 20:37
@locker95

Copy link
Copy Markdown
Author

Re-running the failed E2E tests (prometheusAllNS) job.

This PR only adds pkg/alertmanager/doc.go (package docs). The failure was TestAllNS/y/PromOnlyUpdatedOnRelevantChanges (statefulset update count / query result timing), which does not exercise the doc-only change and looks like an infra flake — other E2E suites (prometheus, alertmanager, thanosruler, operatorUpgrade) passed.

Signed-off-by: Dean Chen <862469039@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document how to contribute to AlertManager and AlertManagerConfig CRD

1 participant