GithubHelp home page GithubHelp logo

Comments (8)

garethr avatar garethr commented on July 24, 2024 1

Unfortunately in both these cases the schema doesn't contain the information required to do validation of values, or rather it's included as text in the description field:

For the name: https://github.com/garethr/kubernetes-json-schema/blob/master/master-standalone/service.json#L179

and for type: https://github.com/garethr/kubernetes-json-schema/blob/master/master-standalone/service.json#L135

In the case of type this should include an enum:

 "enum": ["ExternalName", "ClusterIP", "NodePort", "LoadBalancer"]

Name should validate the DNS_RECORD with the regex from the source

"regex": "[a-z0-9]([-a-z0-9]*[a-z0-9])?"

This might be a limitation of OpenAPI 2.0, or of the go-openapi library. I'll open an issue to track upstream.

from kubeval.

garethr avatar garethr commented on July 24, 2024 1

Posted to SIG API Machinery to check my assumptions on this https://groups.google.com/forum/#!topic/kubernetes-sig-api-machinery/Q9tGqhV4ZNA

from kubeval.

devikaturi avatar devikaturi commented on July 24, 2024

I am trying to use kubeval library in my project.
calling the validate function:
kubeval.Validate([]byte("v1.7.2"), "D:/Playground/nginx-deployment.yaml")

Throws the following error :

  • Missing a kind key

Whats could be the reason for the failure? am I calling the validate function in the right way?

the deployment file is valid:
apiVersion: apps/v1beta1 # for versions before 1.6.0 use extensions/v1beta1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80

from kubeval.

surajnarwade avatar surajnarwade commented on July 24, 2024

nice 👍

from kubeval.

garethr avatar garethr commented on July 24, 2024

kubernetes/kubernetes#24562 is the upstream issue for enums and kubernetes/kubernetes#8116 is the relevant issue for regexes. Ideally this will be fixed here and then autogenerating the schemas will do the right thing.

from kubeval.

surajnarwade avatar surajnarwade commented on July 24, 2024

@garethr , if we add something like additionalkeys: false in jsonschema, it will also restricts any extra key, right ?

from kubeval.

garethr avatar garethr commented on July 24, 2024

@surajnarwade correct. See the code in #32 and the discussion in #24. I don't think this affects the issue above however.

from kubeval.

surajnarwade avatar surajnarwade commented on July 24, 2024

@garethr yeah, thanks, this will not affect this issue though

from kubeval.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.