VictoriaMetrics / VictoriaMetrics/operator

BUG: VMRule CRD injects empty `record: ""` / `alert: ""` into every rule

Open
#2,622 0 comments 2 reactions 1 assignee View on GitHub

@AquaOctet is already working on this.

Since Sep 14, 2026.

bug waiting for release
Dominant language
Go
Stars
589
Forks
229
Avg merge
1d 9h
Merged PRs (30d)
77

Description

Describe the bug

Rule.Record and Rule.Alert in api/operator/v1beta1/vmrule_types.go carry +kubebuilder:default="".

The API server injects the empty counterpart field into every stored rule: alerting rules get record: "", recording rules get alert: "".

The applied manifest never contains these fields, so the live object never matches the source of truth. Diff-based GitOps tooling (Argo CD and equivalents) reports every application owning a VMRule as permanently OutOfSync.

Why the defaults are no longer needed
  • #2258 added +listType=map with +listMapKey=record / +listMapKey=alert to RuleGroup.Rules, plus +kubebuilder:default="" on both fields. The defaults were required only because the API server rejects a list map key that has neither a default nor a required marker.
  • #2379 removed the list-map markers from Rules again. The defaults were left behind.

With the list-map keys gone, nothing requires the defaults — they are residue, and their only remaining observable effect is the spurious diff.

Expected behavior

record and alert are omitempty optional fields. An applied VMRule should round-trip unchanged: no field the user did not set should appear on the stored object.

Version

First affected release is v0.73.0 (the markers are absent in v0.72.0) in v0.73.1, v0.74.0, v0.74.1 and v0.75.0-rc1, and on master.

Proposed fix

Drop +kubebuilder:default="" from Rule.Record and Rule.Alert, regen bundle. The doc comment on RuleGroup.Rules ("Rules are merged by record fields") is also stale after #2379 and can go in the same change.

Current workaround

Strip the defaults from the CRD bundle before applying, or add an ignoreDifferences entry in Argo CD for the field.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.