mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-21 19:07:00 +00:00
update README, add warning if no registry defined
This commit is contained in:
parent
4ed2c0af60
commit
a8e3cf11c9
3 changed files with 11 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
||||||
dist/
|
dist/
|
||||||
|
bin/
|
||||||
|
|
|
||||||
10
Readme.md
10
Readme.md
|
|
@ -37,12 +37,12 @@ Usage of ./bin/kubeconform:
|
||||||
skip files with missing schemas instead of failing
|
skip files with missing schemas instead of failing
|
||||||
-k8sversion string
|
-k8sversion string
|
||||||
version of Kubernetes to test against (default "1.18.0")
|
version of Kubernetes to test against (default "1.18.0")
|
||||||
-local-registry value
|
|
||||||
folder containing additional schemas (can be specified multiple times)
|
|
||||||
-n int
|
-n int
|
||||||
number of routines to run in parallel (default 4)
|
number of routines to run in parallel (default 4)
|
||||||
-output string
|
-output string
|
||||||
output format - text, json (default "text")
|
output format - text, json (default "text")
|
||||||
|
-registry value
|
||||||
|
filepath template for registry
|
||||||
-skip string
|
-skip string
|
||||||
comma-separated list of kinds to ignore
|
comma-separated list of kinds to ignore
|
||||||
-strict
|
-strict
|
||||||
|
|
@ -57,14 +57,14 @@ Usage of ./bin/kubeconform:
|
||||||
|
|
||||||
* Validating a single, valid file
|
* Validating a single, valid file
|
||||||
```
|
```
|
||||||
$ ./bin/kubeconform fixtures/valid.yaml
|
$ ./bin/kubeconform -registry kubernetesjsonschema.dev fixtures/valid.yaml
|
||||||
$ echo $?
|
$ echo $?
|
||||||
0
|
0
|
||||||
```
|
```
|
||||||
|
|
||||||
* Validating a single invalid file, setting output to json, and printing a summary
|
* Validating a single invalid file, setting output to json, and printing a summary
|
||||||
```
|
```
|
||||||
$ ./bin/kubeconform -summary -output json fixtures/invalid.yaml
|
$ ./bin/kubeconform -registry kubernetesjsonschema.dev -summary -output json fixtures/invalid.yaml
|
||||||
{
|
{
|
||||||
"resources": [
|
"resources": [
|
||||||
{
|
{
|
||||||
|
|
@ -88,7 +88,7 @@ $ echo $?
|
||||||
|
|
||||||
* Validating a folder, increasing the number of parallel workers
|
* Validating a folder, increasing the number of parallel workers
|
||||||
```
|
```
|
||||||
$ ./bin/kubeconform -summary -n 16 fixtures
|
$ ./bin/kubeconform -summary -registry kubernetesjsonschema.dev -n 16 fixtures
|
||||||
fixtures/multi_invalid.yaml - Service is invalid: Invalid type. Expected: integer, given: string
|
fixtures/multi_invalid.yaml - Service is invalid: Invalid type. Expected: integer, given: string
|
||||||
fixtures/invalid.yaml - ReplicationController is invalid: Invalid type. Expected: [integer,null], given: string
|
fixtures/invalid.yaml - ReplicationController is invalid: Invalid type. Expected: [integer,null], given: string
|
||||||
[...]
|
[...]
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,11 @@ func realMain() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
registries := []registry.Registry{}
|
registries := []registry.Registry{}
|
||||||
|
if len(regs) == 0 {
|
||||||
|
fmt.Println("At least one registry needs to be set - add -registry kubernetesjsonschema.dev ?")
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
for _, reg := range regs {
|
for _, reg := range regs {
|
||||||
if reg == "kubernetesjsonschema.dev" {
|
if reg == "kubernetesjsonschema.dev" {
|
||||||
registries = append(registries, registry.NewHTTPRegistry("https://kubernetesjsonschema.dev/{{ .NormalizedVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json", strict))
|
registries = append(registries, registry.NewHTTPRegistry("https://kubernetesjsonschema.dev/{{ .NormalizedVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json", strict))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue