diff --git a/content/posts/application_kustomize_image.md b/content/posts/application_kustomize_image.md new file mode 100644 index 0000000..894bf71 --- /dev/null +++ b/content/posts/application_kustomize_image.md @@ -0,0 +1,35 @@ ++++ +title = "Application Kustomize image" +date = 2026-02-28T00:00:00-05:00 +draft = false ++++ + +When creating [Applications](https://argo-cd.readthedocs.io/en/latest/user-guide/application-specification/) in [Argocd](https://argo-cd.readthedocs.io/en/stable/) I always prefer to use [kustomize](https://argo-cd.readthedocs.io/en/stable/user-guide/kustomize/) for my own manifests. It allows me to create a simple "base" of manifests and then alter it for the specific use case via the `kustomize` attribute within the application. This allows a single place (the `Application` or `ApplicationSet`) to stores all the high level information for configuring the installation. + +While working on one project or another, I don't remember anymore why I needed to figure this out, I noticed the `images` attribute works differently in Argocd than it does in kustomize. **Since you the reader might be interested in the solution as opposed to the exploration, let me get that out of the way now**: + +_format_: `- [old_image_name=]:` + +Example: + +```yaml +spec: + source: + path: examples/helloWorld + repoURL: 'https://github.com/kubernetes-sigs/kustomize' + targetRevision: HEAD + kustomize: + images: + - nginx=docker.io/nginx:v1.1.2 +``` + +Documentation for this syntax was hard to find, so I had to go digging through the [source](https://github.com/argoproj/argo-cd/blob/a3b4c8327f38ef2edfb3be6c68f96729ce98f9d8/pkg/apis/application/v1alpha1/types.go#L653-L654) to find out how it should be formatted. + +Kustomize is less concise than argocd, having you [spell out each part](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/image.md). The same example above in kustomize would look like this. + +```yaml +images: +- name: nginx + newName: docker.io/nginx + newTag: v1.1.2 +```