mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-20 18:37:01 +00:00
Also support items elements in yaml, e.g. for kubectl get crds -o yaml
This commit is contained in:
parent
4544f45fa1
commit
9228dba915
1 changed files with 6 additions and 0 deletions
|
|
@ -113,14 +113,20 @@ for crdFile in sys.argv[1:]:
|
||||||
else:
|
else:
|
||||||
f = open(crdFile)
|
f = open(crdFile)
|
||||||
with f:
|
with f:
|
||||||
|
defs = []
|
||||||
for y in yaml.load_all(f, Loader=yaml.SafeLoader):
|
for y in yaml.load_all(f, Loader=yaml.SafeLoader):
|
||||||
if y is None:
|
if y is None:
|
||||||
continue
|
continue
|
||||||
|
if "items" in y:
|
||||||
|
defs.extend(y["items"])
|
||||||
if "kind" not in y:
|
if "kind" not in y:
|
||||||
continue
|
continue
|
||||||
if y["kind"] != "CustomResourceDefinition":
|
if y["kind"] != "CustomResourceDefinition":
|
||||||
continue
|
continue
|
||||||
|
else:
|
||||||
|
defs.append(y)
|
||||||
|
|
||||||
|
for y in defs:
|
||||||
filename_format = os.getenv("FILENAME_FORMAT", "{kind}_{version}")
|
filename_format = os.getenv("FILENAME_FORMAT", "{kind}_{version}")
|
||||||
filename = ""
|
filename = ""
|
||||||
if "spec" in y and "validation" in y["spec"] and "openAPIV3Schema" in y["spec"]["validation"]:
|
if "spec" in y and "validation" in y["spec"] and "openAPIV3Schema" in y["spec"]["validation"]:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue