✨ Label local objects with the agent name #18
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
If two or more Sync Agents work on the same local cluster (but each talking to its own kcp), and they both serve the same local API (i.e. there are 2 PublishedResources that describe the same local API), they will get confused over each other's objects. When Agent 1 syncs an object from kcp 1 to the local cluster, Agent 2 might think it own it. The severity of this issue also depends on object naming (if for example the kcp cluster names are included in the local object names, for example as namespaces, then a collision is less likely since cluster names should be globally unique).
To improve the situation, this PR uses the already existing agent name to label local objects, declaring ownership over them. This does not mean 2 PublishedResources can now lead to conflicts (object A in kcp 1 and object B in kcp 2 both getting synced down into the same local object), that is still forbidden. This PR is more about preventing accidental overlaps, where the Agent by accident reconciles the wrong objects.
Related issue(s)
Fixes #13
Release Notes