Closed felixfbecker closed 6 years ago
Ok yeah this looks interesting! :)
I'm happy to have a go at this unless you'd like to open a PR yourself (either is fine by me).
@felixfbecker can you have a look at https://github.com/tintoy/dotnet-kube-client/commit/5092fd14faf0de6575ace26da279221c68fe533a and see if that's the information you want?
Looks right! But would need to be actually applied from the OpenAPI schema
Are you expecting to find the attribute on all properties, or will it suffice on fields that should be merged (with the default being replace
for all others)?
If so, I'd change the attribute to something like StrategicPatchMergeAttribute
, remove the enum, and only decorate properties with [StrategicPatchMerge(Key="name")]
(or similar) if the field is mergeable.
The reasoning behind this is that the only time x-kubernetes-patch-strategy
appears in the Swagger for the Kubernetes API, it has the value merge
(i.e. never replace
).
But would need to be actually applied from the OpenAPI schema
Yep - the Python script that generates the models would emit it :)
Not sure, I think I would just apply it wherever the OpenAPI schema applies it
Ok, I can work with that - should have it done sometime today I hope :)
I think we've dealt with this one but I can't be sure - when you have a moment can you check if the API does what you want now?
Yeah this gives all I need!
To properly patch resources (like a
kubectl apply
), it is necessary to know how the fields (especially lists) in the resources are intended to be merged. This is exposed as OpenAPI extensions inx-kubernetes-patch-strategy
andx-kubernetes-patch-merge-key
.