Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time to live for finished jobs in Kubernetes #29439

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions chart/templates/jobs/create-user-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ metadata:
{{- $annotations | toYaml | nindent 4 }}
{{- end }}
spec:
{{- if semverCompare ">= 1.23.x" (include "kubeVersion" .) }}
ttlSecondsAfterFinished: {{ .Values.createUserJob.ttlSecondsAfterFinished }}
{{- end }}
template:
metadata:
labels:
Expand Down
3 changes: 3 additions & 0 deletions chart/templates/jobs/migrate-database-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ metadata:
{{- $annotations | toYaml | nindent 4 }}
{{- end }}
spec:
{{- if semverCompare ">= 1.23.x" (include "kubeVersion" .) }}
ttlSecondsAfterFinished: {{ .Values.migrateDatabaseJob.ttlSecondsAfterFinished }}
{{- end }}
template:
metadata:
labels:
Expand Down
10 changes: 10 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2894,6 +2894,11 @@
}
}
},
"ttlSecondsAfterFinished": {
"description": "Number of seconds to wait until the job is eligible for deletion (Kubernetes 1.23+)",
"type": "integer",
"default": 300
},
"extraContainers": {
"description": "Launch additional containers for the create user job pod",
"type": "array",
Expand Down Expand Up @@ -3112,6 +3117,11 @@
}
]
},
"ttlSecondsAfterFinished": {
"description": "Number of seconds to wait until the job is eligible for deletion (Kubernetes 1.23+)",
"type": "integer",
"default": 300
},
"extraContainers": {
"description": "Launch additional containers for the migrate database job pod",
"type": "array",
Expand Down
6 changes: 5 additions & 1 deletion chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -782,11 +782,12 @@ createUserJob:
- "{{ .Values.webserver.defaultUser.lastName }}"
- "-p"
- "{{ .Values.webserver.defaultUser.password }}"

# Annotations on the create user job pod
annotations: {}
# jobAnnotations are annotations on the create user job
jobAnnotations: {}
# Number of seconds to wait until the job is eligible for deletion (Kubernetes 1.23+)
ttlSecondsAfterFinished: 300

# Labels specific to createUserJob objects and pods
labels: {}
Expand Down Expand Up @@ -870,6 +871,9 @@ migrateDatabaseJob:
# Annotations to add to migrate database job kubernetes service account.
annotations: {}

# Number of seconds to wait until the job is eligible for deletion (Kubernetes 1.23+)
ttlSecondsAfterFinished: 300

resources: {}
# limits:
# cpu: 100m
Expand Down