Commit Graph

4 Commits (issue-7979)

Author SHA1 Message Date
clem59170 3e261382bf
Update gcr.go
refactor indentation
2024-04-10 11:52:01 +02:00
crafa 0462d1607d Refactor GCR Credentials Handling to Support Workload Identity
This commit updates the GCR (Google Container Registry) credentials handling
in Keel's GCR extension to add support for Google Cloud's Workload Identity,
while maintaining compatibility with the existing authentication method via
the GOOGLE_APPLICATION_CREDENTIALS environment variable.

Changes include:
- Removed the `credentials` string field from the CredentialsHelper struct.
  Credentials are now determined dynamically based on the runtime environment.
- Added `readCredentialsFromFile()` and `getWorkloadIdentityTokenCredentials()`
  functions to abstract the credential reading and token obtaining processes.
- Updated `GetCredentials` method to try reading the GOOGLE_APPLICATION_CREDENTIALS
  file first, falling back to Workload Identity if necessary.
- Extended registry URL check in `GetCredentials` to support Google Container Registry (`gcr.io`) and
  Google Artifact Registry URLs (`pkg.dev`).
- Adding pubSub boolean check for activating pubSub.

These changes allow for the use of both JSON key files and Workload Identity
for GCP authentication when polling instead of using pubSub.
2024-04-10 11:15:02 +02:00
Karolis Rusenas f526b2f87a should return an err 2020-06-06 13:50:25 +01:00
Sean Clemmer cafd5aea61 Support polling GCR 2019-07-31 13:51:04 -07:00