You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi team. I'd like to report that someone else may have the same problem.
I have a local (on-premise) Kubernetes environment on microk8s for testing, where I use argocd-image-updater.
If there is anything I can do to help, please let me know.
Describe the bug
I found that argocd-image-updater could not update multiple images under the following conditions.
argocd-image-updater updates only one image.
Using Kustomize
Update targets are multiple local docker registry images
Note that image includes :port such as localhost:5000 or 192.168.0.100:32000
It can be reproduced by unit tests.
I added the test to pkg/argocd/update_test.go to confirm.
funcTest_UpdateApplication(t*testing.T) {
// Based on Test_UpdateApplication/Test_kustomize_w/_multiple_images_w/_different_registry_w/_different_tagst.Run("Test kustomize w/ multiple images w/ local registry w/ different tags", func(t*testing.T) {
mockClientFn:=func(endpoint*registry.RegistryEndpoint, username, passwordstring) (registry.RegistryClient, error) {
regMock:= regmock.RegistryClient{}
regMock.On("NewRepository", mock.Anything).Return(nil)
regMock.On("Tags", mock.Anything).Return([]string{"1.0.2", "1.0.3"}, nil)
return®Mock, nil
}
argoClient:= argomock.ArgoCD{}
argoClient.On("UpdateSpec", mock.Anything, mock.Anything).Return(nil, nil)
kubeClient:= kube.KubernetesClient{
Clientset: fake.NewFakeKubeClient(),
}
annotations:=map[string]string{
// Cannot set `:>=1.0.1` due to similar another problem: msg="Using version constraint '5000/foobar:>=1.0.1' when looking for a new tag"common.ImageUpdaterAnnotation: "foobar=localhost:5000/foobar:>=1.0.1,foobar=localhost:5000/barbar",
common.ApplicationWideForceUpdateOptionAnnotation: "true",
}
appImages:=&ApplicationImages{
Application: v1alpha1.Application{
ObjectMeta: v1.ObjectMeta{
Name: "guestbook",
Namespace: "guestbook",
Annotations: annotations,
},
Spec: v1alpha1.ApplicationSpec{
Source: v1alpha1.ApplicationSource{
Kustomize: &v1alpha1.ApplicationSourceKustomize{
// (A) Commenting this out does the same thing.Images: v1alpha1.KustomizeImages{
"localhost:5000/foobar:1.0.1",
"localhost:5000/barbar:1.0.1",
},
},
},
},
Status: v1alpha1.ApplicationStatus{
SourceType: v1alpha1.ApplicationSourceTypeKustomize,
Summary: v1alpha1.ApplicationSummary{
// (B) Commenting this out does the same thing.Images: []string{
"localhost:5000/foobar:1.0.1",
"localhost:5000/barbar:1.0.1",
},
},
},
},
Images: *parseImageList(annotations),
}
res:=UpdateApplication(&UpdateConfiguration{
NewRegFN: mockClientFn,
ArgoClient: &argoClient,
KubeClient: &kubeClient,
UpdateApp: appImages,
DryRun: false,
}, NewSyncIterationState())
assert.Equal(t, 0, res.NumErrors)
assert.Equal(t, 0, res.NumSkipped)
assert.Equal(t, 1, res.NumApplicationsProcessed)
assert.Equal(t, 2, res.NumImagesConsidered)
assert.Equal(t, 2, res.NumImagesUpdated)
assert.Equal(t, v1alpha1.KustomizeImages(v1alpha1.KustomizeImages{"localhost:5000/foobar:1.0.3", "localhost:5000/barbar:1.0.3"}), appImages.Application.Spec.Source.Kustomize.Images)
})
}
You can see that the log is fine. However, the updated image is only "localhost:5000/barbar:1.0.3".
$ go test ./... -v -run Test_UpdateApplication/Test_kustomize_w/_multiple_images_w/_local_registry_w/_different_tags
=== RUN Test_UpdateApplication/Test_kustomize_w/_multiple_images_w/_local_registry_w/_different_tags
time="2023-01-07T07:21:13+09:00" level=debug msg="Considering this image for update" alias=foobar application=guestbook image_name=foobar image_tag=1.0.1 registry="localhost:5000"
time="2023-01-07T07:21:13+09:00" level=debug msg="setting rate limit to 20 requests per second" prefix="localhost:5000" registry="https://localhost:5000"
time="2023-01-07T07:21:13+09:00" level=debug msg="Inferred registry from prefix localhost:5000 to use API https://localhost:5000"
time="2023-01-07T07:21:13+09:00" level=debug msg="Using no version constraint when looking for a new tag" alias=foobar application=guestbook image_name=foobar image_tag=1.0.1 registry="localhost:5000"
time="2023-01-07T07:21:13+09:00" level=debug msg="found 2 from 2 tags eligible for consideration" image="localhost:5000/foobar:1.0.1"
time="2023-01-07T07:21:13+09:00" level=info msg="Setting new image to localhost:5000/foobar:1.0.3" alias=foobar application=guestbook image_name=foobar image_tag=1.0.1 registry="localhost:5000"
time="2023-01-07T07:21:13+09:00" level=info msg="Successfully updated image 'localhost:5000/foobar:1.0.1' to 'localhost:5000/foobar:1.0.3', but pending spec update (dry run=false)" alias=foobar application=guestbook image_name=foobar image_tag=1.0.1 registry="localhost:5000"
time="2023-01-07T07:21:13+09:00" level=debug msg="Considering this image for update" alias=foobar application=guestbook image_name=barbar image_tag=1.0.1 registry="localhost:5000"
time="2023-01-07T07:21:13+09:00" level=debug msg="Using no version constraint when looking for a new tag" alias=foobar application=guestbook image_name=barbar image_tag=1.0.1 registry="localhost:5000"
time="2023-01-07T07:21:13+09:00" level=debug msg="found 2 from 2 tags eligible for consideration" image="localhost:5000/barbar:1.0.1"
time="2023-01-07T07:21:13+09:00" level=info msg="Setting new image to localhost:5000/barbar:1.0.3" alias=foobar application=guestbook image_name=barbar image_tag=1.0.1 registry="localhost:5000"
time="2023-01-07T07:21:13+09:00" level=info msg="Successfully updated image 'localhost:5000/barbar:1.0.1' to 'localhost:5000/barbar:1.0.3', but pending spec update (dry run=false)" alias=foobar application=guestbook image_name=barbar image_tag=1.0.1 registry="localhost:5000"
time="2023-01-07T07:21:13+09:00" level=debug msg="Using commit message: "
time="2023-01-07T07:21:13+09:00" level=info msg="Committing 2 parameter update(s) for application guestbook" application=guestbook
time="2023-01-07T07:21:13+09:00" level=info msg="Successfully updated the live application spec" application=guestbook
update_test.go:95:
Error Trace: update_test.go:95
Error: Not equal:
expected: v1alpha1.KustomizeImages{"localhost:5000/foobar:1.0.3", "localhost:5000/barbar:1.0.3"}
actual : v1alpha1.KustomizeImages{"localhost:5000/barbar:1.0.3", "localhost:5000/barbar:1.0.3"}
Expected behavior
argocd-image-updater updates all images
Additional context
The cause is due to the implementation of argocd.
When comparing Kustomize image names, argocd checks the image name up to first : as an identifier, so it incorrectly recognizes 192.168.0.100:32000/api-server and 192.168.0.100:32000/app as the same image (192.168.0.100).
I believe I am also having this issue using gitlab as a registry. I have one argocd project that deploys 2 Applications, one to 'qa' and the other to 'prod'. Each of these have the same image, except the tag is 'develop' in the former case and 'main' in the later.
unfortunately argocd-image-updater only updates the deployed applications when the digest changes on the 'main' tag. And at that point, it actually updates both qa and prod to the same image.
When a new image is built for the develop tag, argocd-image-updater skips it because its only looking at 'main'.
Hi team. I'd like to report that someone else may have the same problem.
I have a local (on-premise) Kubernetes environment on microk8s for testing, where I use argocd-image-updater.
If there is anything I can do to help, please let me know.
Describe the bug
I found that argocd-image-updater could not update multiple images under the following conditions.
argocd-image-updater updates only one image.
:port
such as localhost:5000 or 192.168.0.100:32000This is an example Application to cause the problem.
Note the
argocd-image-updater.argoproj.io/image-list
.To Reproduce
It can be reproduced by unit tests.
I added the test to
pkg/argocd/update_test.go
to confirm.You can see that the log is fine. However, the updated image is only "localhost:5000/barbar:1.0.3".
Expected behavior
argocd-image-updater updates all images
Additional context
The cause is due to the implementation of argocd.
When comparing Kustomize image names, argocd checks the image name up to first
:
as an identifier, so it incorrectly recognizes 192.168.0.100:32000/api-server and 192.168.0.100:32000/app as the same image (192.168.0.100).Therefore, you can't use registry names containing colon
:
. You can use these workarounds.Version
Logs
See To Reproduce" section.
The text was updated successfully, but these errors were encountered: