From ba1e176d64981cfd39f03ba72e2545a6833045d0 Mon Sep 17 00:00:00 2001 From: Eirik Nygaard Date: Wed, 8 Nov 2023 14:53:41 +0100 Subject: Require a minimum amount of nodes when creating deployment.xml --- client/go/internal/cli/cmd/prod.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'client/go/internal') diff --git a/client/go/internal/cli/cmd/prod.go b/client/go/internal/cli/cmd/prod.go index 3ff46768e0c..496d1f27e3b 100644 --- a/client/go/internal/cli/cmd/prod.go +++ b/client/go/internal/cli/cmd/prod.go @@ -313,7 +313,10 @@ func promptNodeCount(cli *CLI, stdin *bufio.Reader, clusterID string, nodeCount fmt.Fprintf(cli.Stdout, "Documentation: %s\n", color.GreenString("https://cloud.vespa.ai/en/reference/services")) fmt.Fprintf(cli.Stdout, "Example: %s\nExample: %s\n\n", color.YellowString("4"), color.YellowString("[2,8]")) validator := func(input string) error { - _, _, err := xml.ParseNodeCount(input) + min, _, err := xml.ParseNodeCount(input) + if min < 2 { + return fmt.Errorf("at least 2 nodes are required for all clusters in a production environment") + } return err } return prompt(cli, stdin, fmt.Sprintf("How many nodes should the %s cluster have?", color.CyanString(clusterID)), nodeCount, validator) -- cgit v1.2.3