Closed justinsb closed 1 year ago
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: justinsb
The full list of commands accepted by this bot can be found here.
The pull request process is described here
/assign @apelisse
This library is awesome! I have two TODOs where I'm not quite sure I'm using it right (and I also would like to talk about whether I should be embedding the yaml form or if there's a better way)
Sorry for my less understandings.. What is the SMD library? SMD stands for what?
Hi @atoato88 - SMD is the name for the sigs.k8s.io/structured-merge-diff/v4 library. It implements the core logic of server-side apply.
The goal of the mockkubeapiserver is to have something like fakeclient, but that supports server-side-apply. envtest might work, but it's harder to intercept all the requests, it's not possible to inject faults, and then users have to set up kube-apiserver & etcd in the KUBEBUILDER_ASSETS. I actually hope we can get to a place where we can run tests with either a "real" kube-apiserver, or envtest, or mockkubeapiserver, just by changing an env var.
SMD shouldn't get linked into controllers (except in tests), it's only a good way to implement server-side apply in our mocks.
Although one of the things that is sort of interesting is that we might be able to do a much better job of detecting when two controllers are both trying to change the same object by looking at the field manager, or when someone has made a conflicting vs a non-conflicting change. We probably don't need the full SMD library to do that though!
Thanks for asking BTW - I might take this text and put it into the readme for mockkubeapiserver :-) (Particularly if you think it's useful!)
Add a test before starting to use the SMD library to describe the built-in types.