Default to non-strict

This commit is contained in:
Yann Hamon 2020-05-31 04:36:29 +02:00
parent 1f176b8255
commit c6526d7278
4 changed files with 6 additions and 4 deletions

View file

@ -19,6 +19,8 @@ Usage of ./bin/kubeconform:
output format - text, json (default "text") output format - text, json (default "text")
-printsummary -printsummary
print a summary at the end print a summary at the end
-quiet
quiet output - only print invalid files, and errors
-schema value -schema value
file containing an additional Schema (can be specified multiple times) file containing an additional Schema (can be specified multiple times)
-skipKinds string -skipKinds string

View file

@ -97,12 +97,12 @@ func realMain() int {
var nWorkers int var nWorkers int
var quiet bool var quiet bool
flag.BoolVar(&printSummary, "printsummary", false, "print a summary at the end") flag.StringVar(&k8sVersion, "k8sversion", "1.18.0", "version of Kubernetes to test against")
flag.Var(&files, "file", "file to validate (can be specified multiple times)") flag.Var(&files, "file", "file to validate (can be specified multiple times)")
flag.Var(&dirs, "dir", "directory to validate (can be specified multiple times)") flag.Var(&dirs, "dir", "directory to validate (can be specified multiple times)")
flag.Var(&schemas, "schema", "file containing an additional Schema (can be specified multiple times)") flag.Var(&schemas, "schema", "file containing an additional Schema (can be specified multiple times)")
flag.BoolVar(&printSummary, "printsummary", false, "print a summary at the end")
flag.IntVar(&nWorkers, "workers", 4, "number of routines to run in parallel") flag.IntVar(&nWorkers, "workers", 4, "number of routines to run in parallel")
flag.StringVar(&k8sVersion, "k8sversion", "1.18.0", "version of Kubernetes to test against")
flag.StringVar(&skipKinds, "skipKinds", "", "comma-separated list of kinds to ignore") flag.StringVar(&skipKinds, "skipKinds", "", "comma-separated list of kinds to ignore")
flag.BoolVar(&strict, "strict", false, "activate strict mode") flag.BoolVar(&strict, "strict", false, "activate strict mode")
flag.StringVar(&outputFormat, "output", "text", "output format - text, json") flag.StringVar(&outputFormat, "output", "text", "output format - text, json")

View file

@ -35,7 +35,7 @@ func (o *TextOutput) Write(filename string, err error, skipped bool) {
} }
o.nValid++ o.nValid++
case s == INVALID: case s == INVALID:
fmt.Printf("%s - invalid resource: %s\n",filename, err) fmt.Printf("%s - invalid resource: %s\n", filename, err)
o.nInvalid++ o.nInvalid++
case s == ERROR: case s == ERROR:
fmt.Printf("%s - failed validating resource: %s\n", filename, err) fmt.Printf("%s - failed validating resource: %s\n", filename, err)

View file

@ -51,7 +51,7 @@ func Validate(rawResource []byte, schema *gojsonschema.Schema) error {
if msg != "" { if msg != "" {
msg += " - " msg += " - "
} }
msg += errMsg.Description() msg += errMsg.Description()
} }
return InvalidResourceError{err: msg} return InvalidResourceError{err: msg}
} }