kaniko/pkg
Damien Degois 1bf529e6d9
Add flag to remap registries for any registry mirror (#2935)
* Add flag to remap registries for any registry mirror

The purpose of this PR is to add an option to remap registries, a kind of generalized `--registry-mirror`.
This is helpful for air-gapped environments and/or when local registry mirrors are available (not limited to docker.io).
This allows user to reference any images without having to change their location.
It also permit to separate infra related configuration (the mirrors) from CI/CD pipeline definition by using an environment variable for example (the reason behind the early return if flag provided but empty).
Therefore you can have a pipeline calling kaniko with `--registry-map=$REGISTRY_MAP` and have the `REGISTRY_MAP` populated via the runner's env by another team, and the absence of env wouldn't trigger a failure, it makes the pipeline env independent.

I've also considered the option of environment variables directly but it doesn't seems to be in kaniko's philosophy.

This makes quite some duplicated code :/ One option to keep the mirror flag and behavior would be to use only one codebase and convert `--registry-mirror=VALUE` to `--registry-map=index.docker.io=VALUE` internally. Suggestions welcome!

* Configure logging config sooner to be able to use it in flag parsing

* Replace registry mirrors by maps logic and use env var

* Add env vars to README.md

* Fix test
2024-02-14 15:23:41 -08:00
..
buildcontext replace Azure/azure-storage-blob-go => Azure/azure-sdk-for-go/sdk/storage/azblob (#2945) 2024-01-16 10:45:40 -08:00
cache Reproducing and Fixing #2892 (#2893) 2023-12-14 17:00:54 -08:00
commands chore(deps): bump github.com/moby/buildkit from 0.11.6 to 0.12.5, github.com/docker/docker from 24.0.7+incompatible to 25.0.2+incompatible, and other deps (#2995) 2024-02-09 18:03:08 -08:00
config Add flag to remap registries for any registry mirror (#2935) 2024-02-14 15:23:41 -08:00
constants Fix fs_util tests failing on systems with /tmp mountpoint (#2583) 2023-06-19 12:01:20 -07:00
creds fix: Remove references to deprecated io/ioutil pkg (#2867) 2023-11-28 13:02:53 -08:00
dockerfile fix: Remove references to deprecated io/ioutil pkg (#2867) 2023-11-28 13:02:53 -08:00
executor Fix missing or partial support for pattern substition in variable references with cache enabled (#2968) 2024-02-13 18:57:19 -08:00
fakes refactor cache.Warm and add tests 2020-01-10 12:29:17 -08:00
filesystem fix: Remove references to deprecated io/ioutil pkg (#2867) 2023-11-28 13:02:53 -08:00
image Add flag to remap registries for any registry mirror (#2935) 2024-02-14 15:23:41 -08:00
logging Add timestamp to logs 2020-04-23 13:40:47 +02:00
mocks/go-containerregistry/mockv1 rename mock pkg for lint 2020-01-17 14:59:14 -08:00
snapshot fix: Remove references to deprecated io/ioutil pkg (#2867) 2023-11-28 13:02:53 -08:00
timing Fix Integration tests (#2425) 2023-03-21 12:30:54 -04:00
util chore: update gcr and docker cred helpers (#2910) 2023-12-19 12:36:13 -05:00
version Set a user-agent for registry pushes. (#87) 2018-04-13 14:25:58 -07:00