Skip to content

Commit

Permalink
update doc for CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
realshuting committed Jun 12, 2019
1 parent 3740160 commit ec41030
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions documentation/testing-policies.md
Expand Up @@ -49,14 +49,22 @@ go get -u https://github.com/nirmata/kyverno/cmd/kyverno

### Using the CLI

The CLI loads default kubeconfig ($HOME/.kube/config) to test policies in Kubernetes cluster. If no kubeconfig is found, the CLI will test policies on raw resources.

To test a policy using the CLI type:

`kyverno <policy> <resource YAML file or folder>`
`kyverno apply @<policy> @<resource YAML file or folder>`

For example:

```bash
kyverno ../../examples/cli/policy-deployment.yaml ../../examples/cli/resources
kyverno apply @../../examples/cli/policy-deployment.yaml @../../examples/cli/resources
```

To test a policy with the specific kubeconfig:

```bash
kyverno apply @../../examples/cli/policy-deployment.yaml @../../examples/cli/resources --kubeconfig $PATH_TO_KUBECONFIG_FILE
```

In future releases, the CLI will support complete validation of policies and will allow testing policies against resources in Kubernetes clusters.
In future releases, the CLI will support complete validation and generation of policies.

0 comments on commit ec41030

Please sign in to comment.