Skip to content

fix(config): write every external tag to the tags field - #829

Open
mycodeself wants to merge 1 commit into
crossplane:mainfrom
mycodeself:fix/external-tags-namespace
Open

mycodeself wants to merge 1 commit into
crossplane:mainfrom
mycodeself:fix/external-tags-namespace

Conversation

@mycodeself

Copy link
Copy Markdown

Description of your changes

setExternalTagsWithPaved rebuilt the map that xpresource.GetExternalTags returns from three hardcoded keys, so crossplane-namespace and crossplane-providerconfig-kind never reached spec.forProvider.tags and never reached the cloud resource. Two namespaced managed resources with the same name in different namespaces ended up with identical external tags.

Copy the map as it arrives instead of listing the keys. GetExternalTags already omits crossplane-namespace for cluster-scoped resources and crossplane-providerconfig-kind for untyped provider config references, so the v1 APIs keep the tags they have today rather than gaining empty ones, and a key added to crossplane-runtime later needs no change here.

Fixes #826

I have:

  • Read and followed Upjet's [contribution process].
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

setExternalTagsWithPaved now copies every key supplied in externalTags. Tests cover absent namespace and provider-config-kind tags for a cluster-scoped resource and both tags for a namespaced resource.

Changes: External tag copying

Layer / File(s) Summary
Copy external tags and validate resource cases
pkg/config/resource.go, pkg/config/resource_test.go
setExternalTagsWithPaved copies every entry in externalTags instead of writing only three hardcoded keys. Tests check expected tags for cluster-scoped and namespaced resources.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 3e756

This change makes namespaced resources and typed provider config references carry their full set of external tags. Existing cluster-scoped behavior is preserved, and no merge-blocking risk was found.

Pre-merge checks: Passed 7

