Skip to content

[fix] Validate resource ownership before reconciling managed objects - #542

Merged
morningman merged 1 commit into
apache:masterfrom
Al-assad:fix/managed-resource-ownership
Nov 18, 2026
Merged

morningman merged 1 commit into
apache:masterfrom
Al-assad:fix/managed-resource-ownership

Conversation

@Al-assad

@Al-assad Al-assad commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

A resource name collision could overwrite a Service, StatefulSet, or CN HPA belonging to another cluster. StatefulSet pre-apply workflows could also run SQL/graceful actions before the final write checked resource ownership.

Validate the current owner UID before comparing or updating managed resources and before DDC/native FE pre-apply actions. Accept existing non-controller owner references to the current CR; reject unowned collisions, stale CR UIDs, and foreign controller owners. Guard the compute-group headless Service recreation path as well.

Validation:

  • Reproduced six failing Service/StatefulSet ownership cases before the fix.
  • Eight Service/StatefulSet cases now pass, including legacy owner compatibility.
  • HPA foreign-owner regression passes.
  • All controller and shared Kubernetes utility package tests pass with Kubernetes 1.31 envtest.

Compatibility: this deliberately refuses implicit adoption of same-named resources without the current CR owner UID. It does not migrate existing owner references or introduce controller=true. QA validation passed with selectdb/doris-operator:26.1.0-rc03: existing DDC Service and StatefulSet resources were temporarily assigned a real foreign ConfigMap controller owner, reconciliation was triggered, and both foreign ownership and edited fields remained intact with explicit ownership rejection. Original test ownership was restored after each case.

@Al-assad
Al-assad marked this pull request as ready for review November 4, 2026 07:24
@morningman
morningman merged commit efa6918 into apache:master Nov 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants