mirror of https://github.com/kubernetes/kops.git
Merge pull request #3787 from jchanam/master
Automatic merge from submit-queue. Add edit flag so create instancegroup command is usable on scripts Until now, the opening of an interactive editor when creating a new instance group was mandatory. This this commit, a new flag is added, so this is now optional. This commit is backwards compatible.
This commit is contained in:
commit
ad50149769
|
@ -43,6 +43,8 @@ type CreateInstanceGroupOptions struct {
|
||||||
DryRun bool
|
DryRun bool
|
||||||
// Output type during a DryRun
|
// Output type during a DryRun
|
||||||
Output string
|
Output string
|
||||||
|
// Launch editor when creating an instance group
|
||||||
|
Editor bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -69,6 +71,7 @@ var (
|
||||||
func NewCmdCreateInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command {
|
func NewCmdCreateInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command {
|
||||||
options := &CreateInstanceGroupOptions{
|
options := &CreateInstanceGroupOptions{
|
||||||
Role: string(api.InstanceGroupRoleNode),
|
Role: string(api.InstanceGroupRoleNode),
|
||||||
|
Editor: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -96,6 +99,7 @@ func NewCmdCreateInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command {
|
||||||
// DryRun mode that will print YAML or JSON
|
// DryRun mode that will print YAML or JSON
|
||||||
cmd.Flags().BoolVar(&options.DryRun, "dry-run", options.DryRun, "If true, only print the object that would be sent, without sending it. This flag can be used to create a cluster YAML or JSON manifest.")
|
cmd.Flags().BoolVar(&options.DryRun, "dry-run", options.DryRun, "If true, only print the object that would be sent, without sending it. This flag can be used to create a cluster YAML or JSON manifest.")
|
||||||
cmd.Flags().StringVarP(&options.Output, "output", "o", options.Output, "Ouput format. One of json|yaml")
|
cmd.Flags().StringVarP(&options.Output, "output", "o", options.Output, "Ouput format. One of json|yaml")
|
||||||
|
cmd.Flags().BoolVar(&options.Editor, "editor", options.Editor, "Default true. If true, an editor will be opened to edit default values.")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
@ -182,6 +186,7 @@ func RunCreateInstanceGroup(f *util.Factory, cmd *cobra.Command, args []string,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if options.Editor {
|
||||||
var (
|
var (
|
||||||
edit = editor.NewDefaultEditor(editorEnvs)
|
edit = editor.NewDefaultEditor(editorEnvs)
|
||||||
)
|
)
|
||||||
|
@ -217,7 +222,10 @@ func RunCreateInstanceGroup(f *util.Factory, cmd *cobra.Command, args []string,
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = clientset.InstanceGroupsFor(cluster).Create(group)
|
ig = group
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = clientset.InstanceGroupsFor(cluster).Create(ig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error storing InstanceGroup: %v", err)
|
return fmt.Errorf("error storing InstanceGroup: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ kops create instancegroup
|
||||||
|
|
||||||
```
|
```
|
||||||
--dry-run If true, only print the object that would be sent, without sending it. This flag can be used to create a cluster YAML or JSON manifest.
|
--dry-run If true, only print the object that would be sent, without sending it. This flag can be used to create a cluster YAML or JSON manifest.
|
||||||
|
--editor Default true. If true, an editor will be opened to edit default values. (default true)
|
||||||
-o, --output string Ouput format. One of json|yaml
|
-o, --output string Ouput format. One of json|yaml
|
||||||
--role string Type of instance group to create (Node,Master,Bastion) (default "Node")
|
--role string Type of instance group to create (Node,Master,Bastion) (default "Node")
|
||||||
--subnet stringSlice Subnets in which to create instance group
|
--subnet stringSlice Subnets in which to create instance group
|
||||||
|
|
Loading…
Reference in New Issue