diff --git a/README.md b/README.md index f885478..d40d342 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,34 @@ layer b/w the virtual kubelet component and the provider logic for the container Note: if you want a quick start setup (using a Docker container), Go is not necessary -### :warning: It is very important for you to remember to set CPU and Memory Limits in your Pod/Deployment YAML, otherwise default resources will be applied; specifically, if you don't set a CPU limit, only 1 CPU will be used for each task, while if you don't set any Memory limit, only 1MB will be used for each task. :warning: +#### :warning: Pods Requirements + +- It is very important for you to remember to set CPU and Memory Limits in your Pod/Deployment YAML, otherwise default resources will be applied; specifically, if you don't set a CPU limit, only 1 CPU will be used for each task, while if you don't set any Memory limit, only 1MB will be used for each task. + +- Docker entrypoints are not supported by Singularity. This means you have to manually specify a command to be executed. If you don't, /bin/sh is assumed as the default one. + +The following is a simple example of a Pod with a specified command and limits properly set: +```yaml + apiVersion: v1 + kind: Pod + metadata: + name: test-pod + annotations: + slurm-job.knoc.io/flags: "--job-name=test-pod-cfg -t 2800 --ntasks=8 --nodes=1 --mem-per-cpu=2000" + spec: + restartPolicy: Never + containers: + - image: docker://busybox:latest + command: ["echo"] + args: ["hello world"] + imagePullPolicy: Always + name: "hello world" + resources: + limits: + memory: 100Mi + cpu: 2 +``` + ### :fast_forward: Quick Start diff --git a/pkg/slurm/Create.go b/pkg/slurm/Create.go index 89ce9bb..50279d7 100644 --- a/pkg/slurm/Create.go +++ b/pkg/slurm/Create.go @@ -6,6 +6,7 @@ import ( "io" "net/http" "os" + "strings" "github.com/containerd/containerd/log" @@ -99,7 +100,11 @@ func (h *SidecarHandler) SubmitHandler(w http.ResponseWriter, r *http.Request) { image = container.Image if image_uri, ok := metadata.Annotations["slurm-job.vk.io/image-root"]; ok { - image = image_uri + container.Image + if !strings.HasPrefix(image, image_uri) { + image = image_uri + container.Image + } else { + log.G(h.Ctx).Warning("- image-uri annotation specified but already present in the image name. Prefix won't be added.") + } } else { log.G(h.Ctx).Info("- image-uri annotation not specified for path in remote filesystem") }