// CronJobSpec describes how the job execution will look like and when it will actually run. type CronJobSpec struct {
// The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. // Cron时间格式 Schedule string`json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
// The time zone name for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. // If not specified, this will default to the time zone of the kube-controller-manager process. // The set of valid time zone names and the time zone offset is loaded from the system-wide time zone // database by the API server during CronJob validation and the controller manager during execution. // If no system-wide time zone database can be found a bundled version of the database is used instead. // If the time zone name becomes invalid during the lifetime of a CronJob or due to a change in host // configuration, the controller will stop creating new new Jobs and will create a system event with the // reason UnknownTimeZone. // More information can be found in https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#time-zones // This is beta field and must be enabled via the `CronJobTimeZone` feature gate. // +optional // 给定时间表时区名称 // beta字段 需要开启CrobJobTimeZone TimeZone *string`json:"timeZone,omitempty" protobuf:"bytes,8,opt,name=timeZone"`
// Optional deadline in seconds for starting the job if it misses scheduled // time for any reason. Missed jobs executions will be counted as failed ones. // +optional // 由于某种时间错过预定时间,开始运行Job的截止时间 // 错过Job是认为失败了 StartingDeadlineSeconds *int64`json:"startingDeadlineSeconds,omitempty" protobuf:"varint,2,opt,name=startingDeadlineSeconds"`
// Specifies how to treat concurrent executions of a Job. // Valid values are: // - "Allow" (default): allows CronJobs to run concurrently; // - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet; // - "Replace": cancels currently running job and replaces it with a new one // +optional // 如何制定Job的并发执行 // 可选值有三个 // Allow:默认值,允许 // Forbid:禁止并发运行,上一次没完成,跳过 // Replace:取消当前正在运行的Job 替换为新的Job // CronJobs:同时运行 ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty" protobuf:"bytes,3,opt,name=concurrencyPolicy,casttype=ConcurrencyPolicy"`
// This flag tells the controller to suspend subsequent executions, it does // not apply to already started executions. Defaults to false. // +optional // 标志控制器暂停后序运行,不适用于已经开始的运行,默认值false Suspend *bool`json:"suspend,omitempty" protobuf:"varint,4,opt,name=suspend"`
// Specifies the job that will be created when executing a CronJob. // 执行创建的Job JobTemplate JobTemplateSpec `json:"jobTemplate" protobuf:"bytes,5,opt,name=jobTemplate"`
// The number of successful finished jobs to retain. Value must be non-negative integer. // Defaults to 3. // +optional // 保留成功的已经完成Job数量,默认1,非负数 SuccessfulJobsHistoryLimit *int32`json:"successfulJobsHistoryLimit,omitempty" protobuf:"varint,6,opt,name=successfulJobsHistoryLimit"`
// The number of failed finished jobs to retain. Value must be non-negative integer. // Defaults to 1. // +optional // 保留失败的已经完成Job数量,默认1,非负数 FailedJobsHistoryLimit *int32`json:"failedJobsHistoryLimit,omitempty" protobuf:"varint,7,opt,name=failedJobsHistoryLimit"` }