Skip to content

feat(ctk): enable managed mldiagnostics - #762

Merged
CatherineF-dev merged 13 commits into
mainfrom
feat/enable-managed-mldiagnostics-and-xprof
Sep 8, 2026
Merged

CatherineF-dev merged 13 commits into
mainfrom
feat/enable-managed-mldiagnostics-and-xprof

Conversation

@CatherineF-dev

@CatherineF-dev CatherineF-dev commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator
  1. Set Variables in deploy/ctk_v2/xmanager-cloud-deployment-south1.yaml
vars:
  deployment_name: xx
  project_id: xxx
  region: xx
  environment: xx

  # Managed ML Diagnostics & Managed XProf
  enable_managed_mldiagnostics: true
  managed_xprof_gcs_bucket: "gs://diagon-xmc-xprof-us-south1"
  1. CTK Execution Commands
*1. Compile blueprint into the deployment directory (preserves existing Terraform state via -w)*
./cluster-toolkit/gcluster create deploy/ctk_v2/xmanager-cloud.yaml \
  -d deploy/ctk_v2/xmanager-cloud-deployment-south1.yaml \
  -o ctk-out -l WARNING -w --force

*2. Enable Hypercompute Cluster API*
./cluster-toolkit/gcluster deploy ctk-out/diagon-south1 --only apis 

*3. Update IAM bindings for Workload and Node Pool SAs*
./cluster-toolkit/gcluster deploy ctk-out/diagon-south1 --only primary

*4. Enable Managed ML Diagnostics on GKE cluster & provision ct5lp-hightpu-4t TPU pool*
./cluster-toolkit/gcluster deploy ctk-out/diagon-south1 --only compute 

*5. Upgrade XMC Helm release with managedXprofGcsBucket*
./cluster-toolkit/gcluster deploy ctk-out/diagon-south1 --only xmc_app

#750

…agnostics

Thread the managed_xprof_gcs_bucket setting through the cluster-toolkit (ctk_v2)
blueprint so a ctk deploy can point the actuator at the GCS bucket used for
Managed XProf profiling data. The Helm value (managedXprofGcsBucket) and the
actuator wiring already exist; this adds the missing blueprint variable and the
Helm setting mapping, mirroring the enable_metrics feature switch.

Also document the cluster-level prerequisite: Managed ML Diagnostics must be
enabled on the GKE cluster via
"gcloud container clusters ... --enable-managed-mldiagnostics", which is a GKE
cluster feature rather than an XMC application setting.

- deploy/ctk_v2/xmanager-cloud.yaml: add managed_xprof_gcs_bucket var + Helm setting
- deploy/ctk_v2/xmc-deployment-template.yaml: add documented deployment variable
- deploy/ctk_v2/README.md: document the switch + gcloud prerequisite

@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 support for Google Cloud Managed ML Diagnostics (Managed XProf) on GKE clusters. It adds configuration variables, updates deployment templates and documentation, enables the necessary GCP APIs and IAM roles, and updates the dev environment CLI. The review feedback suggests validating that the GCS bucket URI starts with 'gs://' during configuration loading (with a corresponding unit test) and raises a security concern regarding the project-wide 'storage.objectCreator' permission, recommending restricting it to the specific GCS bucket instead.

Comment thread tools/dev_env/config.py Resolved
Comment thread tools/dev_env/config_test.py Resolved
Comment thread deploy/ctk_v2/xmanager-cloud.yaml Resolved
@CatherineF-dev CatherineF-dev changed the title Feat/enable managed mldiagnostics and xprof feat(ctk): enable managed mldiagnostics and xprof Sep 3, 2026
@CatherineF-dev CatherineF-dev changed the title feat(ctk): enable managed mldiagnostics and xprof feat(ctk): enable managed mldiagnostics Sep 3, 2026
@CatherineF-dev
CatherineF-dev force-pushed the feat/enable-managed-mldiagnostics-and-xprof branch from d791ef3 to a5acce6 Compare September 3, 2026 11:43
…-gcs-bucket

Enable Google Cloud Managed ML Diagnostics on GKE clusters provisioned via
Cluster Toolkit (CTK) and thread configuration flags through the dev_env CLI.

What changes:
- deploy/ctk_v2/xmanager-cloud.yaml:
  * Expose enable_managed_mldiagnostics variable (default false)
  * Enable hypercomputecluster.googleapis.com in cloud_api conditionally based on enable_managed_mldiagnostics
  * Add hypercomputecluster.editor to workload service account project roles conditionally based on enable_managed_mldiagnostics
  * Add storage.objectCreator to node pool service account project roles
  * Pass enable_ml_diagnostics to modules/scheduler/gke-cluster
  * Map mldiagnostics.enabled to Helm values
- deploy/ctk_v2/xmc-deployment-template.yaml: Document enable_managed_mldiagnostics variable
- deploy/ctk_v2/README.md: Document the feature switch and dev_env CLI options
- deploy/helm/values.yaml: Expose mldiagnostics.enabled default
- tools/dev_env/dev_env.py: Add --enable-managed-mldiagnostics, --no-enable-managed-mldiagnostics, and --managed-xprof-gcs-bucket CLI arguments
- tools/dev_env/config.py: Parse and resolve mldiagnostics and xprof bucket settings; validate gs:// prefix on GCS bucket URI
- tools/dev_env/dev_env_test.py, tools/dev_env/config_test.py: Unit tests for new CLI flags, config resolution, and invalid bucket validation

