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

Multiple secrets for the same registry #642

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

Conversation

biclighter81
Copy link

@biclighter81 biclighter81 commented Nov 11, 2023

This is a pull request based on the following issue: #639

If you have multiple credentials for the same registry maybe because you want to pull private images from two different authors, the image updater currently can't pick the correct credentials for the job. My code checks if the argo application has a registry-prefix annotation. If it has one it picks the correct registry via the prefix configured in your registry configuration.

Example registry configuration

- name: GHCR author1
  api_url: https://ghcr.io
  prefix: ghcr.io/author1
  credentials: ext:/some/script
  credsexpire: 5h
- name: GHCR author2
  api_url: https://ghcr.io
  prefix: ghcr.io/author2
  credentials: ext:/some/script
  credsexpire: 5h

Example application configuration

argocd-image-updater.argoproj.io/app-author1.helm.image-name: app-author1.image.repository
argocd-image-updater.argoproj.io/app-author1.helm.image-tag: app-author1.image.tag
argocd-image-updater.argoproj.io/app-author1.registry-prefix: author1
argocd-image-updater.argoproj.io/app-author1.update-strategy: digest

argocd-image-updater.argoproj.io/app-author2.helm.image-name: app-author2.image.repository
argocd-image-updater.argoproj.io/app-author2.helm.image-tag: app-author2.image.tag
argocd-image-updater.argoproj.io/app-author2.registry-prefix: author2
argocd-image-updater.argoproj.io/app-author2.update-strategy: digest

I hope it helps someone.

@codecov-commenter
Copy link

Codecov Report

Merging #642 (0b302af) into master (82d59ef) will decrease coverage by 0.05%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##           master     #642      +/-   ##
==========================================
- Coverage   65.35%   65.30%   -0.05%     
==========================================
  Files          22       22              
  Lines        2084     2087       +3     
==========================================
+ Hits         1362     1363       +1     
- Misses        588      589       +1     
- Partials      134      135       +1     
Files Coverage Δ
pkg/argocd/update.go 66.18% <50.00%> (-0.36%) ⬇️

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

Copy link
Contributor

@jannfis jannfis left a comment

Choose a reason for hiding this comment

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

Thank you! Could you back up this use case by a unit test, maybe?

@bebosudo
Copy link

I tried updating the image on the argocd-image-updater we use to the one built from this branch. If I keep using the argocd-i-u 0.9.3 helm chart it works fine, but if I try updating the helm chart to 0.9.7 with the same Helm values then the pod fails to fetch any image. I'll investigate some more the changes between the 0.9.3 and .7 helm chart.

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.

None yet

4 participants