Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Plugin type applications with argocd write-back #738

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rpg600
Copy link

@rpg600 rpg600 commented Jun 7, 2024

This PR introduces support for updating container images in Plugin type applications with the imperative argocd write-back method.

Key Features:

  • Environment Variable Modification: Instead of adding parameters to the helm source of the application manifest, this PR modifies the HELM_ARGS environment variable within the plugin source.

  • Integration with argocd-vault-plugin: The HELM_ARGS env variable is primarily used by argocd-vault-plugin to pass arguments to the helm template command before it generates the final manifest with vault values. For more details, visit https://argocd-vault-plugin.readthedocs.io/en/stable/usage/#with-additional-helm-arguments

Example of my use case:

Annotations:

argocd-image-updater.argoproj.io/image-list: php=registry.myapp.cloud/myapp/php:dev, nginx=registry.myapp.cloud/myapp/nginx:dev
argocd-image-updater.argoproj.io/php.helm.image-tag: php.image.tag
argocd-image-updater.argoproj.io/nginx.helm.image-tag: nginx.image.tag
argocd-image-updater.argoproj.io/update-strategy: digest
  • Every time a commit is pushed to the dev branch, images are built with the dev tag in the CI pipeline.

  • The dev tag is mutable, which is why the digest strategy is used.

  • php.image.tag and nginx.image.tag are keys inside the values.yaml file that need to be overridden if a new digest of the images tag exists.

  • With auto-sync enabled, the application is deployed automatically.

Initial manifest:

source:
  plugin:
    env:
      - name: HELM_ARGS
        value: >-
          -f ../../dev/charts/myapp/values.yaml

Updated manifest after an image update:

source:
  plugin:
    env:
      - name: HELM_ARGS
        value: >-
          -f ../../dev/charts/myapp/values.yaml 
          --set php.image.tag=dev@sha256:fb4b84725901d2c7214e080f2314e55dbc9c2cf2b7a9845c288c3014c7d614ab
          --set nginx.image.tag=dev@sha256:1e6a0957539cfb89a691ee721d4cd23ec5f4a9870c674fe4e8a50896d9ba386e
  • All previously defined arguments are preserved.
  • If a --set argument is already defined, it will be modified; otherwise, it will be added.

How to try it:

You can try out this feature by applying the following command:

kubectl apply -n argocd -f https://raw.githubusercontent.com/rpg600/argocd-image-updater/plugin-type-support-wmanifest/manifests/install.yaml

It's based on v0.13.1

Notes:

This PR was primarily focused on my specific use case and may not cover all possible scenarios, but I wanted to share it for broader use and feedback. I have not tested the Git write-back method. However, the related PR #637 appears to add this support.

It fixes #417

@rpg600 rpg600 force-pushed the plugin-type-support branch 5 times, most recently from b73579f to 5137c07 Compare June 8, 2024 08:06
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.

[Question] Is it possible to use image updater together with argocd-vault-plugin
1 participant