Changelog:
- Make hypercomputecluster.googleapis.com and hypercomputecluster.editor conditioned by enable_managed_mldiagnostics flag using HCL concat/ternary expressions in CTK.
- Address PR review comments: validate that managed_xprof_gcs_bucket URI starts with 'gs://' in config and dataclass validation, and add corresponding unit test coverage.

boardgame
id=ob7D1KAAAAE/9QlIqGvq7BY
@CatherineF-dev
CatherineF-dev force-pushed the feat/enable-managed-mldiagnostics-and-xprof branch from a5acce6 to 2fad782 Compare September 3, 2026 12:16
@CatherineF-dev
CatherineF-dev marked this pull request as ready for review September 3, 2026 12:18
…iagnostics flag.

Update deploy/ctk_v2/xmanager-cloud.yaml to conditionally include storage.objectCreator in node_pool_service_account project_roles only when vars.enable_managed_mldiagnostics is true.

boardgame
id=ob7D1KAAAAE/9QlIqGvq7BY
Comment thread deploy/ctk_v2/README.md Resolved
Comment thread deploy/helm/values.yaml Resolved
Comment thread tools/dev_env/config.py Resolved
Comment thread tools/dev_env/config.py Resolved
Comment thread deploy/ctk_v2/xmanager-cloud.yaml Resolved
Comment thread tools/dev_env/dev_env_test.py Resolved
Comment thread tools/dev_env/config.py Resolved
Comment thread tools/dev_env/config.py Resolved
…fig.

- tools/dev_env/config.py:
  * Normalize GCS bucket URI trailing slashes and whitespace in LocalDevConfig.__post_init__ and validate against empty bucket names.
  * Remove redundant bucket URI validation check from load_config.
  * Remove os.environ fallback lookups for enable_managed_mldiagnostics and managed_xprof_gcs_bucket in load_config (relying solely on CLI arguments and YAML configuration).
- tools/dev_env/config_test.py:
  * Add unit tests asserting negative flag resolution, YAML fallback resolution, and trailing slash normalization.
  * Add test cases for invalid bucket URIs (e.g., empty bucket names and invalid prefixes).
- tools/dev_env/dev_env_test.py:
  * Add unit tests verifying --enable-managed-mldiagnostics, --no-enable-managed-mldiagnostics, and --managed-xprof-gcs-bucket parsing.
- deploy/helm/values.yaml:
  * Remove unused mldiagnostics.enabled configuration.
- deploy/ctk_v2/xmanager-cloud.yaml:
  * Remove unused mldiagnostics.enabled Helm value forwarding.
  * Add descriptive comment for enable_managed_mldiagnostics and align ordering with xmc-deployment-template.yaml.
- deploy/ctk_v2/README.md:
  * Clarify that enable_managed_mldiagnostics and managed_xprof_gcs_bucket should be configured in the deployment blueprint YAML file for gke-deploy.

boardgame
id=ob7D1KAAAAE/JM67h7P7Wjg
…tants.

Restore environment variable fallbacks for enable_managed_mldiagnostics and
managed_xprof_gcs_bucket in load_config, using top-of-file constants
ENABLE_MANAGED_MLDIAGNOSTICS_ENV and MANAGED_XPROF_GCS_BUCKET_ENV per AntonTyb review.

boardgame
id=ob7D1KAAAAE/JM67h7P7Wjg
…commands and config resolution.

- tools/dev_env/dev_env_test.py:
  * Add test_gke_deploy_negative_managed_mldiagnostics verifying --no-enable-managed-mldiagnostics in gke-deploy.
  * Add test_gke_upgrade_negative_managed_mldiagnostics verifying --no-enable-managed-mldiagnostics in gke-upgrade.
- tools/dev_env/config_test.py:
  * Add test asserting that passing enable_managed_mldiagnostics=False overrides both active environment variable and YAML configurations.

boardgame
id=ob7D1KAAAAE/JM67h7P7Wjg
Resolve conflict in tools/dev_env/config_test.py by preserving both ingestion
gateway override test and mldiagnostics test cases.

boardgame
id=ob7D1KAAAAE/JM67h7P7Wjg
Collapse multi-line parser.parse_args call in test_parser_mldiagnostics_feature_flags
to pass ruff formatting check.

boardgame
id=ob7D1KAAAAE/JM67h7P7Wjg

@VLukiantsev VLukiantsev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM! All review comments have been cleanly addressed, unit tests and linters pass, and the blueprint changes maintain full backward compatibility.

VLukiantsev
VLukiantsev previously approved these changes Sep 7, 2026
AntonTyb
AntonTyb previously approved these changes Sep 8, 2026
…ldiagnostics-and-xprof

# Conflicts:
#	deploy/ctk_v2/xmanager-cloud.yaml
@CatherineF-dev
CatherineF-dev added this pull request to the merge queue Sep 8, 2026
@CatherineF-dev
CatherineF-dev removed this pull request from the merge queue due to a manual request Sep 8, 2026
@CatherineF-dev
CatherineF-dev added this pull request to the merge queue Sep 8, 2026
Merged via the queue into main with commit 7ac4b85 Sep 8, 2026
17 of 22 checks passed
@CatherineF-dev
CatherineF-dev deleted the feat/enable-managed-mldiagnostics-and-xprof branch September 8, 2026 09:17
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.

3 participants