Skip to content

Determine patchType based on GVK and generate correct patch #102

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

Merged
merged 1 commit into from
Apr 10, 2021

Conversation

pst
Copy link
Member

@pst pst commented Apr 10, 2021

This commit replaces the previous implementation, that would
first try a StrategicMergePatch and if that failed fall back
to a MergePatch with an implementation that follows the same
logic as kubectl.

It now determines based on the GVK, if it can create a strategic
merge patch. If not, it generates a merge patch. The patch
type is further now returned alongside the patch. Making sure
we're sending the correct patch with the correct patch type.

The previous implementation, incorrectly, did always send a merge
patch, even if the type was set to StrategicMergePatchType.

This commit replaces the previous implementation, that would
first try a StrategicMergePatch and if that failed fall back
to a MergePatch with an implementation that follows the same
logic as kubectl.

It now determines based on the GVK, if it can create a strategic
merge patch. If not, it generates a merge patch. The patch
type is further now returned alongside the patch. Making sure
we're sending the correct patch with the correct patch type.

The previous implementation, incorrectly, did always send a merge
patch, even if the type was set to StrategicMergePatchType.
@pst pst merged commit bf0f4b8 into master Apr 10, 2021
@pst pst deleted the fixdiffpatchissue branch April 10, 2021 16:33
@pst
Copy link
Member Author

pst commented Apr 10, 2021

In hindsight, it's a surprise this ever worked at all...

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.

1 participant