<pre class="lang-golang prettyprint-override"><code>Spec: v1.PodSpec{
    Containers: []v1.Container{
        v1.Container{
            Name:            podName,
            Image:           deploymentName,
            ImagePullPolicy: &quot;IfNotPresent&quot;,
            Ports:           []v1.ContainerPort{},
            Env: []v1.EnvVar{
                v1.EnvVar{
                    Name:  &quot;RASA_NLU_CONFIG&quot;,
                    Value: os.Getenv(&quot;RASA_NLU_CONFIG&quot;),
                },
                v1.EnvVar{
                    Name:  &quot;RASA_NLU_DATA&quot;,
                    Value: os.Getenv(&quot;RASA_NLU_DATA&quot;),
                },
            },
            Resources: v1.ResourceRequirements{},
        },
    },
    RestartPolicy: v1.RestartPolicyOnFailure,
},
</code></pre>
<p>I want to provide resource limits as corresponding like :</p>
<pre class="lang-yaml prettyprint-override"><code>resources:
  limits:
    cpu: &quot;1&quot;
  requests:
    cpu: &quot;0.5&quot;
</code></pre>
<p>How do I go on to do that. I tried adding Limits and its map key value pair but it seems to be quite a nested structure. There doesnt seem to be any example as to how to provide resources in kube client go.</p>

mohd.gadi
<p>I struggled with the same when i was creating a statefulset. Maybe my codesnipped will help you:</p>
<pre class="lang-golang prettyprint-override"><code>Resources: apiv1.ResourceRequirements{
    Limits: apiv1.ResourceList{
        &quot;cpu&quot;:    resource.MustParse(cpuLimit),
        &quot;memory&quot;: resource.MustParse(memLimit),
    },
    Requests: apiv1.ResourceList{
        &quot;cpu&quot;:    resource.MustParse(cpuReq),
        &quot;memory&quot;: resource.MustParse(memReq),
    },
},
</code></pre>
<p>the vars cpuReq, memReq, cpuLimit and memLimit are supposed to be strings</p>
