Open
Conversation
Add a new `bedrock` credential type that injects AWS environment variables (CLAUDE_CODE_USE_BEDROCK, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION) from a referenced Secret, with optional support for AWS_SESSION_TOKEN and ANTHROPIC_BEDROCK_BASE_URL. Refactor credential injection into a centralized credentialEnvVars() function so that adding future providers (e.g. Vertex) requires only a new case block. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make Credentials.SecretRef a pointer (*SecretReference) so it can be omitted for bedrock credentials using IAM Roles for Service Accounts. Add Region and ServiceAccountName fields to Credentials for IRSA mode. CEL validation ensures secretRef remains required for api-key and oauth credential types. In IRSA mode, only CLAUDE_CODE_USE_BEDROCK=1 and AWS_REGION are injected — the AWS SDK handles auth via the projected service account token. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
I have confirmed that this works by running locally against my cluster and spawning tasks with the new CRDs. |
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.
What type of PR is this?
/kind feature
What this PR does / why we need it:
Add a new
bedrockcredential type that allows running Claude Code tasks via AWS Bedrock instead of the Anthropic API directly. Supports two modes:Also refactors credential injection into a centralized
credentialEnvVars()function so that adding future providers (e.g. Vertex) requires only a new case block.Changes:
CredentialTypeBedrockconstant and update CRD enum validationCredentials.SecretRefa pointer (*SecretReference) — optional for bedrock, required for api-key/oauth (enforced via CEL validation)Credentials.RegionandCredentials.ServiceAccountNamefields for IRSA supportcredentialEnvVars()to centralize credential env var injection for all typesbedrockconfig block in CLI for both static credentials and IRSA mode--regionand--service-accountCLI flagsexamples/09-bedrock-credentials/Which issue(s) this PR is related to:
Fixes #780
Special notes for your reviewer:
Credentials.SecretRefchanged from value type to pointer. All existing manifests withsecretRefset continue to work — the CRD is backwards-compatible. CEL validation ensuressecretRefis still required forapi-keyandoauthtypes.AWS_SESSION_TOKENandANTHROPIC_BEDROCK_BASE_URLare injected withOptional: trueon theSecretKeySelector, so pods won't fail if those keys are absent from the Secret.credentialEnvVars()refactor is a no-op for existingapi-keyandoauthtypes — it just moves the same logic into a single function.CLAUDE_CODE_USE_BEDROCK=1andAWS_REGIONare injected as literal env vars — the AWS SDK handles the rest via the projected token.Does this PR introduce a user-facing change?
Summary by cubic
Add a new
bedrockcredential type to run Claude Code via AWS Bedrock using either static AWS credentials or IRSA. Also updates CRD, CLI, and job env var injection to support region/service account and simplify adding future providers.New Features
credentials.type: bedrockwith two modes:AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_REGION(optionalAWS_SESSION_TOKEN,ANTHROPIC_BEDROCK_BASE_URL)CLAUDE_CODE_USE_BEDROCK=1andAWS_REGIONcredentials.regionandcredentials.serviceAccountName;secretRefoptional forbedrock(enforced via CEL; still required forapi-keyandoauth)bedrockconfig block and--region,--service-accountflags; prevents mixingoauthToken,apiKey, andbedrockcredentialEnvVars()Migration
Credentials.SecretRefis now a pointer (*SecretReference). Existing manifests continue to work; no changes needed forapi-key/oauth. For Bedrock IRSA, omitsecretRefand setregionandserviceAccountName.Written for commit d9c9943. Summary will update on new commits.