Skip to content

prakashrj/validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRD validation

The code here is just a wrapper around apiextensions-apiserver(crd validation). We are handling the v1beta1 version of CRDs.

How to use

go run main.go --def crddefinition.json

Or

go build .
./validation --def crddefinition.json

Testing

Try adding invalid fields based on (crd validation).

Like:

        "openAPIV3Schema": {
          "description": "PetstoreAPI is the Schema for the PetstoreAPIs API",
          "additionalProperties": "this will give error",

Ouput: detect the invalid fields

spec.validation.openAPIV3Schema.additionalProperties: Forbidden: must not be used at the root
spec.validation.openAPIV3Schema.type: Required value: must not be empty at the root
``

## Testing with craft

Firstly build the operator. Then, convert `config/crd/bases/*.yaml` in created operator to json and validate that json.

go build . ./validation --def

About

Kubernetes Structural Schema Validation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages