kubeval icon indicating copy to clipboard operation
kubeval copied to clipboard

Failed initializing schema ingress-networking-v1.json 404

Open dombisza opened this issue 3 years ago • 10 comments

hello there, i was trying to validate ingresses, but I cannot do so because the schema URL gives me 404.

linux@sdombi-vpc-bastion:~$ cat ingress2.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: minimal-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /testpath
        pathType: Prefix
        backend:
          service:
            name: test
            port:
              number: 80
linux@sdombi-vpc-bastion:~$ kubeval ingress2.yaml
ERR  - ingress2.yaml: Failed initializing schema https://kubernetesjsonschema.dev/master-standalone/ingress-networking-v1.json: Could not read schema from HTTP, response status is 404 Not Found
linux@sdombi-vpc-bastion:~$ kubeval --version
Version: 0.16.1
Commit: f5dba6b486fa18b9179b91e15eb6f2b0f7a5a69e
Date: 2021-03-30T15:17:06Z

Am i doing something wrong here? Thanks for the help in advance.

dombisza avatar Jun 10 '21 06:06 dombisza

Not isolated to ingress: Failed initializing schema https://kubernetesjsonschema.dev/master-standalone/certificate-cert-manager-v1.json: Could not read schema from HTTP, response status is 404 Not Found

izorster avatar Jun 10 '21 14:06 izorster

Likewise. I can use versions that appear on main page https://kubernetesjsonschema.dev

But for example I can't specify various 1.20.x patches (or anything 1.20 for that matter) or 1.19 or the like

andrei-dascalu avatar Jun 13 '21 11:06 andrei-dascalu

Will there be a patch soon? Or is there a workaround?

tmikulin avatar Jun 24 '21 07:06 tmikulin

For newer versions of Kubernetes, try using kubeval with my fork of the json schema repos: https://github.com/yannh/kubernetes-json-schema See README for how to use those with kubeval. It contains schemas for all versions of Kubernetes post 1.15.

This should solve the errors related to Kubernetes versions.

Things such as certificate-cert-manager-v1.json I believe are CRDs from https://github.com/jetstack/cert-manager , and a different problem?

yannh avatar Jun 24 '21 08:06 yannh

For newer versions of Kubernetes, try using kubeval with my fork of the json schema repos: https://github.com/yannh/kubernetes-json-schema See README for how to use those with kubeval. It contains schemas for all versions of Kubernetes post 1.15.

This should solve the errors related to Kubernetes versions.

Things such as certificate-cert-manager-v1.json I believe are CRDs from https://github.com/jetstack/cert-manager , and a different problem?

@yannh Nice work! Wondering if you tried getting your changes merged to this repo. It would be nice to have only one place to refer. That being said I don't know what's the process of merging PRs here, as I can see lots of them still unmerged.

knkarthik avatar Aug 03 '21 18:08 knkarthik

As noted above to use newer schemas use command like below

kubeval --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master -d mydirectory

jeremybusk avatar Oct 17 '21 22:10 jeremybusk

Thank you @jeremybusk and @yannh 🚀

For a long lasting fix, I applied an alias:

alias kubeval="kubeval --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master "

aguglie avatar Mar 26 '22 12:03 aguglie

I've tried applying the fix:

for file in $(find ./output -type f -iname '*.y*ml'); do
  kubeval --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master $file --strict
done

I'm getting:

1 error occurred:
	* Failed initalizing schema https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/ingress-networking-v1.json: Get https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/ingress-networking-v1.json: EOF


1 error occurred:
	* Failed initalizing schema https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/service-v1.json: Get https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/service-v1.json: EOF


1 error occurred:
	* Failed initalizing schema https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/deployment-apps-v1.json: Get https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/deployment-apps-v1.json: EOF


1 error occurred:
	* Failed initalizing schema https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/cronjob-batch-v1.json: Get https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/master-standalone-strict/cronjob-batch-v1.json: EOF

Am I doing anything wrong?

mmisztal1980 avatar Apr 01 '22 11:04 mmisztal1980

For newer versions of Kubernetes, try using kubeval with my fork of the json schema repos: https://github.com/yannh/kubernetes-json-schema See README for how to use those with kubeval. It contains schemas for all versions of Kubernetes post 1.15.

This should solve the errors related to Kubernetes versions.

Things such as certificate-cert-manager-v1.json I believe are CRDs from https://github.com/jetstack/cert-manager , and a different problem?

thanks! this is very helpful

alfchee avatar Mar 07 '23 00:03 alfchee