Skip to content

fix(simulate): ignore the namespace on cluster-scoped XR inputs - #518

Merged
jcogilvie merged 1 commit into
crossplane:mainfrom
jcogilvie:jco-cluster-xr-namespace
Nov 9, 2026
Merged

jcogilvie merged 1 commit into
crossplane:mainfrom
jcogilvie:jco-cluster-xr-namespace

Conversation

@jcogilvie

Copy link
Copy Markdown
Collaborator

Description of your changes

xr simulate kept an explicit metadata.namespace on an XR input whose XRD has spec.scope Cluster or LegacyCluster. The dynamic client then looked the XR up at a namespaced URL, got a 404, and previewed it as new. The namespace also leaked into the report identity, and the input validator could miss that it was the same XR as an input given without a namespace. kubectl apply ignores the namespace on a cluster-scoped object, so this clears it.

This is the counterpart of the namespace defaulting from #487, which fills in a missing namespace for claims and Namespaced XRs. CodeRabbit raised it on #508.

Covered by new cases in TestCheckCompositesNamespace: Cluster and LegacyCluster XRs with an explicit namespace come out with none, and a Namespaced XR keeps its explicit namespace. The namespace is dropped silently, as kubectl apply drops it.

I have:

  • Read and followed Crossplane's contribution process.
  • Run ./nix.sh flake check to ensure this PR is ready for review. Ran go test, go vet and ./nix.sh run .#lint instead.
  • Added or updated unit tests.
  • Linked a PR or a docs tracking issue to document this change. Bug fix; no documented behavior changes.
  • Added backport release-x.y labels to auto-backport this PR. Not a backport candidate.

Need help with this checklist? See the cheat sheet.

🤖 Generated with Claude Code

An explicit metadata.namespace on an XR whose XRD is Cluster or LegacyCluster
scoped was kept, so the dynamic client looked the XR up at a namespaced URL,
got a 404 and previewed it as new. The namespace also leaked into the report
identity and could hide that two inputs are the same XR. kubectl apply ignores
the namespace on a cluster-scoped object, so clear it, as the counterpart of
the namespace defaulting for claims and Namespaced XRs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
@jcogilvie
jcogilvie marked this pull request as ready for review November 9, 2026 15:06
@jcogilvie
jcogilvie requested review from a team and tampakrap as code owners November 9, 2026 15:06
@jcogilvie
jcogilvie requested review from jbw976 and removed request for a team November 9, 2026 15:06
@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4f5fc53 and 90981bf.

Files selected for processing: 2

  • internal/simulate/inputs.go
  • internal/simulate/inputs_test.go
  • 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

@jcogilvie
jcogilvie merged commit 76c5542 into crossplane:main Nov 9, 2026
12 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