Skip to content

Fix | Deduplicate resources in apps with no destination ns - #490

Merged
dag-andersen merged 1 commit into
mainfrom
fix/deduplicate-empty-destination-namespace
Aug 27, 2026
Merged

dag-andersen merged 1 commit into
mainfrom
fix/deduplicate-empty-destination-namespace

Conversation

@dag-andersen

Copy link
Copy Markdown
Owner

Summary

  • Run Argo CD resource normalization and deduplication when an Application has no destination namespace
  • Preserve Argo CD's repeated-resource behavior for cluster-scoped resources
  • Add regression tests for empty destination namespaces
  • Update branch-19 golden output to exclude repeated resources within an Application

Problem

The manifest extraction paths returned early when spec.destination.namespace was empty. This skipped Argo CD's DeduplicateTargetObjects processing.

Applications containing cluster-scoped resources commonly omit the destination namespace. If such an Application generated the same resource more than once, the duplicate manifests reached the diff engine and were incorrectly reported as additions.

Fix

Always call DeduplicateTargetObjects, including when the destination namespace is empty.

Argo CD then:

  • Normalizes resource namespaces according to resource scope
  • Deduplicates resources by group, kind, namespace, and name
  • Keeps the last repeated resource
  • Reports repeated-resource warnings

This remains scoped to resources within one Application. Resources belonging to different Applications are not deduplicated against each other.

Testing

  • go test ./pkg/extract/... ./pkg/reposerverextract/...
  • TEST_CASE=\"branch-19/target\" go test -v -timeout 20m -run TestSingleCase -update ./...
  • TEST_CASE=\"branch-19/target\" go test -v -timeout 20m -run TestSingleCase ./...

@dag-andersen dag-andersen changed the title Fix | Deduplicate resources without destination namespace Fix | Deduplicate resources in apps with no destination ns Aug 27, 2026
@dag-andersen
dag-andersen merged commit be598b8 into main Aug 27, 2026
3 checks passed
@dag-andersen
dag-andersen deleted the fix/deduplicate-empty-destination-namespace branch August 27, 2026 18:53
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