feat(catalog): add GCP Cloud KMS support for secret decryption#4243
Conversation
🔄 Flaky Test DetectedAnalysis: All three failing jobs show flakiness indicators: one hit the 15-minute timeout ( ✅ Automatically retrying the workflow |
🔄 Flaky Test DetectedAnalysis: Both failures share the same transient infrastructure error — ✅ Automatically retrying the workflow |
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
❌ Test FailureAnalysis: Deterministic compile error: |
🔄 Flaky Test DetectedAnalysis: The e2e test ✅ Automatically retrying the workflow |
🔄 Flaky Test DetectedAnalysis: Virtually all e2e tests timed out at ~31s across every suite (MySQL, PG, Mongo, PG_CH_Cluster), indicating the peer-flow worker became unresponsive during the run rather than any individual test logic regression. ✅ Automatically retrying the workflow |
898c481 to
405dfc6
Compare
Add a PEERDB_KMS_PROVIDER env var ("aws" default, "gcp") to select
the KMS backend for catalog credential decryption.
When set to "gcp", uses the GCP metadata server for Workload Identity
access tokens and calls the Cloud KMS REST API to decrypt. The key ID
is the raw GCP resource name (projects/.../cryptoKeys/...).
AWS behavior is unchanged and remains the default.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Go flow worker, maintenance worker, and other flow components also decrypt catalog credentials via KMS. Add the same PEERDB_KMS_PROVIDER=gcp dispatch to the Go side, using the GCP metadata server for Workload Identity tokens and the Cloud KMS REST API for decryption. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Rust: remove needless Ok(x?) → x (clippy::needless_question_mark) - Go: use http.NoBody instead of nil request body (gocritic::httpNoBody) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace manual metadata token fetch + raw REST API calls with the official cloud.google.com/go/kms client library. The client handles authentication via Application Default Credentials (Workload Identity on GKE) automatically. This reduces ~50 lines of HTTP plumbing to ~15 lines of typed SDK calls and eliminates manual token management, JSON serialization, and error response parsing. Pinned cloud.google.com/go/kms at v1.24.0 to stay within the google.golang.org/api v0.257.0 constraint. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add back strings import (still used by strings.TrimSpace) - Register cloud.google.com/go/kms v1.24.0 in check_pinned_versions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
405dfc6 to
018b7e6
Compare
Per review on #4243 (comment) — define KmsProviderAWS/KmsProviderGCP constants, list all cases (aws + empty for back-compat, gcp), default branch returns an error matching the Rust side in nexus/catalog/src/lib.rs:43-47.
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
masterashu
left a comment
There was a problem hiding this comment.
Looks good.
Any reason to use api calls to use http calls instead of google_cloud_kms library?
Let me give you claude's explanation, althought I have no rust experience to evaluate it |
Summary
PEERDB_KMS_PROVIDERenv var to dispatch between AWS KMS and GCP Cloud KMS for catalog secret decryptionnexus/catalog): GCP Cloud KMS REST API viareqwest, using a Workload Identity token fetched from the GKE metadata serverflow/internal/env.go): GCP Cloud KMS via the officialcloud.google.com/go/kms/apiv1client (uses Application Default Credentials, which resolves to Workload Identity on GKE)aws(and empty for back-compat),gcp, and returns an explicit error for unknown values; constantsKmsProviderAWS/KmsProviderGCPintroduced in Go to mirror the Rust patternawseverywhere — no behavior change for existing AWS deploymentsTest plan
PEERDB_KMS_PROVIDER=(empty), unset, andPEERDB_KMS_PROVIDER=awsall still hit the AWS pathPEERDB_KMS_PROVIDER=invalidreturns the new error rather than silently falling through to AWS🤖 Generated with Claude Code