Skip to content

Commit

Permalink
return error earlier when no nodes available (#617)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyang0 committed Oct 17, 2023
1 parent f834c87 commit 30067da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cluster/calcium/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ func (c *Calcium) doCreateWorkloads(ctx context.Context, opts *types.DeployOptio
}
}()
return c.withNodesPodLocked(ctx, opts.NodeFilter, func(ctx context.Context, nodeMap map[string]*types.Node) (err error) {
if len(nodeMap) == 0 {
return types.ErrEmptyNodeMap
}
nodenames := []string{}
nodes := []*types.Node{}
for nodename, node := range nodeMap {
Expand Down
1 change: 1 addition & 0 deletions types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ var (
ErrInvalidGitURL = errors.New("invalid git url format")
ErrInvalidVolumeBind = errors.New("invalid volume bind value")
ErrEmptyNodeName = errors.New("node name is empty")
ErrEmptyNodeMap = errors.New("node map is empty")
ErrEmptyAppName = errors.New("app name is empty")
ErrEmptyPodName = errors.New("pod name is empty")
ErrEmptyImage = errors.New("image is empty")
Expand Down

0 comments on commit 30067da

Please sign in to comment.