Skip to content

Commit

Permalink
Merge pull request #66840 from janetkuo/job-ttl
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue (batch tested with PRs 66840, 68159). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

TTL for cleaning up Jobs after they finish

**What this PR does / why we need it**: kubernetes/enhancements#592

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #64470 
For kubernetes/enhancements#592

**Special notes for your reviewer**: @kubernetes/sig-apps-pr-reviews 

**Release note**:

```release-note
Add a TTL machenism to clean up Jobs after they finish.
```

Kubernetes-commit: c50a3471242fa33a111d493711c3477e691ccdea
  • Loading branch information
k8s-publishing-bot committed Sep 5, 2018
2 parents 89dfcd0 + fe82b8a commit 012f271
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 65 deletions.
146 changes: 89 additions & 57 deletions batch/v1/generated.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions batch/v1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions batch/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,18 @@ type JobSpec struct {
// Describes the pod that will be created when executing a job.
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,6,opt,name=template"`

// ttlSecondsAfterFinished limits the lifetime of a Job that has finished
// execution (either Complete or Failed). If this field is set,
// ttlSecondsAfterFinished after the Job finishes, it is eligible to be
// automatically deleted. When the Job is being deleted, its lifecycle
// guarantees (e.g. finalizers) will be honored. If this field is unset,
// the Job won't be automatically deleted. If this field is set to zero,
// the Job becomes eligible to be deleted immediately after it finishes.
// This field is alpha-level and is only honored by servers that enable the
// TTLAfterFinished feature.
// +optional
TTLSecondsAfterFinished *int32 `json:"ttlSecondsAfterFinished,omitempty" protobuf:"varint,8,opt,name=ttlSecondsAfterFinished"`
}

// JobStatus represents the current state of a Job.
Expand Down
Loading

0 comments on commit 012f271

Please sign in to comment.