Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a problem, when there are multiple running operations in GKE #32308

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions kubetest/gke.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,15 +946,15 @@ func (g *gkeDeployer) Down() error {
return fmt.Errorf("failed to list clusters in project %s with filter (name=%s AND location=%s): %w", g.project, g.cluster, g.locationRaw, err)
}

operationNameBytes, err := control.Output(exec.Command(
operationNamesBytes, err := control.Output(exec.Command(
"gcloud", g.containerArgs("operations", "list", "--project="+g.project,
g.location, "--format=value(name)", fmt.Sprintf("--filter=(status!=DONE AND (targetLink ~ /clusters/%s$ OR targetLink ~ /clusters/%s/))", g.cluster, g.cluster))...))
if err != nil {
return fmt.Errorf("failed to list not DONE operations for cluster %s: %w", g.cluster, err)
}

operationName := strings.TrimSpace(string(operationNameBytes))
if operationName != "" {
operationNames := strings.Split(strings.TrimSpace(string(operationNamesBytes)), "\n")
for _, operationName := range operationNames {
log.Printf("Found RUNNING operation %q blocking cluster deletion. Will wait for its completion.", operationName)
err := control.FinishRunning(exec.Command(
"gcloud", g.containerArgs("operations", "wait", "--project="+g.project,
Expand Down