-
Notifications
You must be signed in to change notification settings - Fork 360
Missing openshift api-resources #828
Comments
Thanks for clarifying @eyarz I use OpenShift 4.8 and 4.10. What do I need to do? Thanks |
You have two locations:
Both locations work with the same schema naming convention: Example (OpenShift v4.1.0): datree test [MANIFEST] --schema-location 'https://raw.githubusercontent.com/garethr/openshift-json-schema/master/v4.1.0-standalone/{{.ResourceKind}}{{.KindSuffix}}.json' Example (OpenShift v4.8.2): datree test [MANIFEST] --schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/openshift/openshift/v4.8.2-standalone/{{.ResourceKind }}{{.KindSuffix}}.json' You can also read here about how you can pull all the schemas from your cluster here: |
Thanks for pointing me into the right direction but I still get the same error about the Group schema :(
I'll try do clone the OpenShift schema and test locally |
Even this is not working, manifest is just a group, checked against the particular json schema:
Heres the manifest I want to check:
I had the thought that the managed fiels/labels may cause an issue? This is an Argo CD managed Helm Chart which injects those. But it even fails with a manual created manifest:
datree output:
|
Same issue for other OpenShift specific resources:
I'll take a look at getting those schemas for my cluster locally. |
And also same for extracted api resources as in the mentioned RedHat article, not sure if I do something wrong here. |
@dan-m8t when I'm testing your I suspect the problem is with the v4.8.2 schemas themselves. |
Sorry, was busy. Here's another OpenShift native resource which fails:
I'm glad to help, if you need something OpenShift related tell me :) |
Thank you for the help! Because I don't have access to this OpenShift cluster anymore, I don't know what went wrong when I pulled the schemas. |
I'll give that a shot and report back to you, thanks. |
No luck here, I tried to extract the schemas with both ways described in the blog post. Does not work :(. Would you like to try the route example with the schema I extracted? If so, try this:
|
Try this steps: mkdir tmp
cd tmp
wget https://github.com/openshift/api/archive/refs/heads/release-4.10.zip
unzip release-4.10.zip
wget https://raw.githubusercontent.com/yannh/kubeconform/master/scripts/openapi2jsonschema.py
mkdir schema
cd schema
# Depending on you ** might not work. In zsh it's working.
python3 ../openapi2jsonschema.py ../api-release-4.10/**/*.crd.yaml
# Output is the file to check
# cp ../../../output.yaml .
datree test --schema-location $PWD/'{{ .ResourceKind }}_{{ .ResourceAPIVersion }}.json' output.yaml |
That seems to lead me into the right direction. To get all the resources I needed to do this:
With your command it was missing for example the route schema under route/v1 Trying to validate my example Route from above this works:
I am not sure why there are missing schemas for specific OpenShift resources like Group in that OpenShift repo, maybe I'll find it somewhere. Thank you, I'll report back if I make more progress. |
@dan-m8t I created a pull request, which adds the openshift schemas for v4.11. You should be able to validate your openshift route with the following command: datree test --schema-version "1.24.6" --schema-location https://raw.githubusercontent.com/tricktron/CRDs-catalog/f-openshift-v4.11/openshift.io/v4.11/'{{ .ResourceKind }}_{{ .ResourceAPIVersion }}.json' --no-record route.yaml |
Thank you very much @tricktron - I'll give it a shot tomorrow! |
Hey,
I am playing around with datree but fail to get a working validation with specific OpenShift api resources.
I exported the resources via the crd extractor tool but datree just throws an error:
I double checked what the crd extractor extracted and the group json schema is part of it:
Is there something wrong with the schema?
Thanks
The text was updated successfully, but these errors were encountered: