Skip to content

Commit e78ec14

Browse files
Merge pull request #108032 from deejross/kep3140-cronjob-timezone
KEP 3140: TimeZone support for CronJob Kubernetes-commit: 0f2300575c805bb70ba181957684361bcd25f86a
2 parents 6519413 + 4d603a5 commit e78ec14

16 files changed

+277
-145
lines changed

batch/v1/generated.pb.go

Lines changed: 136 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

batch/v1/generated.proto

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

batch/v1/types.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package v1
1818

1919
import (
20-
"k8s.io/api/core/v1"
20+
corev1 "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
"k8s.io/apimachinery/pkg/types"
2323
)
@@ -146,7 +146,7 @@ type JobSpec struct {
146146

147147
// Describes the pod that will be created when executing a job.
148148
// More info: https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
149-
Template v1.PodTemplateSpec `json:"template" protobuf:"bytes,6,opt,name=template"`
149+
Template corev1.PodTemplateSpec `json:"template" protobuf:"bytes,6,opt,name=template"`
150150

151151
// ttlSecondsAfterFinished limits the lifetime of a Job that has finished
152152
// execution (either Complete or Failed). If this field is set,
@@ -304,7 +304,7 @@ type JobCondition struct {
304304
// Type of job condition, Complete or Failed.
305305
Type JobConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=JobConditionType"`
306306
// Status of the condition, one of True, False, Unknown.
307-
Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
307+
Status corev1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
308308
// Last time the condition was checked.
309309
// +optional
310310
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,3,opt,name=lastProbeTime"`
@@ -375,6 +375,12 @@ type CronJobSpec struct {
375375
// The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
376376
Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
377377

378+
// The time zone for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
379+
// If not specified, this will rely on the time zone of the kube-controller-manager process.
380+
// ALPHA: This field is in alpha and must be enabled via the `CronJobTimeZone` feature gate.
381+
// +optional
382+
TimeZone *string `json:"timeZone,omitempty" protobuf:"bytes,8,opt,name=timeZone"`
383+
378384
// Optional deadline in seconds for starting the job if it misses scheduled
379385
// time for any reason. Missed jobs executions will be counted as failed ones.
380386
// +optional
@@ -431,7 +437,7 @@ type CronJobStatus struct {
431437
// A list of pointers to currently running jobs.
432438
// +optional
433439
// +listType=atomic
434-
Active []v1.ObjectReference `json:"active,omitempty" protobuf:"bytes,1,rep,name=active"`
440+
Active []corev1.ObjectReference `json:"active,omitempty" protobuf:"bytes,1,rep,name=active"`
435441

436442
// Information when was the last time the job was successfully scheduled.
437443
// +optional

batch/v1/types_swagger_doc_generated.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func (CronJobList) SwaggerDoc() map[string]string {
5151
var map_CronJobSpec = map[string]string{
5252
"": "CronJobSpec describes how the job execution will look like and when it will actually run.",
5353
"schedule": "The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.",
54+
"timeZone": "The time zone for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will rely on the time zone of the kube-controller-manager process. ALPHA: This field is in alpha and must be enabled via the `CronJobTimeZone` feature gate.",
5455
"startingDeadlineSeconds": "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.",
5556
"concurrencyPolicy": "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",
5657
"suspend": "This flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.",

batch/v1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

batch/v1beta1/generated.pb.go

Lines changed: 97 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

batch/v1beta1/generated.proto

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

batch/v1beta1/types.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ type CronJobSpec struct {
104104
// The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
105105
Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
106106

107+
// The time zone for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.
108+
// If not specified, this will rely on the time zone of the kube-controller-manager process.
109+
// ALPHA: This field is in alpha and must be enabled via the `CronJobTimeZone` feature gate.
110+
// +optional
111+
TimeZone *string `json:"timeZone,omitempty" protobuf:"bytes,8,opt,name=timeZone"`
112+
107113
// Optional deadline in seconds for starting the job if it misses scheduled
108114
// time for any reason. Missed jobs executions will be counted as failed ones.
109115
// +optional

batch/v1beta1/types_swagger_doc_generated.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ func (CronJobList) SwaggerDoc() map[string]string {
5151
var map_CronJobSpec = map[string]string{
5252
"": "CronJobSpec describes how the job execution will look like and when it will actually run.",
5353
"schedule": "The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.",
54+
"timeZone": "The time zone for the given schedule, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. If not specified, this will rely on the time zone of the kube-controller-manager process. ALPHA: This field is in alpha and must be enabled via the `CronJobTimeZone` feature gate.",
5455
"startingDeadlineSeconds": "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.",
5556
"concurrencyPolicy": "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",
5657
"suspend": "This flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.",

0 commit comments

Comments
 (0)