Comments (8)
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.
Posted to SIG API Machinery to check my assumptions on this https://groups.google.com/forum/#!topic/kubernetes-sig-api-machinery/Q9tGqhV4ZNA
from kubeval.
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.
nice 👍
from kubeval.
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.
@garethr , if we add something like additionalkeys: false
in jsonschema, it will also restricts any extra key, right ?
from kubeval.
@surajnarwade correct. See the code in #32 and the discussion in #24. I don't think this affects the issue above however.
from kubeval.
@garethr yeah, thanks, this will not affect this issue though
from kubeval.
Related Issues (20)
- kubeval release download not in gzip format? HOT 1
- Calling bottle :unneeded is deprecated warning with brew HOT 2
- SARIF output management ?
- Failed initializing schema v1beta3
- Validation of Kustomization files HOT 1
- Validation error: Additional property seccompProfile is not allowed HOT 4
- error when attempting to lint poddisruption budget HOT 1
- Error 404 on schema json file when validate HOT 1
- Errors ignore output string type HOT 1
- ingressclass-networking-v1.json: Could not read schema from HTTP, response status is 404 Not Found HOT 7
- Valid resource failed validation with 404 schema not found
- Kubernetes OpenAPI v3 HOT 5
- kubeval of "helm create test-helm" fails HOT 1
- Latter half of domain is cut off resource group
- [BUG] ConfigMap Validation should be ERROR but is WARN HOT 3
- Connection reset by peer HOT 1
- Missing 'kind' key && getting Failed to decode YAML Errors HOT 1
- Maintenance information HOT 3
- Kubeval config file to reuse custom settings
- Add Support for .kubevalignore file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubeval.