Kubernetes image clone controller
- It copies public docker images of Deployments & DaemonSet into backup-registry.
- It also updates the Deployments/DaemonSets to use image from backup-registry.
Dockerfile
is included incmd/imgcc/main
directory.deployment.yaml
in thesetup/makebuild
directory is usingdocker.io/sankalprangare/image-clone-controller
as image, and it also containsRBAC
manifests required by the controller.Makefile
in thesetup/makebuild
directory contains commands for publishing docker image, deploying and uninstalling the controller.
Note: This controller will get deployed in image-clone-controller
namespace.
-
Navigate to
setup/makebuild
directory and exportREGISTRY
,REGISTRY_USER
andREGISTRY_PASSWORD
as env variables like example below:- export REGISTRY=docker.io/sankalprangare
- export REGISTRY_USER=abc
- export REGISTRY_PASSWORD=abc123
-
After the previous step, run
make deploy
command fromMakefile
, this will deploy the controller.
Or you can also usekubectl
directly, given that you replace env variables in thedeployment.yaml
. -
Controller will update the images of respective objects after sometime.
-
To uninstall the controller run
make clean
.
- This simple implementation can be further improved to production-grade implementation.
- Enhancement can be made to support private-registry.
- Unit-tests can be improved to cover more cases.
- Predicates can be added to improve filtering.