Comments (6)
So, according to the specification this is actually doing the right thing. However Kubernetes doesn't use quite the same rules internally so kubeval
is finding a bunch of similar issues. I'll open upstream bugs when I get a moment and also talk to SIG API Machinery about the actual internal implementation so I can have kubeval
do the right thing.
From the upstream OpenAPI description at https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/openapi-spec/swagger.json
io.k8s.api.core.v1.ResourceRequirements: {
description: "ResourceRequirements describes the compute resource requirements.",
properties: {
limits: {
description: "Limits describes the maximum amount of compute resources allowed. More info:
https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
type: "object",
additionalProperties: {
$ref: "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity"
}
},
requests: {
description: "Requests describes the minimum amount of compute resources required. If Requests is omitted for a container, it defaults to Limits if that is explicitly specified, otherwise to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/",
type: "object",
additionalProperties: {
$ref: "#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity"
}
}
}
},
Note that cpu and memory are not explicitly defined, but resources can take additional properties as long as they are of type quantity. Quantity is defined as:
io.k8s.apimachinery.pkg.api.resource.Quantity: {
type: "string"
},
So:
- the error appears at the limit and request key because they are additional properties. I'll see if the actual key is available from the json schema Go library, or file a bug for that
- the spec actually says this should be a string. If you try with "200m" I think it will work for instance.
- Kubernetes accepts null to mean blank string, hence the
[string,null]
part of the error which kubeval adds in
from kubeval.
Posted a clarifying question to SIG API Machinery at https://groups.google.com/forum/#!topic/kubernetes-sig-api-machinery/dLCXrZRwWpU
from kubeval.
This should now work as expected. Tests in 06e025e
The fix is in the upstream schemas in 06e025e so should work without needing you to update kubeval.
from kubeval.
This is not really a bug. It's a convenience feature specific to Quantity
I'll update the upstream specs to allow Quantity to be a number.
from kubeval.
I've also opened an upstream bug to track a fix in this spec kubernetes/kubernetes#50957
from kubeval.
Wonderful! Thank you very much.
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.