In a typical containerized application we have a lifecycle that goes a little
like this:
- Developers push code to an application repository.
- A pipeline builds the latest code and pushes the resulting image to a
registry
- The pipeline updates the
images:
transformer in a Kustomization Overlay
for the dev
environment with the new image by using a command like
kustomize edit set image foobar=registry.example.com/foobar@sha256:deadbeef
- A tool like ArgoCD picks up the new image and starts a new deployment.
This works well for the dev
environment, but when that image needs to be
promoted to a new environment like tst
we either need to copy the updated
image transformer manually, or try to read the updated version from the dev
Kustomization.
And images are not the only thing. A typical Kustomize Overlay will include a
versioned Base with something like this:
1apiVersion: kustomize.config.k8s.io/v1beta1
2kind: Kustomization
3resources:
4- git.example.com/foobar.git/deploy/base?ref=v0.2.1
In this example we see that the Base that is being used comes from the Git tag
or branch called v0.2.1
. If a newer version of the application needs a newer
Base a developer can update that reference in the dev
Overlay, but promotions
will need to be handled as well.
Simply copying the kustomization.yaml
file between Overlays will most likely
not work, since different Overlays typically use different Replica
transformers, different ConfigMap en Secret Generators etc.
Read on to learn how you can automate this.