| 482 | } |
| 483 | |
| 484 | func clusterSize(deploy deployer) (int, error) { |
| 485 | if err := deploy.TestSetup(); err != nil { |
| 486 | return -1, err |
| 487 | } |
| 488 | o, err := control.Output(exec.Command("kubectl", "get", "nodes", "--no-headers")) |
| 489 | if err != nil { |
| 490 | log.Printf("kubectl get nodes failed: %s\n%s", wrapError(err).Error(), string(o)) |
| 491 | return -1, err |
| 492 | } |
| 493 | stdout := strings.TrimSpace(string(o)) |
| 494 | log.Printf("Cluster nodes:\n%s", stdout) |
| 495 | return len(strings.Split(stdout, "\n")), nil |
| 496 | } |
| 497 | |
| 498 | // commandError will provide stderr output (if available) from structured |
| 499 | // exit errors |