aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-12-12 11:22:40 +0100
committerAleksandr Nogikh <nogikh@google.com>2023-12-12 10:36:30 +0000
commitb94b2bb4b494b52831ff24952f34ac994bb2f6f4 (patch)
tree04b61782c58ca3e92fd4db93fd1e914f5946a0eb /pkg
parent28b24332d95f2f7df44ec7e7a5e0025bcadc6277 (diff)
pkg/gce: recognize more pool exhausted errors
We seem to be getting more of ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS errors rather than ZONE_RESOURCE_POOL_EXHAUSTED. Let's support both.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/gce/gce.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/gce/gce.go b/pkg/gce/gce.go
index ecc2c9853..5e45cbce2 100644
--- a/pkg/gce/gce.go
+++ b/pkg/gce/gce.go
@@ -170,7 +170,7 @@ retry:
if err != nil {
return "", fmt.Errorf("failed to create instance: %w", err)
}
- if err := ctx.waitForCompletion("zone", "create image", op.Name, false); err != nil {
+ if err := ctx.waitForCompletion("zone", "create instance", op.Name, false); err != nil {
var resourcePoolExhaustedError resourcePoolExhaustedError
if errors.As(err, &resourcePoolExhaustedError) && instance.Scheduling.Preemptible {
instance.Scheduling.Preemptible = false
@@ -318,7 +318,8 @@ func (ctx *Context) waitForCompletion(typ, desc, opName string, ignoreNotFound b
if op.Error != nil {
reason := ""
for _, operr := range op.Error.Errors {
- if operr.Code == "ZONE_RESOURCE_POOL_EXHAUSTED" {
+ if operr.Code == "ZONE_RESOURCE_POOL_EXHAUSTED" ||
+ operr.Code == "ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS" {
return resourcePoolExhaustedError(fmt.Sprintf("%+v", operr))
}
if ignoreNotFound && operr.Code == "RESOURCE_NOT_FOUND" {