Skip to content

Fix restore-only mode failing on non-managed resources - #6

Open
kaessert wants to merge 2 commits into
mainfrom
fix/restore-only-skip-non-managed-resources
Open

kaessert wants to merge 2 commits into
mainfrom
fix/restore-only-skip-non-managed-resources

Conversation

@kaessert

Copy link
Copy Markdown
Collaborator

Summary

  • The restore-only mode requires all composed resources to have backup data, but non-managed resources like Usage don't have external names — they're internal Crossplane orchestration resources
  • When a v2 composition introduces Usage resources that weren't in the v1 backup, the restore step fatally errors because it can't find a backup entry
  • Added isNonManagedResource() check that skips known non-managed kinds (e.g., Usage) during restore-only validation instead of failing

Test plan

  • Added RequireRestoreSkipsNonManagedResources test: validates a composition with both a Bucket (has backup data) and a Usage (no backup data) succeeds in restore-only mode
  • All existing tests pass (36 tests)
  • go build succeeds

The restore-only mode requires ALL composed resources to have backup data
in the store, but resources like Usage don't have external names since
they're not cloud resources. When a v2 composition adds Usage resources
that weren't in the v1 backup, the restore step fails because it can't
find a backup entry for those new resources.

Skip non-managed resource kinds (e.g., Usage) during restore-only
validation instead of fatally erroring.
Comment thread fn.go
// These are internal orchestration resources (e.g., Usage) that should be skipped
// during restore-only validation since they never appear in backup data.
var nonManagedKinds = map[string]bool{
"Usage": true,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it enough to use kind only, not full gvk?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, works fine like this

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