     ; init container
     (when use-cook-init?
       (when-let [{:keys [command image]} init-container]
-        (let [container (V1Container.)]
+        (let [container (V1Container.)
+              get-resource-requirements-fn (fn [fieldname] (if use-cook-sidecar?
+                                                             (get-in sidecar [:resource-requirements fieldname])
+                                                             0))
+              total-memory-request (add-as-decimals computed-mem (get-resource-requirements-fn :memory-request))
+              total-memory-limit (add-as-decimals computed-mem (get-resource-requirements-fn :memory-limit))
+              total-cpu-request (add-as-decimals cpus (get-resource-requirements-fn :cpu-request))
+              total-cpu-limit (add-as-decimals cpus (get-resource-requirements-fn :cpu-limit))
+              resources (V1ResourceRequirements.)]
           ; container
           (.setName container cook-init-container-name)
           (.setImage container image)

    (.setTty container true)
    (.setStdin container true)

    (.putRequestsItem resources "memory" (double->quantity (* memory-multiplier computed-mem)))
    (.putLimitsItem resources "memory" (double->quantity (* memory-multiplier computed-mem)))
    (.putRequestsItem resources "cpu" (double->quantity cpus))
    (when set-container-cpu-limit?
      ; Some environments may need pods to run in the "Guaranteed"
      ; QoS, which requires limits for both memory and cpu
      (.putLimitsItem resources "cpu" (double->quantity cpus)))
    (when (pos? gpus)
      (.putLimitsItem resources "nvidia.com/gpu" (double->quantity gpus))
      (.putRequestsItem resources "nvidia.com/gpu" (double->quantity gpus))

    (merge pod-labels-defaults
           pod-labels-from-job-labels
           pod-labels-from-job-application)))

(defn set-mem-cpu-resources
  "Given a resources object and a CPU and memory request and limit, update the resources object to reflect the
  desired requests and limits."
  [^V1ResourceRequirements resources memory-request memory-limit cpu-request cpu-limit]
  (let [{:keys [set-container-cpu-limit?]} (config/kubernetes)]
    (.putRequestsItem resources "memory" (double->quantity (* memory-multiplier memory-request)))
    (.putLimitsItem resources "memory" (double->quantity (* memory-multiplier memory-limit)))
    (.putRequestsItem resources "cpu" (double->quantity cpu-request))
    (when set-container-cpu-limit?
      ; Some environments may need pods to run in the "Guaranteed"
      ; QoS, which requires limits for both memory and cpu
      (.putLimitsItem resources "cpu" (double->quantity cpu-limit)))))

(defn ^V1Pod task-metadata->pod
  "Given a task-request and other data generate the kubernetes V1Pod to launch that task."
