mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Add TTLAfterFinished alpha feature
This commit is contained in:
parent
92ad24cc4d
commit
209b32684e
@ -138,6 +138,18 @@ type JobSpec struct {
|
|||||||
|
|
||||||
// Describes the pod that will be created when executing a job.
|
// Describes the pod that will be created when executing a job.
|
||||||
Template api.PodTemplateSpec
|
Template api.PodTemplateSpec
|
||||||
|
|
||||||
|
// 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
|
||||||
}
|
}
|
||||||
|
|
||||||
// JobStatus represents the current state of a Job.
|
// JobStatus represents the current state of a Job.
|
||||||
|
@ -54,6 +54,7 @@ func Convert_batch_JobSpec_To_v1_JobSpec(in *batch.JobSpec, out *batchv1.JobSpec
|
|||||||
out.Completions = in.Completions
|
out.Completions = in.Completions
|
||||||
out.ActiveDeadlineSeconds = in.ActiveDeadlineSeconds
|
out.ActiveDeadlineSeconds = in.ActiveDeadlineSeconds
|
||||||
out.BackoffLimit = in.BackoffLimit
|
out.BackoffLimit = in.BackoffLimit
|
||||||
|
out.TTLSecondsAfterFinished = in.TTLSecondsAfterFinished
|
||||||
out.Selector = in.Selector
|
out.Selector = in.Selector
|
||||||
if in.ManualSelector != nil {
|
if in.ManualSelector != nil {
|
||||||
out.ManualSelector = new(bool)
|
out.ManualSelector = new(bool)
|
||||||
@ -73,6 +74,7 @@ func Convert_v1_JobSpec_To_batch_JobSpec(in *batchv1.JobSpec, out *batch.JobSpec
|
|||||||
out.Completions = in.Completions
|
out.Completions = in.Completions
|
||||||
out.ActiveDeadlineSeconds = in.ActiveDeadlineSeconds
|
out.ActiveDeadlineSeconds = in.ActiveDeadlineSeconds
|
||||||
out.BackoffLimit = in.BackoffLimit
|
out.BackoffLimit = in.BackoffLimit
|
||||||
|
out.TTLSecondsAfterFinished = in.TTLSecondsAfterFinished
|
||||||
out.Selector = in.Selector
|
out.Selector = in.Selector
|
||||||
if in.ManualSelector != nil {
|
if in.ManualSelector != nil {
|
||||||
out.ManualSelector = new(bool)
|
out.ManualSelector = new(bool)
|
||||||
|
@ -381,6 +381,12 @@ const (
|
|||||||
//
|
//
|
||||||
// Enables control over ProcMountType for containers.
|
// Enables control over ProcMountType for containers.
|
||||||
ProcMountType utilfeature.Feature = "ProcMountType"
|
ProcMountType utilfeature.Feature = "ProcMountType"
|
||||||
|
|
||||||
|
// owner: @janetkuo
|
||||||
|
// alpha: v1.12
|
||||||
|
//
|
||||||
|
// Allow TTL controller to clean up Pods and Jobs after they finish.
|
||||||
|
TTLAfterFinished utilfeature.Feature = "TTLAfterFinished"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -445,6 +451,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
|
|||||||
SCTPSupport: {Default: false, PreRelease: utilfeature.Alpha},
|
SCTPSupport: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
VolumeSnapshotDataSource: {Default: false, PreRelease: utilfeature.Alpha},
|
VolumeSnapshotDataSource: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
ProcMountType: {Default: false, PreRelease: utilfeature.Alpha},
|
ProcMountType: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
|
TTLAfterFinished: {Default: false, PreRelease: utilfeature.Alpha},
|
||||||
|
|
||||||
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
|
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
|
||||||
// unintentionally on either side:
|
// unintentionally on either side:
|
||||||
|
@ -114,6 +114,18 @@ type JobSpec struct {
|
|||||||
// Describes the pod that will be created when executing a job.
|
// Describes the pod that will be created when executing a job.
|
||||||
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
|
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
|
||||||
Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,6,opt,name=template"`
|
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"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// JobStatus represents the current state of a Job.
|
// JobStatus represents the current state of a Job.
|
||||||
|
Loading…
Reference in New Issue
Block a user