Check name Status Explanation
Title check Passed The title names the fix and its target: writing every external tag to the tags field. It matches the changeset, which changes setExternalTagsWithPaved to copy the full externalTags map. It is 55 chara…
Description check Passed The description states the problem, the cause, and the fix. It names setExternalTagsWithPaved, the dropped crossplane-namespace and crossplane-providerconfig-kind keys, and the copy-the-map change. It…
Linked Issues check Passed Issue #826 requires that the tagger keep every key that xpresource.GetExternalTags returns. This includes crossplane-namespace and crossplane-providerconfig-kind. The PR description and the AI-generat…
Out of Scope Changes check Passed The summary reports changes only in pkg/config/resource.go (setExternalTagsWithPaved and an explanatory comment) and pkg/config/resource_test.go (test constants and one new test case with comments). A…
Configuration Api Breaking Changes Passed The check fails only when changes under pkg/config/** remove or rename public exported types, functions, or fields, add required parameters to existing functions, or change function signatures without…
Generated Code Manual Edits Passed The check fails only if the pull request changes files matching zz_*.go. The changed-file inventory from `git diff --name-status refs/coderabbit/pre-merge-check/base refs/coderabbit/pre-merge-check/…
Template Breaking Changes Passed The check is inapplicable to this pull request. It only covers changes to pkg/controller/external*.go templates. The changed-file inventory for the reviewed range (`refs/coderabbit/pre-merge-check/b…
Full details: Title check

Explanation

The title names the fix and its target: writing every external tag to the tags field. It matches the changeset, which changes setExternalTagsWithPaved to copy the full externalTags map. It is 55 characters, under the 72-character limit, and it is descriptive.

Full details: Description check

Explanation

The description states the problem, the cause, and the fix. It names setExternalTagsWithPaved, the dropped crossplane-namespace and crossplane-providerconfig-kind keys, and the copy-the-map change. It also references issue #826, so it is clearly related to the changeset.

Full details: Linked Issues check

Explanation

Issue #826 requires that the tagger keep every key that xpresource.GetExternalTags returns. This includes crossplane-namespace and crossplane-providerconfig-kind. The PR description and the AI-generated summary both state that setExternalTagsWithPaved now copies each key/value from externalTags. It no longer rebuilds the map from three hardcoded keys. The added test case in pkg/config/resource_test.go covers a namespaced resource with a typed provider config reference and expects all five external tag keys. Cluster-scoped resources and untyped references stay without the omitted keys, because GetExternalTags omits them. Repository reads were limited. The diff failed with changed blobs missing, and the file read of pkg/config/resource.go was truncated before setExternalTagsWithPaved. The verdict therefore rests on the PR description and summary, which agree. The incremental change from the previous reviewed head (dc296ff) to 3e756d9 was not readable, so its content is unverified. Thank you for the focused fix and the test coverage.

Full details: Out of Scope Changes check

Explanation

The summary reports changes only in pkg/config/resource.go (setExternalTagsWithPaved and an explanatory comment) and pkg/config/resource_test.go (test constants and one new test case with comments). All of these changes support the objective of issue #826. No unrelated change is reported. The diff could not be read, and the incremental change since the previous reviewed head was not verifiable. This verdict relies on the PR description and the summary.

Full details: Configuration Api Breaking Changes

Explanation

The check fails only when changes under pkg/config/** remove or rename public exported types, functions, or fields, add required parameters to existing functions, or change function signatures without the 'breaking-change' label. The PR (#829, author mycodeself, main <- fix/external-tags-namespace) changes two files: - pkg/config/resource.go: only the body of the unexported function setExternalTagsWithPaved changes. It now copies every key of externalTags instead of three hardcoded keys. Its signature (externalTags map[string]string, paved *fieldpath.Paved, fieldName string) is unchanged. A comment is added above it. - pkg/config/resource_test.go: adds unexported test constants (namespace, providerKind) and a new test case. No exported declarations change. A scan of the pkg/config diff for added or removed func, type, var, or const declaration lines found none. No exported symbol is removed, renamed, or re-signatured, and no parameter is added. The 'breaking-change' label is therefore not required for this PR.

Full details: Generated Code Manual Edits

Explanation

The check fails only if the pull request changes files matching zz_*.go. The changed-file inventory from git diff --name-status refs/coderabbit/pre-merge-check/base refs/coderabbit/pre-merge-check/head lists exactly two modified files: pkg/config/resource.go and pkg/config/resource_test.go. Neither matches the zz_*.go pattern, so no generated-code file was edited by hand. The change is limited to the hand-written setExternalTagsWithPaved logic and its test, which the check does not restrict.

Full details: Template Breaking Changes

Explanation

The check is inapplicable to this pull request. It only covers changes to pkg/controller/external*.go templates. The changed-file inventory for the reviewed range (refs/coderabbit/pre-merge-check/base to refs/coderabbit/pre-merge-check/head) lists only two modified files: pkg/config/resource.go and pkg/config/resource_test.go. Neither is under pkg/controller/, and no template files changed. The pkg/controller/external*.go files exist in the checkout but are unchanged by this PR. The PR changes setExternalTagsWithPaved in pkg/config, which feeds the Tagger. That is a config-layer behavior change, not a template change, so the check has no trigger here.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between dc296ff and 3e756d9.

Files selected for processing: 2

  • pkg/config/resource.go
  • pkg/config/resource_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

setExternalTagsWithPaved rebuilt the map that GetExternalTags returns
from three hardcoded keys, so crossplane-namespace and
crossplane-providerconfig-kind never reached spec.forProvider.tags, and
never reached the cloud resource. Two namespaced managed resources with
the same name in different namespaces got identical external tags.

Copy the map as it arrives. GetExternalTags already omits
crossplane-namespace for cluster-scoped resources and
crossplane-providerconfig-kind for untyped provider config references, so
the v1 APIs keep the tags they have today instead of gaining empty ones.

Fixes crossplane#826

Signed-off-by: mycodeself <ismael.pineiro@lansweeper.com>
@mycodeself
mycodeself force-pushed the fix/external-tags-namespace branch from dc296ff to 3e756d9 Compare November 24, 2026 10:54
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.

Tagger drops crossplane-namespace and crossplane-providerconfig-kind from external tags

1 participant