Skip to content

Commit

Permalink
kubecdl: use label filter to find the exact cluster
Browse files Browse the repository at this point in the history
According to https://cloud.google.com/sdk/gcloud/reference/topic/filters#Operator-Terms
The operators `=` and `:` are deprecated.
If we want to test equality, we should use `key <= value AND key >= value`.

Signed-off-by: JenTing Hsiao <[email protected]>
  • Loading branch information
jenting authored and roboquat committed Nov 2, 2022
1 parent e24616b commit 546df5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dev/kubecdl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func getNodeName(clusterName, project string) (nodeName, zone string, err error)
Zone string `json:"zone"`
}

out, err := exec.Command("gcloud", "compute", "instances", "list", "--format=json", "--quiet", "--project", project, "--filter=name~server-ws-.*"+clusterName).CombinedOutput()
out, err := exec.Command("gcloud", "compute", "instances", "list", "--format=json", "--quiet", "--project", project, "--filter", "labels.cluster-name>=ws-"+clusterName+" AND labels.cluster-name<=ws-"+clusterName).CombinedOutput()
if err != nil {
return "", "", fmt.Errorf("failed to describe node instances: %s: %w", string(out), err)
}
Expand Down

0 comments on commit 546df5c

Please sign in to comment.