mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
updated readme
This commit is contained in:
parent
ccfd4adad3
commit
d9c3a166cc
3 changed files with 11 additions and 2 deletions
|
@ -61,6 +61,12 @@ Example:
|
|||
kyverno validate /path/to/policy1.yaml /path/to/policy2.yaml /path/to/folderFullOfPolicies -o yaml
|
||||
```
|
||||
|
||||
Policy can also be validated with CRDs. Use -c flag to pass the CRD, can pass multiple CRD files or even an entire folder containin CRDs.
|
||||
|
||||
Example:
|
||||
```
|
||||
kyverno validate /path/to/policy1.yaml -c /path/to/crd.yaml -c /path/to/folderFullOfCRDs
|
||||
```
|
||||
|
||||
#### Apply
|
||||
Applies policies on resources, and supports applying multiple policies on multiple resources in a single command.
|
||||
|
|
|
@ -7,13 +7,14 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
yaml_v2 "sigs.k8s.io/yaml"
|
||||
"strings"
|
||||
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
yaml_v2 "sigs.k8s.io/yaml"
|
||||
|
||||
jsonpatch "github.com/evanphx/json-patch"
|
||||
"github.com/go-logr/logr"
|
||||
v1 "github.com/nirmata/kyverno/pkg/api/kyverno/v1"
|
||||
|
@ -249,6 +250,7 @@ func GetCRDs(paths []string) (unstructuredCrds []*unstructured.Unstructured, err
|
|||
getCRDs, err := GetCRD(path)
|
||||
if err != nil {
|
||||
fmt.Printf("failed to extract crds: %s\n", err)
|
||||
os.Exit(2)
|
||||
}
|
||||
unstructuredCrds = append(unstructuredCrds, getCRDs...)
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ func Command() *cobra.Command {
|
|||
|
||||
if err != nil {
|
||||
log.Error(err, "crd is invalid", "file", crdPaths)
|
||||
os.Exit(1)
|
||||
}
|
||||
for _, crd := range crds {
|
||||
openAPIController.ParseCRD(*crd)
|
||||
|
|
Loading…
Reference in a new issue