Repository navigation
feat(sdk,deploy): add xdash IAM token fallback and metrics addon setup script - #1305
Conversation
…p script - Add automatic IAM OIDC token generation and 55-minute caching (`_TOKEN_TTL_SEC = 3300.0`) to `xdash.DashboardClient` when `XMC_AUTH_TOKEN`/`AUTH_TOKEN` are unset and `XMC_CLIENT_SA` + `IAP_CLIENT_ID` are set. - Preserve existing component profile Helm value overrides across upgrades in `tools/common/tool_utils.py` via `--reset-then-reuse-values`. - Extract reusable `deploy/addons/metrics/setup_metrics_addons.sh` and wire `.github/workflows/deploy-gke.yml` to invoke it. TAG=agy CONV=6aeb27e4-5dac-435a-8459-5e10f7991f23
There was a problem hiding this comment.
Code Review
This pull request introduces an automated setup script for GKE metrics addons (ClickHouse and Redpanda) and adds support for automatic IAM OIDC token generation and caching in the Python DashboardClient. Feedback on the changes highlights a critical issue where an invalid Helm flag (--reset-then-reuse-values) was used, which should be corrected to --reuse-values. Additionally, the reviewer suggests implementing thread-safe token caching in the Python client using a threading lock and a double-checked locking pattern to prevent race conditions under concurrent load.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request automates the GKE metrics addons setup, adds automatic IAM OIDC token generation and caching to the Python SDK client, and updates the Helm deployment utility for component profiles. Key feedback includes correcting a non-existent Helm flag (--reset-then-reuse-values) to --reuse-values in both the utility and its tests. Additionally, the Python client should raise an explicit configuration error when there is a partial setup of the IAM OIDC environment variables to avoid silent authentication failures.
… flag - Replace --reset-then-reuse-values with --reuse-values in deploy_component_profile() - Add thread-safe double-checked locking (threading.Lock) for IAM OIDC token cache in DashboardClient - Raise XDashError when only one of XMC_CLIENT_SA or IAP_CLIENT_ID is configured TAG=agy CONV=6aeb27e4-5dac-435a-8459-5e10f7991f23
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces automated GKE metrics addons setup scripts and documentation, adds support for automatic IAM OIDC token generation and caching in the Python xdash client when using IAP-protected deployments, and updates the Helm deployment utility to reuse values. Feedback on the changes suggests improving the robustness of the Python client by catching ImportError on optional dependencies to raise a descriptive error, and assigning the cached token to a local variable in the double-checked locking pattern to ensure thread safety.
…k addon namespaces Comment links: #1305 (comment) #1305 (comment) #1305 (comment) #1305 (comment)
Summary
Adds IAM OIDC token fallback to the
xdashPython SDK (DashboardClient), preservesxmc-profilecomponent overrides acrossgke-upgraderuns, and extracts the 8-step ClickHouse/Redpanda GKE setup into a reusabledeploy/addons/metrics/setup_metrics_addons.shscript.Motivation & Context
deploy/ctk_v2/configure_env.pypopulateXMC_CLIENT_SAandIAP_CLIENT_IDin.envrather than a staticXMC_AUTH_TOKEN. WhileExperimentStateGRpcApiautomatically mints IAM OIDC tokens from those variables,xdash.DashboardClientpreviously checked onlyXMC_AUTH_TOKEN/AUTH_TOKEN, causingUnauthenticatederrors on step[3/3]ofexamples/metrics_dashboard_job/launch.py.deploy_component_profile()intools/common/tool_utils.pypreviously ranhelm upgrade --install xmc-profilewithout--reuse-values, resetting enabled components (redpanda,clickhouse,ingestion-gateway) back toenabled: falseon subsequent upgrades.deploy/addons/multikueue/setup_multikueue.sh), the 8-step metrics addon provisioning sequence was inlined in.github/workflows/deploy-gke.yml, requiring manual step-by-step execution on developer clusters.Key Changes
sdks/python/xdash/client.py,sdks/python/xdash/client_test.py,sdks/python/xdash/README.md): Mint and cache (55-minute monotonic TTL with thread-safe double-checked locking) an OIDC token via the IAM CredentialsgenerateIdTokenAPI whenXMC_AUTH_TOKEN/AUTH_TOKENare unset andXMC_CLIENT_SA+IAP_CLIENT_IDare set, raisingXDashErrorif only one of the two IAM env vars is configured.tools/common/tool_utils.py,tools/common/tool_utils_test.py): Pass--reuse-valuestohelm upgrade --install xmc-profile.deploy/addons/metrics/setup_metrics_addons.sh,.github/workflows/deploy-gke.yml,deploy/addons/metrics/clickhouse/README.md): Extract the ClickHouse and Redpanda addon setup sequence into an executable script and invoke it fromdeploy-gke.yml.Assumptions
XMC_AUTH_TOKEN/AUTH_TOKEN) take precedence overXMC_CLIENT_SA+IAP_CLIENT_ID— assumed to preserve explicit caller token overrides — if wrong, static env tokens would be ignored when service account variables are also present.google.authis imported lazily only when IAM OIDC token generation is triggered — assumed so local/plaintextxdashcallers do not requiregoogle-auth— if wrong, callers withoutgoogle-authusingXMC_CLIENT_SAwill receive a clearXDashError.Verification & Testing
bazel test //sdks/python/xdash/... //tools/common/...,bazel coverage --combined_report=lcov //sdks/python/xdash/... //tools/common/...,python3 ./tools/run_affected_tests.py --skip-emulator-check, and./.githooks/pre-commitRelated Issues / Bugs
N/A
TAG=agy
CONV=6aeb27e4-5dac-435a-8459-5e10f7991f23