Repository navigation
feat(adapters): agent-sandbox authenticates to GKE with Google credentials - #138
Merged
Merged
Conversation
…tials auth: google makes an agent-sandbox pool send Google access tokens to a GKE API server instead of a Kubernetes token: the VM's service account through the metadata server (the default without a credential), a service-account key, or workload identity federation, through cloudhttp.GoogleTokens. A control plane on Compute Engine can then drive GKE pools without a long-lived Kubernetes token. Tokens carry cloud-platform and userinfo.email: GKE identifies an account by email, which RBAC binds, only with userinfo.email. Google token sources now take several scopes (comma-joined for the metadata server, a list for impersonation), and a token the API server rejects (401) is dropped so the next call fetches a new one. The Compute Engine guide gives the control node the userinfo-email scope. Tested with a fake metadata server and the fake API server; not run against GKE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jalil <reachjalil@gmail.com>
…ion, and drops only the rejected token Found by an independent review: a Google token could go to an http:// apiServer; a federation config without impersonation has no email for RBAC; a 401 cleared whatever token was cached, on every call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Jalil <reachjalil@gmail.com>
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.
A control plane outside a GKE cluster, like ours on the Compute Engine VMs in
docs/deploy/gcp-vms.md, could reach GKE only with a long-lived Kubernetes service-account token. This addsauth: google: theagent-sandboxpool authenticates to the GKE API server as a Google service account, using the same token codegcp-sandboxesuses.cloud-platformanduserinfo.email. GKE's docs say tokens "must include theuserinfo.emailOAuth scope"; without it RBAC sees the account's numeric ID, not the email it binds. Compute Engine leaves that scope out by default, so the guide now gives the control node--scopes=cloud-platform,userinfo-email.apiServermust behttps://: the token opens every Google API its account may use.service_account_impersonation_urlis refused, since a federated identity has no email for RBAC to bind.gcp-sandboxes, is unchanged.docs/providers/agent-sandbox.mdcovers setup. Use the DNS-based endpoint (public certificate, no CA file), give the service accountroles/container.clusterVieweron the project, bind the Role tokind: Userwith the account's email, and allow egress to the metadata server and DNS.Tests
apiServer,http://, a badauthvalue, federation without impersonation, and a credential that isn't Google's.Invalidatedrops only the rejected token, rate-limited.make verifyand the site build pass.Review: an independent review found the plain-http and federation gaps and the over-eager token drop, all fixed in the second commit. It found no credential in any error or log.
Not run: GKE. Also unverified is how the real metadata server treats a
scopeslist that includes scopes the VM lacks; it fails closed either way.🤖 Generated with Claude Code