Open BillyMorgan opened 1 year ago
Hi @BillyMorgan, I wonder what's your output yaml script of kustomize build
command, would you like to show me that?
@David3310273 Sure thing, here you go, it's as you'd expect tho:
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-deployment
spec:
replicas: 1
selector:
matchLabels:
role: deployment
template:
metadata:
labels:
role: deployment
spec:
containers:
- command:
- tail
- -f
- /dev/null
image: busybox:ubuntu
imagePullPolicy: Always
name: test-pod
The current behavior is caused because kustomize edit set image
is prepended rather than appended.
The Application images are added using kustomize edit set image
here:
https://github.com/argoproj/argo-cd/blob/master/util/kustomize/kustomize.go#L141
and then kustomize build
is run.
Unfortunately, after calling kustomize edit set image busybox:1.24.0
, the kustomization.yaml file is effectively:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- base-deployment.yaml
images:
- name: busybox
newTag: 1.24.0
- name: container-image
newName: busybox
newTag: ubuntu
If kustomize edit set image
appended instead, then it would work as the OP expected.
As a workaround, remove the image transforms from the top-level kustomization.
Another workaround might be to move the image transforms to .argocd-source.yaml
https://argo-cd.readthedocs.io/en/stable/user-guide/parameters/#store-overrides-in-git
My Argo application has the following image set:
Kustomization:
base-deployment.yaml looks like:
As a result I get the
busybox:ubuntu
image, where I would expect to get thebusybox:1.24.0
image from the Argo application.