Open deitch opened 4 years ago
FYI, I am not completely convinced that any of the above is better than "patch", except for having our tools having it built in. My issue with patch is that some places might not have it installed, and it is brittle as it is tightly dependent on line numbers and specific content. Any change to rootfs.yml
will lead to work fixing all of the now-3-but-will-grow patch files.
This is a discussion issue to figure out how we handle multiple image yml files. As of this writing, and the recently merged #849, we have multiple rootfs image files:
rootfs.yml
which contains all of the common information for imagesActually, each is a
.yml.in
which then is merged and patched, but getting past.in
files is a separate discussion.The problem with using patch files in this use case is that they are brittle. They have very specific lines that you add/remove/change. This works well for source code, where lines have little inherent structure. yml (and json) are by definition structured and easy to patch. There even are RFC standards for json patch and json merge patch.
The kubernetes version of strategic merge patch is even easier, but is not an RFC, and depends on some annotations or other logic of how to handle lists.
A JSON Patch style, done as yml, to replace rootfs-acrn.yml.in would look something like:
A json merge patch wouldn't work, since a jsonmerge patch replaces an entire list.
Finally, we could look at the Kubernetes version of the strategic merge patch, which, if planned correctly, would let us do something like this:
This came from a discussion with @rvs
An alternate approach would be to get multiple files into linuxkit, just as we do with docker-compose. E.g.
We have discussed it in linuxkit, but never came to a conclusion. I would be willing to pursue it further.