mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-13 23:17:02 +00:00
Do not validate when no schema given
This commit is contained in:
parent
e1deb174a6
commit
9ee3c5f07f
1 changed files with 5 additions and 5 deletions
|
|
@ -55,18 +55,17 @@ func ValidateResources(resources <-chan []resource.Resource, validationResults c
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
ok := false
|
cached := false
|
||||||
var schema *gojsonschema.Schema
|
var schema *gojsonschema.Schema
|
||||||
cacheKey := ""
|
cacheKey := ""
|
||||||
|
|
||||||
if c != nil {
|
if c != nil {
|
||||||
cacheKey = cache.Key(sig.Kind, sig.Version, k8sVersion)
|
cacheKey = cache.Key(sig.Kind, sig.Version, k8sVersion)
|
||||||
schema, ok = c.Get(cacheKey)
|
schema, cached = c.Get(cacheKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ok {
|
if !cached {
|
||||||
schema, err = downloadSchema(regs, sig.Kind, sig.Version, k8sVersion)
|
if schema, err = downloadSchema(regs, sig.Kind, sig.Version, k8sVersion); err != nil {
|
||||||
if err != nil {
|
|
||||||
validationResults <- validator.Result{Resource: res, Err: err, Status: validator.Error}
|
validationResults <- validator.Result{Resource: res, Err: err, Status: validator.Error}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
@ -82,6 +81,7 @@ func ValidateResources(resources <-chan []resource.Resource, validationResults c
|
||||||
} else {
|
} else {
|
||||||
validationResults <- validator.Result{Resource: res, Err: fmt.Errorf("could not find schema for %s", sig.Kind), Status: validator.Error}
|
validationResults <- validator.Result{Resource: res, Err: fmt.Errorf("could not find schema for %s", sig.Kind), Status: validator.Error}
|
||||||
}
|
}
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
validationResults <- validator.Validate(res, schema)
|
validationResults <- validator.Validate(res, schema)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue