mirror of https://github.com/kubernetes/kops.git
Add no edit flag so create instancegroup command is usable on scripts
This commit is contained in:
parent
dac6813ab1
commit
e4afcd8869
|
@ -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
|
||||||
|
// Do not launch editor when creating an instance group
|
||||||
|
NoEditor bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -96,6 +98,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.NoEditor, "no-editor", options.NoEditor, "If true, The instance group will be created by default with no option of editing it")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
@ -179,6 +182,7 @@ func RunCreateInstanceGroup(f *util.Factory, cmd *cobra.Command, args []string,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !options.NoEditor {
|
||||||
var (
|
var (
|
||||||
edit = editor.NewDefaultEditor(editorEnvs)
|
edit = editor.NewDefaultEditor(editorEnvs)
|
||||||
)
|
)
|
||||||
|
@ -214,7 +218,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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue