Add/Disable strict mode

This commit is contained in:
Yann Hamon 2020-05-31 01:29:40 +02:00
parent 79d8ce3055
commit 224e9ca17d
2 changed files with 5 additions and 2 deletions

View file

@ -23,6 +23,8 @@ Usage of ./bin/kubeconform:
file containing an additional Schema (can be specified multiple times) file containing an additional Schema (can be specified multiple times)
-skipKinds string -skipKinds string
comma-separated list of kinds to ignore comma-separated list of kinds to ignore
-strict
activate strict mode
-workers int -workers int
number of routines to run in parallel (default 4) number of routines to run in parallel (default 4)
``` ```

View file

@ -74,7 +74,7 @@ func (i *arrayFiles) Set(value string) error {
func realMain() int { func realMain() int {
var files, dirs, schemas arrayFiles var files, dirs, schemas arrayFiles
var skipKinds, k8sVersion, outputFormat string var skipKinds, k8sVersion, outputFormat string
var printSummary bool var printSummary, strict bool
var nWorkers int var nWorkers int
flag.BoolVar(&printSummary, "printsummary", false, "print a summary at the end") flag.BoolVar(&printSummary, "printsummary", false, "print a summary at the end")
@ -84,6 +84,7 @@ func realMain() int {
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(&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.StringVar(&outputFormat, "output", "text", "output format - text, json") flag.StringVar(&outputFormat, "output", "text", "output format - text, json")
flag.Parse() flag.Parse()
@ -108,7 +109,7 @@ func realMain() int {
} }
registries := []registry.Registry{} registries := []registry.Registry{}
registries = append(registries, registry.NewKubernetesRegistry(false)) registries = append(registries, registry.NewKubernetesRegistry(strict))
if len(schemas) > 0 { if len(schemas) > 0 {
localRegistry, err := registry.NewLocalSchemas(schemas) localRegistry, err := registry.NewLocalSchemas(schemas)
if err != nil { if err != nil {