Skip to content

Commit

Permalink
fix(k3d): add master count check
Browse files Browse the repository at this point in the history
  • Loading branch information
rancher-sy-bot authored and Jason-ZW committed May 21, 2021
1 parent 106b596 commit 52ad326
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/providers/k3d/k3d.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ func (p *K3d) SetConfig(config []byte) error {
}

func (p *K3d) CreateCheck() error {
masterNum, err := strconv.Atoi(p.Master)
if masterNum < 1 || err != nil {
return fmt.Errorf("[%s] calling preflight error: `--master` number must >= 1",
p.GetProviderName())
}

exist, _, err := p.IsClusterExist()
if err != nil && !errors.Is(err, client.ClusterGetNoNodesFoundError) {
return err
Expand Down

0 comments on commit 52ad326

Please sign in to comment.