fix: add listMapKey to VMRule rules for structured server-side apply merge#2258
Merged
vrutkovs merged 2 commits intoJun 17, 2026
Merged
Conversation
Contributor
|
hey @mvanhorn |
vrutkovs
requested changes
Jun 9, 2026
0e4384d to
5edbd61
Compare
AndrewChubatiuk
approved these changes
Jun 15, 2026
5edbd61 to
8e7c3b5
Compare
89d983b to
b91107c
Compare
vrutkovs
approved these changes
Jun 17, 2026
0bdf36b to
0897f6c
Compare
0897f6c to
7d0ebe1
Compare
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.
Summary
Adds a
+listMapKey=alertmarker to theVMRulerulesarray so Kubernetes server-side apply merges rule entries by key instead of replacing the whole list, preventing rules from clobbering each other on partial applies.Why this matters
VMRule.spec.groups[].ruleswas a plain list with nolistMapKey, so a server-side apply that touched one rule replaced the entirerulesarray, dropping rules managed by other appliers (#657). Marking the list with its identifying key lets the API server do a structured merge. The change is inapi/operator/v1beta1/vmrule_types.gowith the regenerated CRD inconfig/crd/overlay/crd.yaml, plus a unit test anddocs/api.md/docs/CHANGELOG.mdupdates.Testing
go buildandgo vetpass on theapimodule; the CRD overlay regenerates cleanly.Closes #657
Summary by cubic
Make
VMRule.spec.groups[].rulesa map-style list keyed byrecordandalertso server-side apply merges rules by key instead of replacing the list. Adds XOR validation and defaults forrecord/alertto prevent invalid specs and rule clobbering (fixes #657).RuleGroup.ruleswith+listType=map,+listMapKey=record,+listMapKey=alert; setRule.record/Rule.alertdefaults to""; regenerated CRDs withx-kubernetes-list-type,x-kubernetes-list-map-keys, and defaults; updateddocs/api.mdanddocs/CHANGELOG.md.recordandalertare set, or neither.Written for commit 7d0ebe1. Summary will update on new commits.