Skip to content

Conversation

@dkarpele
Copy link
Contributor

@dkarpele dkarpele commented Oct 4, 2025

What type of PR is this?

/kind enhancement

What does this PR do / why we need it:
Image Updater: Provide option in Argo CD CR to enable/disable image updater

Have you updated the necessary documentation?

  • [yes] Documentation update is required by this PR.
  • [yes] Documentation has been updated.

Which issue(s) this PR fixes:

Fixes #?

go get github.com/argoproj-labs/argocd-image-updater@crd
go mod tidy

How to test changes / Special notes to the reviewer:
Tests and documentation will be created ASAP.
To test it manually you can

  1. create/edit/delete examples/argocd-image-updater.yaml
  2. kubectl apply -f examples/argocd-image-updater.yaml
  3. launch argocd operator as usual

Resources will be reconciled.

@dkarpele dkarpele changed the title feat(ImageUpdater): Add ImageUpdater controller feat(ImageUpdater): Provide option in Argo CD CR to enable/disable image updater Oct 4, 2025
Copy link
Collaborator

@svghadi svghadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dkarpele for working on this. Looks good overall. I have left some comments.

  • We should also bundle the ImageUpdater CRD into operator, similar to how we handle others here.

  • In the PR description, it mentions pulling from the crd branch in go.mod:

    go get github.com/argoproj-labs/argocd-image-updater@crd
    

    Is there a specific reason for using the crd branch instead of main or a release branch/tag?

Comment on lines 219 to 226
{
NamePattern: "app-name-pattern",
Images: []imageupdaterv1alpha1.ImageConfig{
{
Alias: "image-alias",
ImageName: "image-name",
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these placeholder values or actual ones? I haven’t looked into the image-updater project yet, so just confirming.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these are placeholders. NamePattern, Alias, ImageName are all mandatory, so we should give them some names.


func (r *ReconcileArgoCD) reconcileImageUpdaterConfigurationCR(cr *argoproj.ArgoCD) error {

defaultImageUpdaterConfigurationCR := &imageupdaterv1alpha1.ImageUpdater{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just trying to understand the use case for having a default ImageUpdater CR?
Is it meant to serve as a catch-all configuration for all image update operations, or is the expectation that users should modify this default ImageUpdater CR to suit their needs, rather than creating new ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users can modify this CR or create a new one.
My initial idea was to create a basic ImageUpdater CR that can help user to start working with image updater. @chengfang do you think we should have default ImageUpdater CR or not?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be straightforward for users to create their ImageUpdater CR, and likely in their application git repo. I imagine most users will probably not actually use or modify this default CR for their purpose. I feel we can remove it to avoid the runtime overhead.

podSpec.Containers = []corev1.Container{{
Command: []string{"/manager"},
Args: []string{"run"},
Image: argoutil.CombineImageTag(DefaultImageUpdaterImage, DefaultImageUpdaterTag),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make this configurable via env var so that downstream images can be set through the CSV in gitops-operator.

For ref:

ArgoCDDexImageEnvName = "ARGOCD_DEX_IMAGE"

Command: []string{"/manager"},
Args: []string{"run"},
Image: argoutil.CombineImageTag(DefaultImageUpdaterImage, DefaultImageUpdaterTag),
ImagePullPolicy: corev1.PullAlways,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are ongoing efforts to make the pull policy configurable, just wanted to highlight that.

@dkarpele
Copy link
Contributor Author

dkarpele commented Oct 6, 2025

  • In the PR description, it mentions pulling from the crd branch in go.mod:
    go get github.com/argoproj-labs/argocd-image-updater@crd
    

Is there a specific reason for using the crd branch instead of main or a release branch/tag?

The reason is that at the moment crd development of image updater goes in crd branch (not master). When we make the crd version "main" we will update the dependencies here to use

go get github.com/argoproj-labs/argocd-image-updater@main

@dkarpele
Copy link
Contributor Author

dkarpele commented Oct 6, 2025

Thanks for the review @svghadi
I addressed your requests and also added Image Updater's documentation.

get-image-updater-crd: ## Download Image Updater CRD.
@echo "downloading image updater crd"
@curl -sSLo config/crd/bases/argocd-image-updater.argoproj.io_imageupdaters.yaml https://raw.githubusercontent.com/argoproj-labs/argocd-image-updater/crd/config/crd/bases/argocd-image-updater.argoproj.io_imageupdaters.yaml

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need this target now that the ImageUpdater crd is bundled in?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking it could be useful in case someone wants to update argocd-image-updater.argoproj.io_imageupdaters.yaml. The original of this file is located in Image Updater repo and to reflect the future changes in this crd the target get-image-updater-crd: can be used.

@dkarpele dkarpele force-pushed the dk-GITOPS-7525 branch 2 times, most recently from 26f9a2c to d1c16bf Compare October 7, 2025 16:14
@dkarpele
Copy link
Contributor Author

dkarpele commented Oct 7, 2025

@svghadi

  • I removed ImageUpdater CR as discussed.
  • As a result we don't need to update go.mod with ImageUpdater dependency.
  • I added unit tests to controllers/argocd/image_updater_test.go.
  • e2e tests will be created later (end of October), after ImageUpdater CRD release 1.0.0. This is because we can't create Deployment properly (image link leads to an old version of ImageUpdater), see GITOPS-8016.

I don't plan any more changes in this PR.

Comment on lines 981 to 982
// Add new predicate to delete ImageUpdater Resources. The predicate watches the Argo CD CR for changes to the `.spec.ImageUpdater.Enabled`
// field. When a change is detected that results in image updater being disabled, we trigger deletion of image updater resources
Copy link
Collaborator

@svghadi svghadi Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking we could let the main reconcile handle the deletion when the component is disabled.
Predicates are generally meant to be lightweight filters that decide whether an event should be queued or skipped, rather than performing side-effect operations like updates or deletions. We already have a few places in the operator doing this, but it might be something we can gradually refactor later for consistency. Thoughts?

Copy link
Contributor Author

@dkarpele dkarpele Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes sense. Initially I created the same predicate as deleteNotificationsPred.
The main problem with deletion is that the order of resource deletion (deployment first) is different from resource creation (deployment last). To handle this I

  • removed predicate for ImageUpdater
  • created 2 functions: reconcileImageUpdaterControllerEnabled and reconcileImageUpdaterControllerDisabled.

Each reconcile function (reconcileImageUpdaterDeployment, reconcileImageUpdaterClusterRoleBinding etc.) handles deletion itself.

Copy link
Collaborator

@svghadi svghadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks

@svghadi svghadi merged commit 75d8bc3 into argoproj-labs:master Oct 15, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants