-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Help validating ArgoCD ApplicationSet - "could not find schema" error #143
Comments
I don't know why you're not able to convert the swagger file into JsonSchmeas that can be parsed by kubeconform, but if you want to validate your ArgoCD resources, you can use kubeconform + CRDs-catalog repo: kubeconform --output json --summary --schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' k8s-demo.yaml This will generate the error that you expected: {
"resources": [
{
"filename": "k8s-demo.yaml",
"kind": "ApplicationSet",
"name": "example",
"version": "argoproj.io/v1alpha1",
"status": "statusInvalid",
"msg": "For field spec.generators.1.clusters.selector.matchExpressions: Invalid type. Expected: array, given: object - For field spec.template.spec: destination is required"
}
],
"summary": {
"valid": 0,
"invalid": 1,
"errors": 0,
"skipped": 0
}
} |
Thank you, that's helpful!
I'm not sure I follow - I used openapi2jsonschema to convert the swagger.json file into a bunch of subcomponents:
And then uploaded these to a public Github repo. https://github.com/kevinburkesegment/argocd-schemas/ But maybe you are saying, you're not sure why the tool did not generate complete files. |
yes, I'm not familiar enough with this script to help you debug why the conversion didn't work. |
Hi @kevinburkesegment - I'm not too sure either tbh. I would recommend using Datree's CRDs - otherwise, I am considering retiring the Python converter in favor of this other tool #182 maybe you could give this one a shot! |
I'm trying to validate that the ApplicationSet files I am writing are valid. A CRD exists here, that in theory, I can validate against: https://github.com/argoproj/argo-cd/blob/master/manifests/crds/applicationset-crd.yaml
This gets aggregated into one large
swagger.json
file here: https://github.com/argoproj/argo-cd/blob/master/assets/swagger.jsonI used
openapi2jsonschema
to convert theswagger.json
file into a bunch of subcomponents:I then uploaded these to a public Github repo. https://github.com/kevinburkesegment/argocd-schemas/
I'm now trying to validate my config file using these. Here is my (abbreviated for space) config file:
myfile.yaml
I expect this to fail because
matchExpressions
is supposed to accept a list, not an object.I'm running e.g. (and to reproduce note you will need to use strict mode)
I get the following output:
I'm confused about this because I see the
applicationset
is being loaded in the log output. Maybe the tool is not able to find_definitions.json
? But I see_definitions.json
in https://github.com/instrumenta/kubernetes-json-schema so I know that it must be able to be loaded somehow.If I try to read the
assets/swagger.json
file directly, validation succeeds, but"resources"
in the output is an empty list, and also, I expect this to fail due to thematchExpressions
problem.Thanks very much for your help, I've been banging my head up against this and appreciate any tips you might have.
The text was updated successfully, but these errors were encountered: