Skip to content

fix: sync child resources by owner UID - #2

Merged
CandidXD merged 1 commit into
devfrom
agent/fix-ownerref-resource-sync
Jul 13, 2026
Merged

fix: sync child resources by owner UID#2
CandidXD merged 1 commit into
devfrom
agent/fix-ownerref-resource-sync

Conversation

@CandidXD

Copy link
Copy Markdown
Collaborator

What changed

  • replace TypeMeta-dependent ownerRef matching with immutable UID matching
  • recognize resources owned by either the underlying custom resource or Middleware
  • preserve label fallback for resources owned through other intermediate objects
  • reject stale same-identity owner references with a different UID
  • cover Deployment -> ReplicaSet -> Pod discovery when informer objects have empty TypeMeta

Why

client-go LIST objects may omit per-item kind and apiVersion. The synchronizer compared those empty fields with owner references, so a running exporter Pod could be omitted from Middleware.status.customResources.include.pods even though its Deployment and Service were present.

Impact

The status schema, sorting, CRDs, baselines, and label compatibility path are unchanged. Correct UID ownership now works even without TypeMeta; stale same-name resources with a different UID are no longer treated as current children.

Validation

  • go test ./internal/service/synchronizer -run "TestHasOwnerUID|TestOwnerReferencesMatch|TestCollectOwnedPods|TestPVCBelongsToStatefulSet" -count=1
  • go test ./internal/service/synchronizer ./internal/service/watcher -race -count=1
  • go test ./... -count=1
  • go vet ./...
  • git diff --check
  • independent code review: 0 critical, 0 important

Remaining gate

Runtime verification in the 52 environment will be performed separately by the maintainer.

@CandidXD
CandidXD marked this pull request as ready for review July 13, 2026 09:15
@CandidXD
CandidXD merged commit 0920863 into dev Jul 13, 2026
10 checks passed
@CandidXD
CandidXD deleted the agent/fix-ownerref-resource-sync branch July 13, 2026 09:15
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.

1 participant