RemoveOrphanedConfigMaps doesn't verify object UID
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 62/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- go, kubernetes
- Domain
- infrastructure
Research direction
Start at the finalize.RemoveOrphanedConfigMaps call in internal/controller/operator/factory/vmalert/vmalert.go around line 188, then read that helper to see how owner references are compared during ConfigMap cleanup. The fix is to require the live owner's UID, not just API version/kind/name, before deleting; add or extend tests covering a same-name foreign or stale ConfigMap. Run the package's Go tests to confirm orphan cleanup still removes true orphans.
Written by the indexing model from the issue text.
Description
P2: This cleanup trusts only the owner reference's API version, kind, and name, not its UID. A stale or foreign ConfigMap with a same-name VMAlert owner reference can therefore be deleted; require the current owner's UID before enabling deletion here.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At internal/controller/operator/factory/vmalert/vmalert.go, line 188:
<comment>This cleanup trusts only the owner reference's API version, kind, and name, not its UID. A stale or foreign ConfigMap with a same-name VMAlert owner reference can therefore be deleted; require the current owner's UID before enabling deletion here.</comment>
<file context>
@@ -182,7 +182,13 @@ func CreateOrUpdate(ctx context.Context, cr *vmv1beta1.VMAlert, rclient client.C
+ if err := reconcile.Deployment(ctx, rclient, newDeploy, prevDeploy, &owner, nil); err != nil {
+ return err
+ }
+ if err := finalize.RemoveOrphanedConfigMaps(ctx, rclient, cr, sets.New(cmNames...), true); err != nil {
+ return fmt.Errorf("cannot remove rule configmaps: %w", err)
+ }
</file context>
Originally posted by @cubic-dev-ai[bot] in https://github.com/VictoriaMetrics/operator/pull/2844#discussion_r4642778933
- Dominant language
- Go
- Stars
- 603
- Forks
- 242
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 57
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from VictoriaMetrics/operator
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
VictoriaMetrics/operator#2854 ·
Maintainers usually reply within 1 day
-
VLAgent `spec.k8sCollector.includePodLabels: false` has no effectPossibly taken @Haleygo claimed this 25 days ago. Openbug waiting for release
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
VictoriaMetrics/operator#2772 · 1 assignee ·
Maintainers usually reply within 1 day
-
Bug: VMRule `spec.groups[].tenant` should accept an integer, not only a stringPossibly taken @megative claimed this 40 days ago. Openenhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
VictoriaMetrics/operator#2608 · 5 comments ·
Maintainers usually reply within 1 day
-
VMAlert datasource bearer token isn't documentedMay be free again @Haleygo claimed this 35 days ago, and no pull request is open. Opendocs
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
VictoriaMetrics/operator#2365 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 65/100
VictoriaMetrics/operator#2838 ·
Maintainers usually reply within 1 day
All issues in VictoriaMetrics/operator
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
slavakurilyak/awesome-ai-agents#1026 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
GetBatchResponseById panics for items without a body (204/302) and for unknown idsPossibly taken @0z5a claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
JuliusBrussee/caveman#1567 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100