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

Add merge function for cluster snapshot #301

Merged
merged 6 commits into from
Oct 11, 2021

Conversation

jahvon
Copy link
Contributor

@jahvon jahvon commented Oct 8, 2021

BOT NOTES:
resolves #302

@solo-changelog-bot
Copy link

Issues linked to changelog:
#302

if _, ok := merged[gvk]; ok {
for name, object := range objectsMap {
// If there is already an object specified here, the object from toMerge
// will replace it
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this conflict resolution approach seem fine?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but you also need to loop over all of the objects in toMerge and add them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you elaborate? That's what I'm doing here

Copy link
Member

Choose a reason for hiding this comment

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

Ignore me, I'm an idiot 😆

@@ -71,6 +71,22 @@ func (s Snapshot) Clone(selectors ...GVKSelectorFunc) Snapshot {
return clone
}

func (s Snapshot) Merge(toMerge Snapshot) Snapshot {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment to the method about the what it does, and the merge semantics

@@ -128,3 +144,15 @@ func (cs ClusterSnapshot) Clone(selectors ...GVKSelectorFunc) ClusterSnapshot {
}
return clone
}

func (cs ClusterSnapshot) Merge(toMerge ClusterSnapshot) ClusterSnapshot {
Copy link
Member

Choose a reason for hiding this comment

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

Comment here as well

@soloio-bulldozer soloio-bulldozer bot merged commit 4f05a71 into master Oct 11, 2021
@soloio-bulldozer soloio-bulldozer bot deleted the cluster-snapshot-merge branch October 11, 2021 15:24
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.

Create a merge function for the Snapshot/ClusterSnapshot
2 participants