Repository navigation
feat(ctk): enable managed mldiagnostics - #762
Conversation
…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
There was a problem hiding this comment.
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.
d791ef3 to
a5acce6
Compare
…-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
a5acce6 to
2fad782
Compare
…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
…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
…naged ML diagnostics
VLukiantsev
left a comment
There was a problem hiding this comment.
LGTM! All review comments have been cleanly addressed, unit tests and linters pass, and the blueprint changes maintain full backward compatibility.
…ldiagnostics-and-xprof # Conflicts: # deploy/ctk_v2/xmanager-cloud.yaml
b7255e6
#750