fix(credentialshelper): correct GCR OAuth scope and enforce deterministic helper ordering#855
Open
vovinacci wants to merge 2 commits intokeel-hq:masterfrom
Open
fix(credentialshelper): correct GCR OAuth scope and enforce deterministic helper ordering#855vovinacci wants to merge 2 commits intokeel-hq:masterfrom
vovinacci wants to merge 2 commits intokeel-hq:masterfrom
Conversation
…t GAR `google.DefaultTokenSource` with `storage.ScopeReadOnly` yields a token that cannot access Artifact Registry (`docker.pkg.dev`) Docker Registry v2 APIs, causing HTTP **403** on HEAD `.../manifests/<ref>` during poll triggers. Request cloud-platform scope so default/GKE workload identity credentials can authenticate to private Artifact Registry repositories.
Author
|
@rusenask Sorry for tagging, we need this to keep upgrading. This change is battle tested - we use it for two weeks already. Many thanks in advance! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the changes:
storage.ScopeReadOnly(devstorage.read_only) withcloud-platformingoogle.DefaultTokenSourceso workload-identity tokens can authenticate against Artifact Registry (*.docker.pkg.dev) Docker Registry HTTP API v2 endpoints. The narrower scope causes HTTP 403 onHEAD .../manifests/<ref>during poll triggers.secrets=>aws=>gcr) instead of random Go map order. Without this, workload-identity tokens from thegcrhelper can win over explicitimagePullSecretsresolved by thesecretshelper, causing flaky 403 responses against private registries.HelperNameSecrets,HelperNameAWS,HelperNameGCRconstants so helper names are compile-time checked; addjsonKeyUsernameconstant alongsideoauth2TokenUsername. Warn onGOOGLE_APPLICATION_CREDENTIALSonly when the env var is set but the file is unreadable (silent on the normal workload-identity path); useerrors.Isfor sentinel error comparison.Resolves #854.
Note:
go fmtreformatted indentation ingcr.goand a spacing fix inaws.goto conform to Go coding standards.