-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Improve consistency of command functions #1124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,6 @@ import ( | |
| api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5" | ||
| "github.com/weaveworks/eksctl/pkg/authconfigmap" | ||
| "github.com/weaveworks/eksctl/pkg/ctl/cmdutils" | ||
| "github.com/weaveworks/eksctl/pkg/eks" | ||
| "github.com/weaveworks/eksctl/pkg/kops" | ||
| "github.com/weaveworks/eksctl/pkg/printers" | ||
| "github.com/weaveworks/eksctl/pkg/utils" | ||
|
|
@@ -97,21 +96,11 @@ func doCreateCluster(rc *cmdutils.ResourceCmd, params *createClusterCmdParams) e | |
| cfg := rc.ClusterConfig | ||
| meta := rc.ClusterConfig.Metadata | ||
|
|
||
| api.SetClusterConfigDefaults(cfg) | ||
|
|
||
| if err := api.ValidateClusterConfig(cfg); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| if err := ngFilter.ValidateNodeGroupsAndSetDefaults(cfg.NodeGroups); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| printer := printers.NewJSONPrinter() | ||
| ctl := eks.New(rc.ProviderConfig, cfg) | ||
|
|
||
| if !ctl.IsSupportedRegion() { | ||
| return cmdutils.ErrUnsupportedRegion(rc.ProviderConfig) | ||
| ctl, err := rc.NewCtl() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we pass a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, but let's make that change separately. I'm just trying to take care of consistency here. I think that change will be easier to make now. Actually, we could just make it happen inside of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to do it later in a separate PR. |
||
| if err != nil { | ||
| return err | ||
| } | ||
| logger.Info("using region %s", meta.Region) | ||
|
|
||
|
|
@@ -241,7 +230,7 @@ func doCreateCluster(rc *cmdutils.ResourceCmd, params *createClusterCmdParams) e | |
| return err | ||
| } | ||
|
|
||
| err := ngFilter.ForEach(cfg.NodeGroups, func(_ int, ng *api.NodeGroup) error { | ||
| err = ngFilter.ForEach(cfg.NodeGroups, func(_ int, ng *api.NodeGroup) error { | ||
| // resolve AMI | ||
| if err := ctl.EnsureAMI(meta.Version, ng); err != nil { | ||
| return err | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But let's leave until next iteration, I also have a PR to rename
rcto simplycmd, which I promised to Martina a long time ago.