Spec validation option (#1865)
Co-authored-by: Rahul Bhati <rjbhati009@gmail.com> Co-authored-by: Vishal <vishal-biyani@users.noreply.github.com>
This commit is contained in:
co-authored by
Rahul Bhati
Vishal
parent
f28799cc4c
commit
6f9bad3d05
@@ -70,6 +70,7 @@ func (opts *ApplySubCommand) run(input cli.Input) error {
|
||||
deleteResources := input.Bool(flagkey.SpecDelete)
|
||||
watchResources := input.Bool(flagkey.SpecWatch)
|
||||
waitForBuild := input.Bool(flagkey.SpecWait)
|
||||
validateSpecs := util.GetValidationFlag(input)
|
||||
|
||||
var watcher *fsnotify.Watcher
|
||||
var pbw *packageBuildWatcher
|
||||
@@ -115,9 +116,11 @@ func (opts *ApplySubCommand) run(input cli.Input) error {
|
||||
return errors.Wrap(err, "error reading specs")
|
||||
}
|
||||
|
||||
err = Validate(input)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "abort applying resources")
|
||||
if validateSpecs {
|
||||
err = Validate(input)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "abort applying resources")
|
||||
}
|
||||
}
|
||||
|
||||
// make changes to the cluster based on the specs
|
||||
|
||||
@@ -48,7 +48,7 @@ func Commands() *cobra.Command {
|
||||
RunE: wrapper.Wrapper(Apply),
|
||||
}
|
||||
wrapper.SetFlags(applyCmd, flag.FlagSet{
|
||||
Optional: []flag.Flag{flag.SpecDir, flag.SpecDelete, flag.SpecWait, flag.SpecWatch},
|
||||
Optional: []flag.Flag{flag.SpecDir, flag.SpecDelete, flag.SpecWait, flag.SpecWatch, flag.SpecValidation},
|
||||
})
|
||||
|
||||
destroyCmd := &cobra.Command{
|
||||
|
||||
Reference in New Issue
Block a user