Skip to content

Commit

Permalink
Adding munged container start script that pauses sigterm handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kincl committed Nov 7, 2023
1 parent 3a5c769 commit e7db767
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
3 changes: 2 additions & 1 deletion slurm/images/munge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ RUN useradd user1 && \

RUN mkdir /scripts
ADD fix-munge-paths.sh /scripts
ADD munged-container.sh /scripts
RUN chmod +x /scripts/*.sh

WORKDIR /
CMD ['/sbin/munged', '-F']
CMD ['/bin/bash', '/scripts/munged-container.sh']
14 changes: 14 additions & 0 deletions slurm/images/munge/munged-container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

_term() {
echo "Caught SIGTERM, waiting 10 seconds"
sleep 10
kill -TERM "$child" 2>/dev/null
}

trap _term SIGTERM

/sbin/munged -F &

child=$!
wait "$child"
1 change: 1 addition & 0 deletions slurm/manifests/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ configMapGenerator:
- name: slurm-conf
files:
- configs/slurm.conf
- configs/munge-init
options:
disableNameSuffixHash: true
11 changes: 8 additions & 3 deletions slurm/manifests/statefulset-compute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ spec:
- -Z
# - --conf
# - RealMemory=4000
lifecycle:
preStop:
exec:
command:
- /bin/bash
- -c
- |
scontrol update nodename=$HOSTNAME state=down reason=shutdown
securityContext:
runAsUser: 0
runAsGroup: 0
Expand All @@ -81,9 +89,6 @@ spec:
mountPath: /home
- name: munge
image: ghcr.io/naps-product-sa/openshift-batch/munge:latest
command:
- /sbin/munged
- -F
securityContext:
runAsUser: 500
runAsGroup: 500
Expand Down

0 comments on commit e7db767

Please sign in to comment.