Skip to content

feat(sdk,deploy): add xdash IAM token fallback and metrics addon setup script - #1305

Merged
VLukiantsev merged 4 commits into
mainfrom
feat/xdash-iam-auth-and-metrics-addon-setup
Oct 20, 2026
Merged

VLukiantsev merged 4 commits into
mainfrom
feat/xdash-iam-auth-and-metrics-addon-setup

Conversation

@VLukiantsev

@VLukiantsev VLukiantsev commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds IAM OIDC token fallback to the xdash Python SDK (DashboardClient), preserves xmc-profile component overrides across gke-upgrade runs, and extracts the 8-step ClickHouse/Redpanda GKE setup into a reusable deploy/addons/metrics/setup_metrics_addons.sh script.

Motivation & Context

  • Environments configured via deploy/ctk_v2/configure_env.py populate XMC_CLIENT_SA and IAP_CLIENT_ID in .env rather than a static XMC_AUTH_TOKEN. While ExperimentStateGRpcApi automatically mints IAM OIDC tokens from those variables, xdash.DashboardClient previously checked only XMC_AUTH_TOKEN/AUTH_TOKEN, causing Unauthenticated errors on step [3/3] of examples/metrics_dashboard_job/launch.py.
  • deploy_component_profile() in tools/common/tool_utils.py previously ran helm upgrade --install xmc-profile without --reuse-values, resetting enabled components (redpanda, clickhouse, ingestion-gateway) back to enabled: false on subsequent upgrades.
  • Unlike MultiKueue (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

  • IAM OIDC Token Fallback (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 Credentials generateIdToken API when XMC_AUTH_TOKEN/AUTH_TOKEN are unset and XMC_CLIENT_SA + IAP_CLIENT_ID are set, raising XDashError if only one of the two IAM env vars is configured.
  • Component Profile Override Preservation (tools/common/tool_utils.py, tools/common/tool_utils_test.py): Pass --reuse-values to helm upgrade --install xmc-profile.
  • Metrics Addon Setup Script (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 from deploy-gke.yml.

Assumptions

  • Static tokens (XMC_AUTH_TOKEN / AUTH_TOKEN) take precedence over XMC_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.auth is imported lazily only when IAM OIDC token generation is triggered — assumed so local/plaintext xdash callers do not require google-auth — if wrong, callers without google-auth using XMC_CLIENT_SA will receive a clear XDashError.

Verification & Testing

  • Commands Executed: 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-commit
  • Coverage & Test Status: 8/8 direct targets (100% coverage on modified functions) and 220/220 affected test targets passed; all pre-commit linters and formatters passed.

Related Issues / Bugs

N/A

TAG=agy
CONV=6aeb27e4-5dac-435a-8459-5e10f7991f23

…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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tools/common/tool_utils.py Resolved
Comment thread sdks/python/xdash/client.py Resolved
Comment thread sdks/python/xdash/client.py Resolved
Comment thread sdks/python/xdash/client.py Resolved
Comment thread tools/common/tool_utils_test.py Resolved
@VLukiantsev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tools/common/tool_utils.py Resolved
Comment thread tools/common/tool_utils_test.py Resolved
Comment thread sdks/python/xdash/client.py Resolved
… 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
@VLukiantsev

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread sdks/python/xdash/client.py Resolved
Comment thread sdks/python/xdash/client.py Resolved
@VLukiantsev
VLukiantsev marked this pull request as ready for review October 19, 2026 13:23
@VLukiantsev
VLukiantsev enabled auto-merge October 19, 2026 13:23
@github-actions
github-actions Bot requested a review from janzak-dev October 19, 2026 13:23
Comment thread sdks/python/xdash/client.py Resolved
Comment thread sdks/python/xdash/client.py Resolved
Comment thread tools/common/tool_utils.py Resolved
@VLukiantsev
VLukiantsev added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit b849164 Oct 20, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants