Repository navigation
fix(macrobenchmarks): retry GKE control plane in other zones on stockout - #1132
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements a zone fallback mechanism for GKE control plane creation to mitigate capacity errors (such as GCE_STOCKOUT) during macrobenchmarks. It introduces configuration variables for fallback zones, retry rounds, and delays, and updates GKE interaction scripts to dynamically use the determined cluster location while keeping the workload node pool pinned to the primary zone. The review feedback highlights two important improvements in create_cluster.sh: preventing premature script termination under pipefail by executing the gcloud pipeline directly within the if condition, and ensuring the temporary log file is cleaned up when exiting early on non-retryable errors.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1132 +/- ##
=======================================
Coverage 92.17% 92.17%
=======================================
Files 20 20
Lines 4011 4011
=======================================
Hits 3697 3697
Misses 314 314 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Cluster creation can fail with GCE_STOCKOUT when GKE cannot provision the control plane of a zonal cluster in _ZONE, even though the workload node pool itself is not the constrained resource. create_cluster.sh now tries the control plane in _ZONE first and then in the region's other zones, deleting the failed cluster before the next try. The _MACHINE_TYPE node pool stays pinned to _ZONE via --node-locations, so node placement and zonal-bucket co-location are unchanged. The chosen zone is saved as CLUSTER_LOCATION and used by the later steps.
efc2d64 to
d1e452c
Compare
zhixiangli
left a comment
There was a problem hiding this comment.
Thanks! I verified the approach on real GKE: with the control plane in us-central1-c and the pool created with --node-locations=us-central1-a, the workload node came up Ready in us-central1-a. The fallback loop also behaves correctly in stubbed tests, and create-cluster is recorded exactly once on full failure.
Two cleanup gaps are worth fixing before merge (inline on cleanup_cluster.sh). The rest are small.
Tests: could you commit the stubbed-gcloud tests from the description, e.g. cloudbuild/macrobenchmarks/metrics/tests/test_create_cluster.py? CI already runs that directory, and lib.sh lets tests override FAILED_FILE/BUILD_VARS_FILE. Cases worth locking in:
- success in
_ZONE; - fallback, with
--zone=<fallback> --node-locations=<_ZONE>; - all zones fail, with
create-clusterrecorded once; zones listfails, so only_ZONEis tried;- if the cleanup suggestion is adopted, cleanup finding a cluster in a fallback zone.
Docs (nit): README.md (the _ZONE row and the create-cluster row) and macrobenchmarks_schema.json (zone) still say _ZONE is the cluster's zone. Suggest: "zone for the workload node pool and zonal buckets; preferred zone for the control plane (may fall back within the region)". Anyone running get-credentials --zone=<_ZONE> with _SKIP_CLEANUP=true won't find a cluster that fell back to another zone.
…ests - cleanup-cluster looks the cluster up by name and deletes it in every location found, skipping when none exists (avoids ~10 min of retries on a 404 and covers a leftover cluster from a failed fallback attempt). - Log each zone attempt, the fallback, and the chosen zone. - Move the node-pool comment next to NODE_POOL_ARGS. - Document that _ZONE is the preferred control-plane zone. - Add stubbed-gcloud tests for create-cluster fallback and cleanup.
|
Added |
Problem
Macrobenchmark builds intermittently fail in
create-clusterwith:The failure happens in
gcloud container clusters create, before the workload node pool is created: GKE can't provision the control plane of the zonal cluster in_ZONE. These stockouts are intermittent and zone-specific, so the workload node pool isn't the constrained resource.A regional cluster doesn't help: per the GKE docs, regional cluster creation fails if VMs can't be created in any one of its zones.
Fix
create_cluster.sh: try the control plane in_ZONE, then the region's other zones; delete a failed cluster before the next try. The_MACHINE_TYPEpool stays pinned to_ZONE(--node-locations), so node placement and zonal-bucket co-location don't change. The chosen zone is saved asCLUSTER_LOCATION.seed_checkpoint.sh,run_workload.sh,cleanup_helm.sh,cleanup_cluster.sh: use${CLUSTER_LOCATION:-${_ZONE}}(one line each).No new substitutions; existing configurations need no changes.
Testing
gcloud, covering:_ZONE;_ZONE;create-clusteras failed;_ZONEis tried._ZONE: all steps succeeded, the workload nodes ran in_ZONE, cleanup deleted the cluster, and benchmark metrics were in line with regular runs.