-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make kubeval hermetic * use json parser * openapi2jsonschema should handle strict * rebase on new fork openapi2jsonschema
- Loading branch information
Mengqi Yu
authored
Apr 23, 2021
1 parent
23d47ca
commit 6bb4c43
Showing
9 changed files
with
96,036 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
# Kubeval | ||
# kubeval: simple example | ||
|
||
The `kubeval` KRM config function validates Kubernetes resources using kubeval. | ||
Learn more on the [kubeval website]. | ||
|
||
This example invokes the kubeval function against Kubernetes v1.18.0. | ||
This example invokes the kubeval function against the builtin Kubernetes | ||
v1.19.8 schema. | ||
|
||
## Function invocation | ||
|
||
Get this example and try it out by running the following commands: | ||
|
||
<!-- TODO: no --network. See: https://github.com/GoogleContainerTools/kpt/issues/1621 --> | ||
|
||
```sh | ||
kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/kubeval . | ||
kpt fn run kubeval --network | ||
kpt fn run kubeval | ||
``` | ||
|
||
## Expected Results | ||
|
||
This should give the following output: | ||
|
||
```sh | ||
[ERROR] Invalid type. Expected: [integer,null], given: string in object 'v1/ReplicationController//bob' in file example-config.yaml in field spec.replicas | ||
[ERROR] Additional property templates is not allowed in object 'v1/ReplicationController//bob' in file resources.yaml in field templates | ||
[ERROR] Invalid type. Expected: [integer,null], given: string in object 'v1/ReplicationController//bob' in file resources.yaml in field spec.replicas | ||
error: exit status 1 | ||
``` | ||
|
||
In the `example-config.yaml` file, replace the value of `spec.replicas` | ||
with an integer to pass validation and rerun the command. This will return | ||
success (no output). | ||
There are validation error in the `resources.yaml` file, to fix them: | ||
- replace the value of `spec.replicas` with an integer | ||
- change `templates` to `template` | ||
|
||
Rerun the command, and it will return success (no output). | ||
|
||
[kubeval website]: https://www.kubeval.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.