-
Notifications
You must be signed in to change notification settings - Fork 167
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 and json patch #390
Conversation
9a1db32
to
01093e3
Compare
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.
Great work ❤️ Some minor suggestions.
Could you add this to README, including explaining that .patch
is strategic merge patch (not obvious from name), that it won't work for custom resources, and a link to https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/ and/or the format RFCs?
And mention in CHANGELOG please (prepend new "Unreleased" section if needed)
9a9f80b
to
c01378c
Compare
test/test_service.rb
Outdated
|
||
patch = [ | ||
{ 'op' => 'replace', 'path' => '/metadata/annotations/key1', 'value' => 'value' }, | ||
{ 'op' => 'add', 'path' => '/metadata/annotations/key2', 'value' => 'value' } |
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.
in principle, once you use functionally different patch here, ideally you'd mock a different return result than service_patch.json
. If you don't want that, nor want to patch only /metadata/annotations/key
, please add a comment on the to_return
saying it's inaccurate result for this patch.
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.
Mocked different resources and tested with against a minikube instance. Both merge_patch
and json_patch
are working as expected and as described in the tests now
Ok, this is ready for another round of review.
|
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.
LGTM 💯 👍
Do you object to squashing the history? of the 14 commits most modify previous changes...
basic test. TODO model in correct behaviour of different patches refactor rubocop fixes Tidy up test police namespace mandatory CHANGELOG + README (incomplete) Revert namespace is mandatory separate fixtures for json + merge patch + assert headers in request README tweak Police, test bugfix, final README edit fix last bad test README typo
140c9c4
to
0f3ab7c
Compare
Squashed and ready to go. Thanks for the solid feedback and looking forward to the next PR. |
released in gem 4.3.0. |
Closes #357
Following the conversation on #357 and #268 , I figured I could start working on this feature as my first contribution to kubeclient. As @cben proposed, I'm simply adding
json_patch_*
andmerge_patch_*
methods to the client.