Overview/Background
Container images used for Konvoy and addons are hosted in public container registries. An airgapped environment would not have access to these public image registries. Konvoy enables seeding these images to a private registry within the airgapped environment using the konvoy config images seed
command. This command takes a specially formatted list of images to seed, to the private registry, as a file named images.json
. This filename is currently not configurable, as a result any image list file for seeding would need to be named images.json
. This is non-trivial for installing konvoy. However, if you want to seed additional images, for example when trying to install KUDO Kubeflow, you might need to merge multiple images.json files.
Solution
In this article we will take the example of KUDO kubeflow, where to install it in an airgapped environment, the documentation instructs us to merge images-runtime.json
and images-install.json
file with the main images.json
file. Merging these three files is quite straightforward using any text editor as long as you pay attention to the braces and commas, however, the files can be hundreds or thousands of lines long. We will use jq to merge the files to avoid copy-pasting thousands of lines or JSON debugging syntax errors.
This assumed that you have all the JSON files in your current directory and you want the resulting file to end up in a subdirectory named combined
.
Get the headers from the main images.json
jq 'del (.images)' images.json > combined/images-header.json
Merge the image list from all the image.json files
jq -s 'reduce .[] as $dot ({}; .images += $dot.images)' images.json images-install.json images-runtime.json > combined/images-only.json
Merge header fields and image list into a single file
jq -s '.[0] + .[1]' combined/images-header.json combined/images-only.json > combined/images.json