Skip to content

Commit c83db48

Browse files
authored
Add a job TTL such that they don't hang around forever (#75)
* Fix comment line location - it somehow got into the wrong spot. * Add a job TTL such that they don't hang around forever After a job completes, the pod does not need to stay on the cluster as a "completed" pod forever. It just takes up kubernetes state space when it has long since completed. Keeping it around for a while after completing allows for inspection but once that time has been reached, it should evaporate and no longer take up state space. (Jobs don't restart once completed so they are not very useful and in larger clusters the state space becomes a bottleneck)
1 parent cec463a commit c83db48

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

helm/vmss-prototype/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
description: A Helm chart for the Kamino vmss-prototype pattern image generator
33
name: vmss-prototype
4-
version: 0.0.12
4+
version: 0.0.13
55
maintainers:
66
- name: Michael Sinz
77
email: msinz@microsoft.com

helm/vmss-prototype/templates/vmss-prototype.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ spec:
4848
{{- end }}
4949

5050
# This is indented like it is under either the Job.spec or CronJob.spec.jobTemplate.spec
51+
ttlSecondsAfterFinished: {{ .Values.kamino.jobTtl }}
5152
template:
5253
metadata:
5354
labels:

helm/vmss-prototype/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ kamino:
2121
# Minimum is 2.
2222
imageHistory: 3
2323

24+
# Number of seconds after the job completes before it is cleaned up
25+
# see https://kubernetes.io/docs/concepts/workloads/controllers/job/#ttl-mechanism-for-finished-jobs
26+
# This has it clean up the pod from the cluster within an hour, just to
27+
# help reduce left over state in the cluster.
28+
jobTtl: 3600
29+
2430
drain:
2531
# Drain grace period is the maximum time to allow pods to drain load
2632
# and leave the node. The default of 300 seconds is relatively long

vmss-prototype/vmss-prototype

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ def image_tweaks(node_name):
401401
# Give kubernetes a few moments to notice we are running
402402
# as the rest of this stuff really just happens quickly
403403
'/bin/sleep 4',
404+
# Update an ancestry.log
404405
'/bin/echo "$(/bin/date) VMSS-Prototype Donor: $(/bin/hostname)" >> /var/log/ancestry.log',
405406
# Multiple lines so it is easier to read all of the different
406407
# items we are cleaning up (removing)
@@ -420,7 +421,6 @@ def image_tweaks(node_name):
420421
' /var/lib/waagent/GoalState.*.xml'
421422
' /var/lib/waagent/*.manifest.xml'
422423
'',
423-
# Update an ancestry.log
424424
# This forces the machine-id to be re-issued
425425
'/bin/cp /dev/null /etc/machine-id',
426426
# Finally, we need to power off now

0 commit comments

Comments
 (0)