Limit and request decleration
-
it's needed to add
"" OR ''
to the request/limit configurations? For example:resources: limits: cpu: 100m memory: 300Mi requests: cpu: 1m memory: 50Mi
vs.
resources: limits: cpu: "100m" memory: "300Mi" requests: cpu: "1m" memory: "50Mi"
-
It is not. In the case you mention.
The only reason you will have to add quotes surrounding values is when there's room for confusion, converting your YAML into a JSON.
In your sample, you probably noticed that both versions work. Not setting any quotes doesn't end up with an error.
However, the following would be invalid:
resources: limits: cpu: 1 memory: 300Mi
If you try to create a workload with a resource limits such as above, you would get an error: object is invalid. To fix it, you will have to quote your cpu limit, such as:
resources: limits: cpu: "1" memory: 300Mi
This has to do with your client, converting this yaml into a JSON before posting to the API. A JSON that says
"resource": { "limits": { "cpu": 1 } }
is valid on paper. Although from the server perspective, you're using an integer, when a string is expected (as per podSpec / resources schema).So: no, it is not needed to have
""
or''
surrounding resource requests or limits, most of the time. Until your requested value can be casted as an integer.