Skip to content

Commit

Permalink
updated README and minors to Create.go
Browse files Browse the repository at this point in the history
Signed-off-by: Surax98 <[email protected]>
  • Loading branch information
Surax98 committed Aug 26, 2024
1 parent c5818d1 commit 9a2e1fd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion pkg/slurm/Create.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"io"
"net/http"
"os"
"strings"

"github.com/containerd/containerd/log"

Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit 9a2e1fd

Please sign in to comment.