Fix cluster creation lib return not up-to-date cluster issue (#718)

This commit is contained in:
chaodaiG 2019-09-24 12:12:43 -07:00 committed by Knative Prow Robot
parent 6bc5bf74cc
commit a1b3961a1d
1 changed files with 5 additions and 4 deletions

View File

@ -290,12 +290,10 @@ func (gc *GKECluster) Acquire() error {
}
// Creating cluster only if previous step succeeded
if err == nil {
log.Printf("Creating cluster %q in %q", clusterName, clusterLoc)
log.Printf("Creating cluster %q in %q with:\n%+v", clusterName, clusterLoc, gc.Request)
op, err = gc.operations.create(*gc.Project, clusterLoc, rb)
if err == nil {
if err = gc.wait(clusterLoc, op.Name, creationTimeout); err == nil {
cluster, err = gc.operations.get(*gc.Project, clusterLoc, rb.Cluster.Name)
}
err = gc.wait(clusterLoc, op.Name, creationTimeout)
}
if err == nil { // Enable autoscaling and set limits
arb := &container.SetNodePoolAutoscalingRequest{
@ -311,6 +309,9 @@ func (gc *GKECluster) Acquire() error {
err = gc.wait(clusterLoc, op.Name, autoscalingTimeout)
}
}
if err == nil { // Get cluster at last
cluster, err = gc.operations.get(*gc.Project, clusterLoc, rb.Cluster.Name)
}
}
if err != nil {
errMsg := fmt.Sprintf("Error during cluster creation: '%v'. ", err)