一些cronjob job pod的参数说明

Job 参数

type JobSpec struct {
  Parallelism             *int32
  Completions             *int32
  ActiveDeadllineSeconds  *int64
  BackoffLimit            *int32
  TTLSecondsAfterFinished *int32
  ManualSelector          *bool
  Selector                *metav1.LabelSelector
  Template                v1.PodTemplateSpec
}

参数解析

参数 说明 默认值
Completions 指定job需要成功运行pods的次数(do not specify .spec.completions, default to .spec.parallelism.) 1
Parallelism 指定job在任一时刻应该并发运行pods的数量 1
ActiveDeadlineSeconds 指定job可运行时间期限,如果超过时间还未结束,系统将会尝试终止;必须是一个正数  
BackoffLimit 指定job失败后的重试次数,每次失败后重试会有延迟时间,该时间是指数级增长,最长时间是6min 6

Pod 参数

type PodSpec struct {
  ActiveDeadllineSeconds *int64
  RestartPolicy          RestartPolicy
}
参数 说明 默认值
RestartPolicy 重启策略: Always, OnFailur, Never Always

CronJob 参数

type CronJobSpec struct {
  Schedule                   string
  StartingDeadlineSeconds    *int64
  ConcurrencyPolicy          ConcurrencyPolicy
  SuccessfulJobsHistoryLimit *int32
  FailedJobsHistoryLimit     *int32
}
参数 说明 默认值
Schedule cron格式  
StartingDeadlineSeconds 它表示启动 Job 的期限(秒级别),如果因为任何原因而错过了被调度的时间,那么错过执行时间的 Job 将被认为是失败的。如果没有指定,则没有期限  
ConcurrencyPolicy 设置并发策略,Allow: 允许并发执行 Forbid:前一个未执行完,则跳过 Replace:取消正在进行,用新的替换 Allow
SuccessfulJobsHistoryLimit 维持完成的jobs数量 3
FailedJobsHistoryLimit 维持失败的jobs数据量 1