-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
Issues linked to changelog: |
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment here as well
BOT NOTES:
resolves #302