mirror of
https://github.com/yannh/kubeconform.git
synced 2026-04-11 15:34:17 +00:00
tap plan can be at the end, that way we can stream the output and not buffer
This commit is contained in:
parent
706488cafb
commit
07dec90112
4 changed files with 107 additions and 37 deletions
|
|
@ -114,11 +114,19 @@ func (val *v) ValidateResource(res resource.Resource) Result {
|
|||
return Result{Resource: res, Status: Error, Err: fmt.Errorf("error unmarshalling resource: %s", err)}
|
||||
}
|
||||
|
||||
if r == nil { // Resource is empty
|
||||
return Result{Resource: res, Err: nil, Status: Empty}
|
||||
}
|
||||
|
||||
sig, err := res.SignatureFromMap(r)
|
||||
if err != nil {
|
||||
return Result{Resource: res, Err: fmt.Errorf("error while parsing: %s", err), Status: Error}
|
||||
}
|
||||
|
||||
if sig.Kind == "" { // Resource contains key/values but no Kind
|
||||
return Result{Resource: res, Err: fmt.Errorf("resource missing a Kind"), Status: Error}
|
||||
}
|
||||
|
||||
if skip(*sig) {
|
||||
return Result{Resource: res, Err: nil, Status: Skipped}
|
||||
}
|
||||
|
|
@ -127,14 +135,6 @@ func (val *v) ValidateResource(res resource.Resource) Result {
|
|||
return Result{Resource: res, Err: fmt.Errorf("prohibited resource kind %s", sig.Kind), Status: Error}
|
||||
}
|
||||
|
||||
if r == nil { // Resource is empty
|
||||
return Result{Resource: res, Err: nil, Status: Empty}
|
||||
}
|
||||
|
||||
if sig.Kind == "" && r != nil { // Resource contains key/values but no Kind
|
||||
return Result{Resource: res, Err: fmt.Errorf("resource missing a Kind"), Status: Error}
|
||||
}
|
||||
|
||||
cached := false
|
||||
var schema *gojsonschema.Schema
|
||||
cacheKey := ""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue