Skip to content

Commit

Permalink
test graceful shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
nicks committed May 20, 2024
1 parent 947f03a commit 1bf5c3b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion 0-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM busybox
WORKDIR /app
ADD . .
ENTRYPOINT ./main.sh
ENTRYPOINT ["./main.sh"]
6 changes: 6 additions & 0 deletions 0-base/kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ spec:
containers:
- name: example-html
image: example-html-image
terminationGracePeriodSeconds: 15
ports:
- containerPort: 8000
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
9 changes: 8 additions & 1 deletion 0-base/main.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
#!/bin/sh

trap 'echo $POD_NAME received TERM' TERM

echo "Serving files on port 8000"
busybox httpd -f -p 8000
while :
do
sleep 5 &
wait $!
echo "Pod alive $POD_NAME"
done

0 comments on commit 1bf5c3b

Please sign in to comment.