-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Patch strategy should be configurable #227
Comments
Hey @kennethito Yes I do agree, this should be configurable. I can't answer why strategic merge is not the default as |
Thanks for the PR #228, @kennethito. While the approach in #228 solves this issue, I'd rather keep the abstraction and not expose more HTTP communication details to
I prefer the first approach but it's all but a quick win! Could go for variant 2. now and implement 1. later... Open for discussion. |
For number 2 are you thinking that many of the functions on
Or something more along the lines of
similar to #229 ? |
I was thinking about an API like this. # Defined in operation.ex
@spec patch_type :: :strategic_merge | :merge | :json_merge | :apply
# Defined in client.ex
@spec patch(resource :: map(), type :: Operation.patch_type()) :: Operation.t()
def patch(resource, type \\ :merge) do
Operation.build(:patch, resource, patch_type: type)
end Once the patch types are implemented, @spec apply(resource :: map(), mgmt_params :: keyword()) :: Operation.t()
def apply(resource, mgmt_params \\ []) do
field_manager = Keyword.get(mgmt_params, :field_manager, @mgmt_param_defaults[:field_manager])
force = Keyword.get(mgmt_params, :force, @mgmt_param_defaults[:force])
Operation.build(:patch, resource, patch_type: :apply, field_manager: field_manager, force: force)
end |
Just back from some work travel and getting started again. There exists
So adding an optional I pushed a commit into #229 with my understanding of what you want (might be flawed), can you take a quick peek? If the approach looks good, I'll fix all the tests and get it ready for review. |
I was looking for a way to change the patch strategy here.
k8s/lib/k8s/client/runner/base.ex
Line 204 in 6d26091
Was also curious as to why the default isn't strategic merge, which seems to be the kubectl default? https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/
Valid values
https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json
The text was updated successfully, but these errors were encountered: