Skip to content

Conversation

@gman0
Copy link
Contributor

@gman0 gman0 commented Oct 24, 2025

Summary

DDSIF, the informer for retrieving local objects, yields only PartialMetadataObjects. This PR adds a live GET call to retrieve the full object for replication.

What Type of PR Is This?

/kind bug

Related Issue(s)

Fixes #3478

Release Notes

NONE

@kcp-ci-bot kcp-ci-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 24, 2025
localExists := !apierrors.IsNotFound(err)

// we only replicate objects that match the label selector.
if localExists && r.localLabelSelector != nil && !r.localLabelSelector.Matches(labels.Set(localCopy.GetLabels())) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This early-return with selector mismatch is an additional opportunity to optimize away the GET call: we could feed r.getLocalCopy with the selector, and skip on mismatch before getting the full object.

Let me know if you'd like to do it still in this PR or separately.

Copy link
Contributor

Choose a reason for hiding this comment

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

Lets do that, and rename the function so its something clearer names what it actually does now

@gman0
Copy link
Contributor Author

gman0 commented Oct 24, 2025

/retest

},
}
// r.getLocalCopy is defined separately because it calls r.getGlobalCopy internally.
r.getLocalCopy = func(cluster logicalcluster.Name, namespace, name string) (*unstructured.Unstructured, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Name now does now make sense. Can we rename to something better as it calls both now?

@gman0 gman0 force-pushed the cachedresources-fix-getlocalcopy branch from e614097 to 41fb874 Compare October 29, 2025 19:39
@gman0 gman0 changed the title CachedResources: replicate full objects with CachedResources: replicate full objects Oct 29, 2025
@gman0 gman0 force-pushed the cachedresources-fix-getlocalcopy branch from 428f555 to cc73264 Compare November 2, 2025 17:00
@gman0
Copy link
Contributor Author

gman0 commented Nov 2, 2025

/retest

@kcp-ci-bot kcp-ci-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2025
gman0 added 3 commits November 4, 2025 09:00
…urce CachedResource

Each instance of the replication controller is dedicated to a specific
CachedResource object, and so its CachedObjects handler should only react
on objects that are coming from that CachedResource.

On-behalf-of: @SAP [email protected]
Signed-off-by: Robert Vasek <[email protected]>
DDSIF, the informer for retrieving local objects, yields only PartialMetadataObjects.
This commit adds a live GET call to retrieve the full object for replication.

On-behalf-of: @SAP [email protected]
Signed-off-by: Robert Vasek <[email protected]>
@gman0 gman0 force-pushed the cachedresources-fix-getlocalcopy branch from cc73264 to a56886f Compare November 4, 2025 08:02
@kcp-ci-bot kcp-ci-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2025
Copy link
Contributor

@mjudeikis mjudeikis left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

}

// Skip CachedObjects that are not coming from the source CachedResource.

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: dont need these new lines :)

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 5, 2025
@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mjudeikis

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: eca7d391de255e7b5579f711971ef735084b820a

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2025
@xrstf
Copy link
Contributor

xrstf commented Nov 5, 2025

/retest

2 similar comments
@gman0
Copy link
Contributor Author

gman0 commented Nov 5, 2025

/retest

@gman0
Copy link
Contributor Author

gman0 commented Nov 5, 2025

/retest

@kcp-ci-bot kcp-ci-bot merged commit d1a0bb8 into kcp-dev:main Nov 5, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: CachedObjects are populated with PartialObjectMetadata

4 participants