feat: add K8SGPT_PROVIDER_REGION env var support for serve command#1607
feat: add K8SGPT_PROVIDER_REGION env var support for serve command#1607putz612 wants to merge 2 commits intok8sgpt-ai:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1607 +/- ##
==========================================
+ Coverage 34.76% 42.12% +7.35%
==========================================
Files 94 117 +23
Lines 6342 7074 +732
==========================================
+ Hits 2205 2980 +775
+ Misses 4046 3891 -155
- Partials 91 203 +112 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
three-foxes-in-a-trenchcoat
left a comment
There was a problem hiding this comment.
Looks good to me — tests pass except a failing codecov patch check (coverage delta). Approving based on code and CI; consider addressing codecov/patch failure if necessary.
|
@putz612 please review the DCO |
Signed-off-by: Jason Sievert <jsievert@gmail.com>
cabe3a7 to
0087a59
Compare
|
@AlexsJones I see that the operator change got merged in. Is there anything else I need to do to get this merged in? |
|
Sign the CLA please |
|
Complete |
three-foxes-in-a-trenchcoat
left a comment
There was a problem hiding this comment.
Small but useful addition. Provider region support via env var is consistent with other provider-specific config.
Note: Consider also supporting this in the auth add/update commands for consistency.
LGTM.
📑 Description
Add support for
K8SGPT_PROVIDER_REGIONenvironment variable in the serve command to allow configuring the provider region for backends likegooglevertexaiandamazonbedrock.Currently, the serve command reads
K8SGPT_PROVIDER_IDbut not the region, which causesgooglevertexaibackend to fail withRESOURCE_PROJECT_INVALIDerror when used with the k8sgpt-operator because the region is not being passed to the AI provider configuration.Problem
When using k8sgpt with the operator and
googlevertexaibackend:regionfield in the K8sGPT CRK8SGPT_PROVIDER_REGIONenv var (separate PR needed for k8sgpt-operator)cmd/serve/serve.godoesn't read this env var, soProviderRegionis always emptygooglevertexai.goto use the default region, which may not match the project configurationSolution
Read
K8SGPT_PROVIDER_REGIONfrom environment and set it in theAIProviderstruct, similar to howK8SGPT_PROVIDER_IDis handled.Changes
providerRegion := os.Getenv("K8SGPT_PROVIDER_REGION")to read the env varProviderRegion: providerRegion,to theAIProviderstruct initializationRelated
K8SGPT_PROVIDER_REGIONenv var forgooglevertexaibackend✅ Checks