-
Notifications
You must be signed in to change notification settings - Fork 172
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
feat(controller): add rudimentary ecr and artifact registry support #2037
Conversation
✅ Deploy Preview for docs-kargo-akuity-io ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
5359c47
to
adf3b76
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2037 +/- ##
==========================================
+ Coverage 45.62% 45.71% +0.09%
==========================================
Files 234 236 +2
Lines 15998 16109 +111
==========================================
+ Hits 7299 7365 +66
- Misses 8342 8383 +41
- Partials 357 361 +4 ☔ View full report in Codecov by Sentry. |
7422b31
to
e115f55
Compare
…horization token Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
… token Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
Signed-off-by: Kent Rancourt <kent.rancourt@gmail.com>
e115f55
to
870c338
Compare
@hiddeco note that I've amended what you already reviewed to add Google Artifact Registry (and GCR?) support. |
ctx context.Context, credType Type, secret *corev1.Secret, | ||
) (Credentials, error) { | ||
if credType == TypeImage { | ||
// If the cred type is image, we'll try to derive username and password |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder if, at some point, it may be better to identify the type of credentials we are dealing with based on some user-defined value. Instead of the brute-force approach that's being taken now.
Follow up to #2018. Does not quite solve #1885 or #2029 because this does not use workload identity.
As noted in #1885, a possible workaround was to use a CronJob to periodically exchange AWS access key ID and secret access key for a short-lived ECR authorization token (12 hours). The token is of the form
base64(AWS:<temporary-passsword>)
.Similarly, a GCP service account key (which is structured data) can be exchanged for a GCP access token (one hour) for Artifact Registry. (I believe it works for GCR as well, although GCR is deprecated and as of a few days ago, new repos cannot be created in GCR.) This is an oauth2 access token, which can also be presented as a password (along with username
oauth2accesstoken
) when using basic auth.This PR introduces functionality that seamlessly makes these exchanges. It also caches tokens to avoid excessive calls to the AWS and GCP APIs.
Why are we doing this first and not jumping straight to using workload identity?
Good question. Workload identity will not help a Kargo instance running outside of AWS to access ECR and it will not help a Kargo instance running outside of GCP to access Artifact Registry -- which makes this feature a lowest common denominator / universal solution for ECR and Artifact Registry integration.
Note: ACR (Azure Container Registry) does not require anything special because ACR provides for long-lived, user-managed tokens, with or without an expiration date.
I will circle back to add workload identity-based options for all three major cloud providers in a follow-up(s). See #1885 and #2029.
Docs to be included in a follow-up as well.