Answers: <p>It is not. In the case you mention.</p>
  <p>The only reason you will have to add quotes surrounding values is when there's room for confusion, converting your YAML into a JSON.</p>
  <p>In your sample, you probably noticed that both versions work. Not setting any quotes doesn't end up with an error.</p>
  <p>However, the following would be invalid:</p>
  <pre><code>  resources:
      limits:
        cpu: 1
        memory: 300Mi
  </code></pre>
  <p>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:</p>
  <pre><code>  resources:
      limits:
        cpu: &quot;1&quot;
        memory: 300Mi
  </code></pre>
  <p>This has to do with your client, converting this yaml into a JSON before posting to the API. A JSON that says <code>&quot;resource&quot;: { &quot;limits&quot;: { &quot;cpu&quot;: 1 } }</code> is valid on paper. Although from the server perspective, you're using an integer, when a string is expected (as per podSpec / resources schema).</p>
  <p>So: no, it is not needed to have <code>&quot;&quot;</code> or <code>''</code> surrounding resource requests or limits, most of the time. Until your requested value can be casted as an integer.</p>
  
Answers: CC BY-SA 4.0
Answers: 2022-07-24T16:44:13.250Z
Answers: 2022-07-24T16:44:13.250Z
Answers: SYN
Body: <p>it's needed to add <code>&quot;&quot; OR ''</code> to the request/limit configurations?
  For example:</p>
  <pre><code>  resources:
      limits:
        cpu: 100m
        memory: 300Mi
      requests:
        cpu: 1m
        memory: 50Mi
  </code></pre>
  <p>vs.</p>
  <pre><code>  resources:
      limits:
        cpu: &quot;100m&quot;
        memory: &quot;300Mi&quot;
      requests:
        cpu: &quot;1m&quot;
        memory: &quot;50Mi&quot;
  </code></pre>
  
Tags: <kubernetes>
Title: Limit and request decleration
UserDisplayName: Ido Segal
ThreadText: # Limit and request decleration
  
  (Asked by: username_0 on 2022-07-24)
  
  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"
  
  ```
  
  **Tags:** kubernetes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-07-24. Score: 1 | Accepted answer
  
  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.
  
  
  ---
  
  