Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssa: prevent unnecessary DeepCopy #692

Merged
merged 1 commit into from
Nov 27, 2023
Merged

ssa: prevent unnecessary DeepCopy #692

merged 1 commit into from
Nov 27, 2023

Conversation

hiddeco
Copy link
Member

@hiddeco hiddeco commented Nov 27, 2023

When attempting to retrieve the object, setting the GVK on the Unstructured is sufficient to be able to retrieve it from the cluster.

This avoids deep-copying the object in full and then nil writing it again when it does not exist in the cluster. Which can potentially save quite some duplicate data when e.g. dealing with Custom Resource Definitions or other large object kinds.

When attempting to retrieve the object, setting the GVK on the
Unstructured is sufficient to be able to retrieve it from the cluster.

This avoids deep-copying the object in full and then `nil` writing it
again when it does not exist in the cluster. Which can potentially save
quite some duplicate data when e.g. dealing with Custom Resource
Definitions or other large object kinds.

Signed-off-by: Hidde Beydals <[email protected]>
@hiddeco hiddeco added the area/server-side-apply SSA related issues and pull requests label Nov 27, 2023
Copy link
Member

@stefanprodan stefanprodan left a comment

Choose a reason for hiding this comment

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

LGTM

Great optimisation, thanks @hiddeco 🎖️

@hiddeco hiddeco merged commit ce91255 into main Nov 27, 2023
13 checks passed
@hiddeco hiddeco deleted the ssa-nits branch November 27, 2023 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/server-side-apply SSA related issues and pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants