Commit 616d9298 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #38702 from jsafrane/gce-provisioning-existing

Automatic merge from submit-queue (batch tested with PRs 38702, 41810, 41778, 41858, 41872) gce: Reuse unsuccessfully provisioned volumes. GCE PD names generated by Kubernetes are guaranteed to be unique - they contain name of the cluster and UID of the PVC that is behind it. Presence of a GCE PD that has the same name as we want to provision indicates that previous provisioning did not go well and most probably the controller manager process was restarted in the meantime. Kubernetes should reuse this volume and not provision a new one. Fixes #38681
parents bb7cc740 ba6ab902
...@@ -2484,7 +2484,12 @@ func (gce *GCECloud) CreateDisk(name string, diskType string, zone string, sizeG ...@@ -2484,7 +2484,12 @@ func (gce *GCECloud) CreateDisk(name string, diskType string, zone string, sizeG
return err return err
} }
return gce.waitForZoneOp(createOp, zone) err = gce.waitForZoneOp(createOp, zone)
if isGCEError(err, "alreadyExists") {
glog.Warningf("GCE PD %q already exists, reusing", name)
return nil
}
return err
} }
func (gce *GCECloud) doDeleteDisk(diskToDelete string) error { func (gce *GCECloud) doDeleteDisk(diskToDelete string) error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment