Commit 41d88d30 authored by Maciej Szulik's avatar Maciej Szulik

Rename ScheduledJob to CronJob

parent 0c7421fb
...@@ -172,7 +172,7 @@ func Run(s *options.ServerRunOptions) error { ...@@ -172,7 +172,7 @@ func Run(s *options.ServerRunOptions) error {
s.GenericServerRunOptions.StorageConfig, s.GenericServerRunOptions.DefaultStorageMediaType, api.Codecs, s.GenericServerRunOptions.StorageConfig, s.GenericServerRunOptions.DefaultStorageMediaType, api.Codecs,
genericapiserver.NewDefaultResourceEncodingConfig(), storageGroupsToEncodingVersion, genericapiserver.NewDefaultResourceEncodingConfig(), storageGroupsToEncodingVersion,
// FIXME: this GroupVersionResource override should be configurable // FIXME: this GroupVersionResource override should be configurable
[]unversioned.GroupVersionResource{batch.Resource("scheduledjobs").WithVersion("v2alpha1")}, []unversioned.GroupVersionResource{batch.Resource("cronjobs").WithVersion("v2alpha1")},
master.DefaultAPIResourceConfigSource(), s.GenericServerRunOptions.RuntimeConfig) master.DefaultAPIResourceConfigSource(), s.GenericServerRunOptions.RuntimeConfig)
if err != nil { if err != nil {
glog.Fatalf("error in initializing storage factory: %s", err) glog.Fatalf("error in initializing storage factory: %s", err)
......
...@@ -41,6 +41,7 @@ go_library( ...@@ -41,6 +41,7 @@ go_library(
"//pkg/cloudprovider/providers/vsphere:go_default_library", "//pkg/cloudprovider/providers/vsphere:go_default_library",
"//pkg/controller:go_default_library", "//pkg/controller:go_default_library",
"//pkg/controller/certificates:go_default_library", "//pkg/controller/certificates:go_default_library",
"//pkg/controller/cronjob:go_default_library",
"//pkg/controller/daemon:go_default_library", "//pkg/controller/daemon:go_default_library",
"//pkg/controller/deployment:go_default_library", "//pkg/controller/deployment:go_default_library",
"//pkg/controller/disruption:go_default_library", "//pkg/controller/disruption:go_default_library",
...@@ -59,7 +60,6 @@ go_library( ...@@ -59,7 +60,6 @@ go_library(
"//pkg/controller/replication:go_default_library", "//pkg/controller/replication:go_default_library",
"//pkg/controller/resourcequota:go_default_library", "//pkg/controller/resourcequota:go_default_library",
"//pkg/controller/route:go_default_library", "//pkg/controller/route:go_default_library",
"//pkg/controller/scheduledjob:go_default_library",
"//pkg/controller/service:go_default_library", "//pkg/controller/service:go_default_library",
"//pkg/controller/serviceaccount:go_default_library", "//pkg/controller/serviceaccount:go_default_library",
"//pkg/controller/volume/attachdetach:go_default_library", "//pkg/controller/volume/attachdetach:go_default_library",
......
...@@ -47,6 +47,7 @@ import ( ...@@ -47,6 +47,7 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/controller" "k8s.io/kubernetes/pkg/controller"
certcontroller "k8s.io/kubernetes/pkg/controller/certificates" certcontroller "k8s.io/kubernetes/pkg/controller/certificates"
"k8s.io/kubernetes/pkg/controller/cronjob"
"k8s.io/kubernetes/pkg/controller/daemon" "k8s.io/kubernetes/pkg/controller/daemon"
"k8s.io/kubernetes/pkg/controller/deployment" "k8s.io/kubernetes/pkg/controller/deployment"
"k8s.io/kubernetes/pkg/controller/disruption" "k8s.io/kubernetes/pkg/controller/disruption"
...@@ -65,7 +66,6 @@ import ( ...@@ -65,7 +66,6 @@ import (
replicationcontroller "k8s.io/kubernetes/pkg/controller/replication" replicationcontroller "k8s.io/kubernetes/pkg/controller/replication"
resourcequotacontroller "k8s.io/kubernetes/pkg/controller/resourcequota" resourcequotacontroller "k8s.io/kubernetes/pkg/controller/resourcequota"
routecontroller "k8s.io/kubernetes/pkg/controller/route" routecontroller "k8s.io/kubernetes/pkg/controller/route"
"k8s.io/kubernetes/pkg/controller/scheduledjob"
servicecontroller "k8s.io/kubernetes/pkg/controller/service" servicecontroller "k8s.io/kubernetes/pkg/controller/service"
serviceaccountcontroller "k8s.io/kubernetes/pkg/controller/serviceaccount" serviceaccountcontroller "k8s.io/kubernetes/pkg/controller/serviceaccount"
"k8s.io/kubernetes/pkg/controller/volume/attachdetach" "k8s.io/kubernetes/pkg/controller/volume/attachdetach"
...@@ -466,11 +466,11 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl ...@@ -466,11 +466,11 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
resources, found = resourceMap[groupVersion] resources, found = resourceMap[groupVersion]
if containsVersion(versions, groupVersion) && found { if containsVersion(versions, groupVersion) && found {
glog.Infof("Starting %s apis", groupVersion) glog.Infof("Starting %s apis", groupVersion)
if containsResource(resources, "scheduledjobs") { if containsResource(resources, "cronjobs") {
glog.Infof("Starting scheduledjob controller") glog.Infof("Starting cronjob controller")
// // TODO: this is a temp fix for allowing kubeClient list v2alpha1 sj, should switch to using clientset // // TODO: this is a temp fix for allowing kubeClient list v2alpha1 sj, should switch to using clientset
kubeconfig.ContentConfig.GroupVersion = &unversioned.GroupVersion{Group: batch.GroupName, Version: "v2alpha1"} kubeconfig.ContentConfig.GroupVersion = &unversioned.GroupVersion{Group: batch.GroupName, Version: "v2alpha1"}
go scheduledjob.NewScheduledJobController(client("scheduledjob-controller")). go cronjob.NewCronJobController(client("cronjob-controller")).
Run(wait.NeverStop) Run(wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
......
...@@ -83,11 +83,11 @@ func TestDefaulting(t *testing.T) { ...@@ -83,11 +83,11 @@ func TestDefaulting(t *testing.T) {
{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscalerList"}: {}, {Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscalerList"}: {},
{Group: "batch", Version: "v1", Kind: "Job"}: {}, {Group: "batch", Version: "v1", Kind: "Job"}: {},
{Group: "batch", Version: "v1", Kind: "JobList"}: {}, {Group: "batch", Version: "v1", Kind: "JobList"}: {},
{Group: "batch", Version: "v2alpha1", Kind: "CronJob"}: {},
{Group: "batch", Version: "v2alpha1", Kind: "CronJobList"}: {},
{Group: "batch", Version: "v2alpha1", Kind: "Job"}: {}, {Group: "batch", Version: "v2alpha1", Kind: "Job"}: {},
{Group: "batch", Version: "v2alpha1", Kind: "JobList"}: {}, {Group: "batch", Version: "v2alpha1", Kind: "JobList"}: {},
{Group: "batch", Version: "v2alpha1", Kind: "JobTemplate"}: {}, {Group: "batch", Version: "v2alpha1", Kind: "JobTemplate"}: {},
{Group: "batch", Version: "v2alpha1", Kind: "ScheduledJob"}: {},
{Group: "batch", Version: "v2alpha1", Kind: "ScheduledJobList"}: {},
{Group: "componentconfig", Version: "v1alpha1", Kind: "KubeProxyConfiguration"}: {}, {Group: "componentconfig", Version: "v1alpha1", Kind: "KubeProxyConfiguration"}: {},
{Group: "componentconfig", Version: "v1alpha1", Kind: "KubeSchedulerConfiguration"}: {}, {Group: "componentconfig", Version: "v1alpha1", Kind: "KubeSchedulerConfiguration"}: {},
{Group: "componentconfig", Version: "v1alpha1", Kind: "KubeletConfiguration"}: {}, {Group: "componentconfig", Version: "v1alpha1", Kind: "KubeletConfiguration"}: {},
......
...@@ -172,7 +172,7 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source) ...@@ -172,7 +172,7 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source)
j.ManualSelector = nil j.ManualSelector = nil
} }
}, },
func(sj *batch.ScheduledJobSpec, c fuzz.Continue) { func(sj *batch.CronJobSpec, c fuzz.Continue) {
c.FuzzNoCustom(sj) c.FuzzNoCustom(sj)
suspend := c.RandBool() suspend := c.RandBool()
sj.Suspend = &suspend sj.Suspend = &suspend
......
...@@ -49,8 +49,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { ...@@ -49,8 +49,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&Job{}, &Job{},
&JobList{}, &JobList{},
&JobTemplate{}, &JobTemplate{},
&ScheduledJob{}, &CronJob{},
&ScheduledJobList{}, &CronJobList{},
&api.ListOptions{}, &api.ListOptions{},
) )
return nil return nil
......
...@@ -190,8 +190,8 @@ type JobCondition struct { ...@@ -190,8 +190,8 @@ type JobCondition struct {
// +genclient=true // +genclient=true
// ScheduledJob represents the configuration of a single scheduled job. // CronJob represents the configuration of a single cron job.
type ScheduledJob struct { type CronJob struct {
unversioned.TypeMeta `json:",inline"` unversioned.TypeMeta `json:",inline"`
// Standard object's metadata. // Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
...@@ -201,28 +201,28 @@ type ScheduledJob struct { ...@@ -201,28 +201,28 @@ type ScheduledJob struct {
// Spec is a structure defining the expected behavior of a job, including the schedule. // Spec is a structure defining the expected behavior of a job, including the schedule.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +optional // +optional
Spec ScheduledJobSpec `json:"spec,omitempty"` Spec CronJobSpec `json:"spec,omitempty"`
// Status is a structure describing current status of a job. // Status is a structure describing current status of a job.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +optional // +optional
Status ScheduledJobStatus `json:"status,omitempty"` Status CronJobStatus `json:"status,omitempty"`
} }
// ScheduledJobList is a collection of scheduled jobs. // CronJobList is a collection of cron jobs.
type ScheduledJobList struct { type CronJobList struct {
unversioned.TypeMeta `json:",inline"` unversioned.TypeMeta `json:",inline"`
// Standard list metadata // Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional // +optional
unversioned.ListMeta `json:"metadata,omitempty"` unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of ScheduledJob. // Items is the list of CronJob.
Items []ScheduledJob `json:"items"` Items []CronJob `json:"items"`
} }
// ScheduledJobSpec describes how the job execution will look like and when it will actually run. // CronJobSpec describes how the job execution will look like and when it will actually run.
type ScheduledJobSpec struct { type CronJobSpec struct {
// Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. // Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
Schedule string `json:"schedule"` Schedule string `json:"schedule"`
...@@ -242,7 +242,7 @@ type ScheduledJobSpec struct { ...@@ -242,7 +242,7 @@ type ScheduledJobSpec struct {
Suspend *bool `json:"suspend,omitempty"` Suspend *bool `json:"suspend,omitempty"`
// JobTemplate is the object that describes the job that will be created when // JobTemplate is the object that describes the job that will be created when
// executing a ScheduledJob. // executing a CronJob.
JobTemplate JobTemplateSpec `json:"jobTemplate"` JobTemplate JobTemplateSpec `json:"jobTemplate"`
} }
...@@ -253,7 +253,7 @@ type ScheduledJobSpec struct { ...@@ -253,7 +253,7 @@ type ScheduledJobSpec struct {
type ConcurrencyPolicy string type ConcurrencyPolicy string
const ( const (
// AllowConcurrent allows ScheduledJobs to run concurrently. // AllowConcurrent allows CronJobs to run concurrently.
AllowConcurrent ConcurrencyPolicy = "Allow" AllowConcurrent ConcurrencyPolicy = "Allow"
// ForbidConcurrent forbids concurrent runs, skipping next run if previous // ForbidConcurrent forbids concurrent runs, skipping next run if previous
...@@ -264,8 +264,8 @@ const ( ...@@ -264,8 +264,8 @@ const (
ReplaceConcurrent ConcurrencyPolicy = "Replace" ReplaceConcurrent ConcurrencyPolicy = "Replace"
) )
// ScheduledJobStatus represents the current state of a Job. // CronJobStatus represents the current state of a cron job.
type ScheduledJobStatus struct { type CronJobStatus struct {
// Active holds pointers to currently running jobs. // Active holds pointers to currently running jobs.
// +optional // +optional
Active []api.ObjectReference `json:"active,omitempty"` Active []api.ObjectReference `json:"active,omitempty"`
......
...@@ -37,7 +37,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error { ...@@ -37,7 +37,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
} }
// Add field label conversions for kinds having selectable nothing but ObjectMeta fields. // Add field label conversions for kinds having selectable nothing but ObjectMeta fields.
for _, kind := range []string{"Job", "JobTemplate", "ScheduledJob"} { for _, kind := range []string{"Job", "JobTemplate", "CronJob"} {
err = api.Scheme.AddFieldLabelConversionFunc("batch/v2alpha1", kind, err = api.Scheme.AddFieldLabelConversionFunc("batch/v2alpha1", kind,
func(label, value string) (string, string, error) { func(label, value string) (string, string, error) {
switch label { switch label {
......
...@@ -24,7 +24,7 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error { ...@@ -24,7 +24,7 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
RegisterDefaults(scheme) RegisterDefaults(scheme)
return scheme.AddDefaultingFuncs( return scheme.AddDefaultingFuncs(
SetDefaults_Job, SetDefaults_Job,
SetDefaults_ScheduledJob, SetDefaults_CronJob,
) )
} }
...@@ -47,7 +47,7 @@ func SetDefaults_Job(obj *Job) { ...@@ -47,7 +47,7 @@ func SetDefaults_Job(obj *Job) {
} }
} }
func SetDefaults_ScheduledJob(obj *ScheduledJob) { func SetDefaults_CronJob(obj *CronJob) {
if obj.Spec.ConcurrencyPolicy == "" { if obj.Spec.ConcurrencyPolicy == "" {
obj.Spec.ConcurrencyPolicy = AllowConcurrent obj.Spec.ConcurrencyPolicy = AllowConcurrent
} }
......
...@@ -40,8 +40,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { ...@@ -40,8 +40,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&Job{}, &Job{},
&JobList{}, &JobList{},
&JobTemplate{}, &JobTemplate{},
&ScheduledJob{}, &CronJob{},
&ScheduledJobList{}, &CronJobList{},
&v1.ListOptions{}, &v1.ListOptions{},
&v1.DeleteOptions{}, &v1.DeleteOptions{},
) )
......
...@@ -196,8 +196,8 @@ type JobCondition struct { ...@@ -196,8 +196,8 @@ type JobCondition struct {
// +genclient=true // +genclient=true
// ScheduledJob represents the configuration of a single scheduled job. // CronJob represents the configuration of a single cron job.
type ScheduledJob struct { type CronJob struct {
unversioned.TypeMeta `json:",inline"` unversioned.TypeMeta `json:",inline"`
// Standard object's metadata. // Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
...@@ -207,28 +207,28 @@ type ScheduledJob struct { ...@@ -207,28 +207,28 @@ type ScheduledJob struct {
// Spec is a structure defining the expected behavior of a job, including the schedule. // Spec is a structure defining the expected behavior of a job, including the schedule.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +optional // +optional
Spec ScheduledJobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` Spec CronJobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Status is a structure describing current status of a job. // Status is a structure describing current status of a job.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +optional // +optional
Status ScheduledJobStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` Status CronJobStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
} }
// ScheduledJobList is a collection of scheduled jobs. // CronJobList is a collection of cron jobs.
type ScheduledJobList struct { type CronJobList struct {
unversioned.TypeMeta `json:",inline"` unversioned.TypeMeta `json:",inline"`
// Standard list metadata // Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional // +optional
unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Items is the list of ScheduledJob. // Items is the list of CronJob.
Items []ScheduledJob `json:"items" protobuf:"bytes,2,rep,name=items"` Items []CronJob `json:"items" protobuf:"bytes,2,rep,name=items"`
} }
// ScheduledJobSpec describes how the job execution will look like and when it will actually run. // CronJobSpec describes how the job execution will look like and when it will actually run.
type ScheduledJobSpec struct { type CronJobSpec struct {
// Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron. // Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"` Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
...@@ -248,7 +248,7 @@ type ScheduledJobSpec struct { ...@@ -248,7 +248,7 @@ type ScheduledJobSpec struct {
Suspend *bool `json:"suspend,omitempty" protobuf:"varint,4,opt,name=suspend"` Suspend *bool `json:"suspend,omitempty" protobuf:"varint,4,opt,name=suspend"`
// JobTemplate is the object that describes the job that will be created when // JobTemplate is the object that describes the job that will be created when
// executing a ScheduledJob. // executing a CronJob.
JobTemplate JobTemplateSpec `json:"jobTemplate" protobuf:"bytes,5,opt,name=jobTemplate"` JobTemplate JobTemplateSpec `json:"jobTemplate" protobuf:"bytes,5,opt,name=jobTemplate"`
} }
...@@ -259,7 +259,7 @@ type ScheduledJobSpec struct { ...@@ -259,7 +259,7 @@ type ScheduledJobSpec struct {
type ConcurrencyPolicy string type ConcurrencyPolicy string
const ( const (
// AllowConcurrent allows ScheduledJobs to run concurrently. // AllowConcurrent allows CronJobs to run concurrently.
AllowConcurrent ConcurrencyPolicy = "Allow" AllowConcurrent ConcurrencyPolicy = "Allow"
// ForbidConcurrent forbids concurrent runs, skipping next run if previous // ForbidConcurrent forbids concurrent runs, skipping next run if previous
...@@ -270,8 +270,8 @@ const ( ...@@ -270,8 +270,8 @@ const (
ReplaceConcurrent ConcurrencyPolicy = "Replace" ReplaceConcurrent ConcurrencyPolicy = "Replace"
) )
// ScheduledJobStatus represents the current state of a Job. // CronJobStatus represents the current state of a cron job.
type ScheduledJobStatus struct { type CronJobStatus struct {
// Active holds pointers to currently running jobs. // Active holds pointers to currently running jobs.
// +optional // +optional
Active []v1.ObjectReference `json:"active,omitempty" protobuf:"bytes,1,rep,name=active"` Active []v1.ObjectReference `json:"active,omitempty" protobuf:"bytes,1,rep,name=active"`
......
...@@ -110,48 +110,48 @@ func (JobTemplateSpec) SwaggerDoc() map[string]string { ...@@ -110,48 +110,48 @@ func (JobTemplateSpec) SwaggerDoc() map[string]string {
return map_JobTemplateSpec return map_JobTemplateSpec
} }
var map_ScheduledJob = map[string]string{ var map_CronJob = map[string]string{
"": "ScheduledJob represents the configuration of a single scheduled job.", "": "CronJob represents the configuration of a single scheduled job.",
"metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", "metadata": "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
"spec": "Spec is a structure defining the expected behavior of a job, including the schedule. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status", "spec": "Spec is a structure defining the expected behavior of a job, including the schedule. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status",
"status": "Status is a structure describing current status of a job. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status", "status": "Status is a structure describing current status of a job. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status",
} }
func (ScheduledJob) SwaggerDoc() map[string]string { func (CronJob) SwaggerDoc() map[string]string {
return map_ScheduledJob return map_CronJob
} }
var map_ScheduledJobList = map[string]string{ var map_CronJobList = map[string]string{
"": "ScheduledJobList is a collection of scheduled jobs.", "": "CronJobList is a collection of scheduled jobs.",
"metadata": "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata", "metadata": "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
"items": "Items is the list of ScheduledJob.", "items": "Items is the list of CronJob.",
} }
func (ScheduledJobList) SwaggerDoc() map[string]string { func (CronJobList) SwaggerDoc() map[string]string {
return map_ScheduledJobList return map_CronJobList
} }
var map_ScheduledJobSpec = map[string]string{ var map_CronJobSpec = map[string]string{
"": "ScheduledJobSpec describes how the job execution will look like and when it will actually run.", "": "CronJobSpec describes how the job execution will look like and when it will actually run.",
"schedule": "Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.", "schedule": "Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.",
"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.", "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.",
"concurrencyPolicy": "ConcurrencyPolicy specifies how to treat concurrent executions of a Job.", "concurrencyPolicy": "ConcurrencyPolicy specifies how to treat concurrent executions of a Job.",
"suspend": "Suspend flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.", "suspend": "Suspend flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.",
"jobTemplate": "JobTemplate is the object that describes the job that will be created when executing a ScheduledJob.", "jobTemplate": "JobTemplate is the object that describes the job that will be created when executing a CronJob.",
} }
func (ScheduledJobSpec) SwaggerDoc() map[string]string { func (CronJobSpec) SwaggerDoc() map[string]string {
return map_ScheduledJobSpec return map_CronJobSpec
} }
var map_ScheduledJobStatus = map[string]string{ var map_CronJobStatus = map[string]string{
"": "ScheduledJobStatus represents the current state of a Job.", "": "CronJobStatus represents the current state of a Job.",
"active": "Active holds pointers to currently running jobs.", "active": "Active holds pointers to currently running jobs.",
"lastScheduleTime": "LastScheduleTime keeps information of when was the last time the job was successfully scheduled.", "lastScheduleTime": "LastScheduleTime keeps information of when was the last time the job was successfully scheduled.",
} }
func (ScheduledJobStatus) SwaggerDoc() map[string]string { func (CronJobStatus) SwaggerDoc() map[string]string {
return map_ScheduledJobStatus return map_CronJobStatus
} }
// AUTO-GENERATED FUNCTIONS END HERE // AUTO-GENERATED FUNCTIONS END HERE
...@@ -36,6 +36,10 @@ func init() { ...@@ -36,6 +36,10 @@ func init() {
// to allow building arbitrary schemes. // to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error { func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs( return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_CronJob, InType: reflect.TypeOf(&CronJob{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_CronJobList, InType: reflect.TypeOf(&CronJobList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_CronJobSpec, InType: reflect.TypeOf(&CronJobSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_CronJobStatus, InType: reflect.TypeOf(&CronJobStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_Job, InType: reflect.TypeOf(&Job{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_Job, InType: reflect.TypeOf(&Job{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobCondition, InType: reflect.TypeOf(&JobCondition{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobCondition, InType: reflect.TypeOf(&JobCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobList, InType: reflect.TypeOf(&JobList{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobList, InType: reflect.TypeOf(&JobList{})},
...@@ -43,13 +47,99 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { ...@@ -43,13 +47,99 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobStatus, InType: reflect.TypeOf(&JobStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobStatus, InType: reflect.TypeOf(&JobStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobTemplate, InType: reflect.TypeOf(&JobTemplate{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobTemplate, InType: reflect.TypeOf(&JobTemplate{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobTemplateSpec, InType: reflect.TypeOf(&JobTemplateSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobTemplateSpec, InType: reflect.TypeOf(&JobTemplateSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_ScheduledJob, InType: reflect.TypeOf(&ScheduledJob{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_ScheduledJobList, InType: reflect.TypeOf(&ScheduledJobList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_ScheduledJobSpec, InType: reflect.TypeOf(&ScheduledJobSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_ScheduledJobStatus, InType: reflect.TypeOf(&ScheduledJobStatus{})},
) )
} }
func DeepCopy_v2alpha1_CronJob(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*CronJob)
out := out.(*CronJob)
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_v2alpha1_CronJobSpec(&in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_v2alpha1_CronJobStatus(&in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_v2alpha1_CronJobList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*CronJobList)
out := out.(*CronJobList)
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]CronJob, len(*in))
for i := range *in {
if err := DeepCopy_v2alpha1_CronJob(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
}
func DeepCopy_v2alpha1_CronJobSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*CronJobSpec)
out := out.(*CronJobSpec)
out.Schedule = in.Schedule
if in.StartingDeadlineSeconds != nil {
in, out := &in.StartingDeadlineSeconds, &out.StartingDeadlineSeconds
*out = new(int64)
**out = **in
} else {
out.StartingDeadlineSeconds = nil
}
out.ConcurrencyPolicy = in.ConcurrencyPolicy
if in.Suspend != nil {
in, out := &in.Suspend, &out.Suspend
*out = new(bool)
**out = **in
} else {
out.Suspend = nil
}
if err := DeepCopy_v2alpha1_JobTemplateSpec(&in.JobTemplate, &out.JobTemplate, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_v2alpha1_CronJobStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*CronJobStatus)
out := out.(*CronJobStatus)
if in.Active != nil {
in, out := &in.Active, &out.Active
*out = make([]v1.ObjectReference, len(*in))
for i := range *in {
(*out)[i] = (*in)[i]
}
} else {
out.Active = nil
}
if in.LastScheduleTime != nil {
in, out := &in.LastScheduleTime, &out.LastScheduleTime
*out = new(unversioned.Time)
**out = (*in).DeepCopy()
} else {
out.LastScheduleTime = nil
}
return nil
}
}
func DeepCopy_v2alpha1_Job(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_v2alpha1_Job(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*Job) in := in.(*Job)
...@@ -215,93 +305,3 @@ func DeepCopy_v2alpha1_JobTemplateSpec(in interface{}, out interface{}, c *conve ...@@ -215,93 +305,3 @@ func DeepCopy_v2alpha1_JobTemplateSpec(in interface{}, out interface{}, c *conve
return nil return nil
} }
} }
func DeepCopy_v2alpha1_ScheduledJob(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScheduledJob)
out := out.(*ScheduledJob)
out.TypeMeta = in.TypeMeta
if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_v2alpha1_ScheduledJobSpec(&in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_v2alpha1_ScheduledJobStatus(&in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_v2alpha1_ScheduledJobList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScheduledJobList)
out := out.(*ScheduledJobList)
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ScheduledJob, len(*in))
for i := range *in {
if err := DeepCopy_v2alpha1_ScheduledJob(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
}
func DeepCopy_v2alpha1_ScheduledJobSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScheduledJobSpec)
out := out.(*ScheduledJobSpec)
out.Schedule = in.Schedule
if in.StartingDeadlineSeconds != nil {
in, out := &in.StartingDeadlineSeconds, &out.StartingDeadlineSeconds
*out = new(int64)
**out = **in
} else {
out.StartingDeadlineSeconds = nil
}
out.ConcurrencyPolicy = in.ConcurrencyPolicy
if in.Suspend != nil {
in, out := &in.Suspend, &out.Suspend
*out = new(bool)
**out = **in
} else {
out.Suspend = nil
}
if err := DeepCopy_v2alpha1_JobTemplateSpec(&in.JobTemplate, &out.JobTemplate, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_v2alpha1_ScheduledJobStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScheduledJobStatus)
out := out.(*ScheduledJobStatus)
if in.Active != nil {
in, out := &in.Active, &out.Active
*out = make([]v1.ObjectReference, len(*in))
for i := range *in {
(*out)[i] = (*in)[i]
}
} else {
out.Active = nil
}
if in.LastScheduleTime != nil {
in, out := &in.LastScheduleTime, &out.LastScheduleTime
*out = new(unversioned.Time)
**out = (*in).DeepCopy()
} else {
out.LastScheduleTime = nil
}
return nil
}
}
...@@ -29,19 +29,19 @@ import ( ...@@ -29,19 +29,19 @@ import (
// Public to allow building arbitrary schemes. // Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters. // All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error { func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&CronJob{}, func(obj interface{}) { SetObjectDefaults_CronJob(obj.(*CronJob)) })
scheme.AddTypeDefaultingFunc(&CronJobList{}, func(obj interface{}) { SetObjectDefaults_CronJobList(obj.(*CronJobList)) })
scheme.AddTypeDefaultingFunc(&Job{}, func(obj interface{}) { SetObjectDefaults_Job(obj.(*Job)) }) scheme.AddTypeDefaultingFunc(&Job{}, func(obj interface{}) { SetObjectDefaults_Job(obj.(*Job)) })
scheme.AddTypeDefaultingFunc(&JobList{}, func(obj interface{}) { SetObjectDefaults_JobList(obj.(*JobList)) }) scheme.AddTypeDefaultingFunc(&JobList{}, func(obj interface{}) { SetObjectDefaults_JobList(obj.(*JobList)) })
scheme.AddTypeDefaultingFunc(&JobTemplate{}, func(obj interface{}) { SetObjectDefaults_JobTemplate(obj.(*JobTemplate)) }) scheme.AddTypeDefaultingFunc(&JobTemplate{}, func(obj interface{}) { SetObjectDefaults_JobTemplate(obj.(*JobTemplate)) })
scheme.AddTypeDefaultingFunc(&ScheduledJob{}, func(obj interface{}) { SetObjectDefaults_ScheduledJob(obj.(*ScheduledJob)) })
scheme.AddTypeDefaultingFunc(&ScheduledJobList{}, func(obj interface{}) { SetObjectDefaults_ScheduledJobList(obj.(*ScheduledJobList)) })
return nil return nil
} }
func SetObjectDefaults_Job(in *Job) { func SetObjectDefaults_CronJob(in *CronJob) {
SetDefaults_Job(in) SetDefaults_CronJob(in)
v1.SetDefaults_PodSpec(&in.Spec.Template.Spec) v1.SetDefaults_PodSpec(&in.Spec.JobTemplate.Spec.Template.Spec)
for i := range in.Spec.Template.Spec.Volumes { for i := range in.Spec.JobTemplate.Spec.Template.Spec.Volumes {
a := &in.Spec.Template.Spec.Volumes[i] a := &in.Spec.JobTemplate.Spec.Template.Spec.Volumes[i]
v1.SetDefaults_Volume(a) v1.SetDefaults_Volume(a)
if a.VolumeSource.Secret != nil { if a.VolumeSource.Secret != nil {
v1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret) v1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret)
...@@ -68,8 +68,8 @@ func SetObjectDefaults_Job(in *Job) { ...@@ -68,8 +68,8 @@ func SetObjectDefaults_Job(in *Job) {
v1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk) v1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk)
} }
} }
for i := range in.Spec.Template.Spec.InitContainers { for i := range in.Spec.JobTemplate.Spec.Template.Spec.InitContainers {
a := &in.Spec.Template.Spec.InitContainers[i] a := &in.Spec.JobTemplate.Spec.Template.Spec.InitContainers[i]
v1.SetDefaults_Container(a) v1.SetDefaults_Container(a)
for j := range a.Ports { for j := range a.Ports {
b := &a.Ports[j] b := &a.Ports[j]
...@@ -110,8 +110,8 @@ func SetObjectDefaults_Job(in *Job) { ...@@ -110,8 +110,8 @@ func SetObjectDefaults_Job(in *Job) {
} }
} }
} }
for i := range in.Spec.Template.Spec.Containers { for i := range in.Spec.JobTemplate.Spec.Template.Spec.Containers {
a := &in.Spec.Template.Spec.Containers[i] a := &in.Spec.JobTemplate.Spec.Template.Spec.Containers[i]
v1.SetDefaults_Container(a) v1.SetDefaults_Container(a)
for j := range a.Ports { for j := range a.Ports {
b := &a.Ports[j] b := &a.Ports[j]
...@@ -154,17 +154,18 @@ func SetObjectDefaults_Job(in *Job) { ...@@ -154,17 +154,18 @@ func SetObjectDefaults_Job(in *Job) {
} }
} }
func SetObjectDefaults_JobList(in *JobList) { func SetObjectDefaults_CronJobList(in *CronJobList) {
for i := range in.Items { for i := range in.Items {
a := &in.Items[i] a := &in.Items[i]
SetObjectDefaults_Job(a) SetObjectDefaults_CronJob(a)
} }
} }
func SetObjectDefaults_JobTemplate(in *JobTemplate) { func SetObjectDefaults_Job(in *Job) {
v1.SetDefaults_PodSpec(&in.Template.Spec.Template.Spec) SetDefaults_Job(in)
for i := range in.Template.Spec.Template.Spec.Volumes { v1.SetDefaults_PodSpec(&in.Spec.Template.Spec)
a := &in.Template.Spec.Template.Spec.Volumes[i] for i := range in.Spec.Template.Spec.Volumes {
a := &in.Spec.Template.Spec.Volumes[i]
v1.SetDefaults_Volume(a) v1.SetDefaults_Volume(a)
if a.VolumeSource.Secret != nil { if a.VolumeSource.Secret != nil {
v1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret) v1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret)
...@@ -191,8 +192,8 @@ func SetObjectDefaults_JobTemplate(in *JobTemplate) { ...@@ -191,8 +192,8 @@ func SetObjectDefaults_JobTemplate(in *JobTemplate) {
v1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk) v1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk)
} }
} }
for i := range in.Template.Spec.Template.Spec.InitContainers { for i := range in.Spec.Template.Spec.InitContainers {
a := &in.Template.Spec.Template.Spec.InitContainers[i] a := &in.Spec.Template.Spec.InitContainers[i]
v1.SetDefaults_Container(a) v1.SetDefaults_Container(a)
for j := range a.Ports { for j := range a.Ports {
b := &a.Ports[j] b := &a.Ports[j]
...@@ -233,8 +234,8 @@ func SetObjectDefaults_JobTemplate(in *JobTemplate) { ...@@ -233,8 +234,8 @@ func SetObjectDefaults_JobTemplate(in *JobTemplate) {
} }
} }
} }
for i := range in.Template.Spec.Template.Spec.Containers { for i := range in.Spec.Template.Spec.Containers {
a := &in.Template.Spec.Template.Spec.Containers[i] a := &in.Spec.Template.Spec.Containers[i]
v1.SetDefaults_Container(a) v1.SetDefaults_Container(a)
for j := range a.Ports { for j := range a.Ports {
b := &a.Ports[j] b := &a.Ports[j]
...@@ -277,11 +278,17 @@ func SetObjectDefaults_JobTemplate(in *JobTemplate) { ...@@ -277,11 +278,17 @@ func SetObjectDefaults_JobTemplate(in *JobTemplate) {
} }
} }
func SetObjectDefaults_ScheduledJob(in *ScheduledJob) { func SetObjectDefaults_JobList(in *JobList) {
SetDefaults_ScheduledJob(in) for i := range in.Items {
v1.SetDefaults_PodSpec(&in.Spec.JobTemplate.Spec.Template.Spec) a := &in.Items[i]
for i := range in.Spec.JobTemplate.Spec.Template.Spec.Volumes { SetObjectDefaults_Job(a)
a := &in.Spec.JobTemplate.Spec.Template.Spec.Volumes[i] }
}
func SetObjectDefaults_JobTemplate(in *JobTemplate) {
v1.SetDefaults_PodSpec(&in.Template.Spec.Template.Spec)
for i := range in.Template.Spec.Template.Spec.Volumes {
a := &in.Template.Spec.Template.Spec.Volumes[i]
v1.SetDefaults_Volume(a) v1.SetDefaults_Volume(a)
if a.VolumeSource.Secret != nil { if a.VolumeSource.Secret != nil {
v1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret) v1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret)
...@@ -308,8 +315,8 @@ func SetObjectDefaults_ScheduledJob(in *ScheduledJob) { ...@@ -308,8 +315,8 @@ func SetObjectDefaults_ScheduledJob(in *ScheduledJob) {
v1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk) v1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk)
} }
} }
for i := range in.Spec.JobTemplate.Spec.Template.Spec.InitContainers { for i := range in.Template.Spec.Template.Spec.InitContainers {
a := &in.Spec.JobTemplate.Spec.Template.Spec.InitContainers[i] a := &in.Template.Spec.Template.Spec.InitContainers[i]
v1.SetDefaults_Container(a) v1.SetDefaults_Container(a)
for j := range a.Ports { for j := range a.Ports {
b := &a.Ports[j] b := &a.Ports[j]
...@@ -350,8 +357,8 @@ func SetObjectDefaults_ScheduledJob(in *ScheduledJob) { ...@@ -350,8 +357,8 @@ func SetObjectDefaults_ScheduledJob(in *ScheduledJob) {
} }
} }
} }
for i := range in.Spec.JobTemplate.Spec.Template.Spec.Containers { for i := range in.Template.Spec.Template.Spec.Containers {
a := &in.Spec.JobTemplate.Spec.Template.Spec.Containers[i] a := &in.Template.Spec.Template.Spec.Containers[i]
v1.SetDefaults_Container(a) v1.SetDefaults_Container(a)
for j := range a.Ports { for j := range a.Ports {
b := &a.Ports[j] b := &a.Ports[j]
...@@ -393,10 +400,3 @@ func SetObjectDefaults_ScheduledJob(in *ScheduledJob) { ...@@ -393,10 +400,3 @@ func SetObjectDefaults_ScheduledJob(in *ScheduledJob) {
} }
} }
} }
func SetObjectDefaults_ScheduledJobList(in *ScheduledJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_ScheduledJob(a)
}
}
...@@ -158,14 +158,14 @@ func ValidateJobStatusUpdate(status, oldStatus batch.JobStatus) field.ErrorList ...@@ -158,14 +158,14 @@ func ValidateJobStatusUpdate(status, oldStatus batch.JobStatus) field.ErrorList
return allErrs return allErrs
} }
func ValidateScheduledJob(scheduledJob *batch.ScheduledJob) field.ErrorList { func ValidateCronJob(scheduledJob *batch.CronJob) field.ErrorList {
// ScheduledJobs and rcs have the same name validation // CronJobs and rcs have the same name validation
allErrs := apivalidation.ValidateObjectMeta(&scheduledJob.ObjectMeta, true, apivalidation.ValidateReplicationControllerName, field.NewPath("metadata")) allErrs := apivalidation.ValidateObjectMeta(&scheduledJob.ObjectMeta, true, apivalidation.ValidateReplicationControllerName, field.NewPath("metadata"))
allErrs = append(allErrs, ValidateScheduledJobSpec(&scheduledJob.Spec, field.NewPath("spec"))...) allErrs = append(allErrs, ValidateCronJobSpec(&scheduledJob.Spec, field.NewPath("spec"))...)
return allErrs return allErrs
} }
func ValidateScheduledJobSpec(spec *batch.ScheduledJobSpec, fldPath *field.Path) field.ErrorList { func ValidateCronJobSpec(spec *batch.CronJobSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{} allErrs := field.ErrorList{}
if len(spec.Schedule) == 0 { if len(spec.Schedule) == 0 {
......
...@@ -304,19 +304,19 @@ func TestValidateJobUpdateStatus(t *testing.T) { ...@@ -304,19 +304,19 @@ func TestValidateJobUpdateStatus(t *testing.T) {
} }
} }
func TestValidateScheduledJob(t *testing.T) { func TestValidateCronJob(t *testing.T) {
validManualSelector := getValidManualSelector() validManualSelector := getValidManualSelector()
validPodTemplateSpec := getValidPodTemplateSpecForGenerated(getValidGeneratedSelector()) validPodTemplateSpec := getValidPodTemplateSpecForGenerated(getValidGeneratedSelector())
validPodTemplateSpec.Labels = map[string]string{} validPodTemplateSpec.Labels = map[string]string{}
successCases := map[string]batch.ScheduledJob{ successCases := map[string]batch.CronJob{
"basic scheduled job": { "basic scheduled job": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -328,11 +328,11 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -328,11 +328,11 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
"non-standard scheduled": { "non-standard scheduled": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "@hourly", Schedule: "@hourly",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -344,7 +344,7 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -344,7 +344,7 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
} }
for k, v := range successCases { for k, v := range successCases {
if errs := ValidateScheduledJob(&v); len(errs) != 0 { if errs := ValidateCronJob(&v); len(errs) != 0 {
t.Errorf("expected success for %s: %v", k, errs) t.Errorf("expected success for %s: %v", k, errs)
} }
} }
...@@ -352,14 +352,14 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -352,14 +352,14 @@ func TestValidateScheduledJob(t *testing.T) {
negative := int32(-1) negative := int32(-1)
negative64 := int64(-1) negative64 := int64(-1)
errorCases := map[string]batch.ScheduledJob{ errorCases := map[string]batch.CronJob{
"spec.schedule: Invalid value": { "spec.schedule: Invalid value": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "error", Schedule: "error",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -371,11 +371,11 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -371,11 +371,11 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
"spec.schedule: Required value": { "spec.schedule: Required value": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "", Schedule: "",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -387,11 +387,11 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -387,11 +387,11 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
"spec.startingDeadlineSeconds:must be greater than or equal to 0": { "spec.startingDeadlineSeconds:must be greater than or equal to 0": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
StartingDeadlineSeconds: &negative64, StartingDeadlineSeconds: &negative64,
...@@ -404,11 +404,11 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -404,11 +404,11 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
"spec.concurrencyPolicy: Required value": { "spec.concurrencyPolicy: Required value": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
Spec: batch.JobSpec{ Spec: batch.JobSpec{
...@@ -419,11 +419,11 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -419,11 +419,11 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
"spec.jobTemplate.spec.parallelism:must be greater than or equal to 0": { "spec.jobTemplate.spec.parallelism:must be greater than or equal to 0": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -436,11 +436,11 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -436,11 +436,11 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
"spec.jobTemplate.spec.completions:must be greater than or equal to 0": { "spec.jobTemplate.spec.completions:must be greater than or equal to 0": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -454,11 +454,11 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -454,11 +454,11 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
"spec.jobTemplate.spec.activeDeadlineSeconds:must be greater than or equal to 0": { "spec.jobTemplate.spec.activeDeadlineSeconds:must be greater than or equal to 0": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -471,11 +471,11 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -471,11 +471,11 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
"spec.jobTemplate.spec.selector: Invalid value: {\"matchLabels\":{\"a\":\"b\"}}: `selector` will be auto-generated": { "spec.jobTemplate.spec.selector: Invalid value: {\"matchLabels\":{\"a\":\"b\"}}: `selector` will be auto-generated": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -488,11 +488,11 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -488,11 +488,11 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
"spec.jobTemplate.spec.manualSelector: Unsupported value": { "spec.jobTemplate.spec.manualSelector: Unsupported value": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -505,11 +505,11 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -505,11 +505,11 @@ func TestValidateScheduledJob(t *testing.T) {
}, },
"spec.jobTemplate.spec.template.spec.restartPolicy: Unsupported value": { "spec.jobTemplate.spec.template.spec.restartPolicy: Unsupported value": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -528,7 +528,7 @@ func TestValidateScheduledJob(t *testing.T) { ...@@ -528,7 +528,7 @@ func TestValidateScheduledJob(t *testing.T) {
} }
for k, v := range errorCases { for k, v := range errorCases {
errs := ValidateScheduledJob(&v) errs := ValidateCronJob(&v)
if len(errs) == 0 { if len(errs) == 0 {
t.Errorf("expected failure for %s", k) t.Errorf("expected failure for %s", k)
} else { } else {
......
...@@ -36,6 +36,10 @@ func init() { ...@@ -36,6 +36,10 @@ func init() {
// to allow building arbitrary schemes. // to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error { func RegisterDeepCopies(scheme *runtime.Scheme) error {
return scheme.AddGeneratedDeepCopyFuncs( return scheme.AddGeneratedDeepCopyFuncs(
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_CronJob, InType: reflect.TypeOf(&CronJob{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_CronJobList, InType: reflect.TypeOf(&CronJobList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_CronJobSpec, InType: reflect.TypeOf(&CronJobSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_CronJobStatus, InType: reflect.TypeOf(&CronJobStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_Job, InType: reflect.TypeOf(&Job{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_Job, InType: reflect.TypeOf(&Job{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobCondition, InType: reflect.TypeOf(&JobCondition{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobCondition, InType: reflect.TypeOf(&JobCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobList, InType: reflect.TypeOf(&JobList{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobList, InType: reflect.TypeOf(&JobList{})},
...@@ -43,13 +47,99 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error { ...@@ -43,13 +47,99 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobStatus, InType: reflect.TypeOf(&JobStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobStatus, InType: reflect.TypeOf(&JobStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobTemplate, InType: reflect.TypeOf(&JobTemplate{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobTemplate, InType: reflect.TypeOf(&JobTemplate{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobTemplateSpec, InType: reflect.TypeOf(&JobTemplateSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobTemplateSpec, InType: reflect.TypeOf(&JobTemplateSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_ScheduledJob, InType: reflect.TypeOf(&ScheduledJob{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_ScheduledJobList, InType: reflect.TypeOf(&ScheduledJobList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_ScheduledJobSpec, InType: reflect.TypeOf(&ScheduledJobSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_ScheduledJobStatus, InType: reflect.TypeOf(&ScheduledJobStatus{})},
) )
} }
func DeepCopy_batch_CronJob(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*CronJob)
out := out.(*CronJob)
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_batch_CronJobSpec(&in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_batch_CronJobStatus(&in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_batch_CronJobList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*CronJobList)
out := out.(*CronJobList)
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]CronJob, len(*in))
for i := range *in {
if err := DeepCopy_batch_CronJob(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
}
func DeepCopy_batch_CronJobSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*CronJobSpec)
out := out.(*CronJobSpec)
out.Schedule = in.Schedule
if in.StartingDeadlineSeconds != nil {
in, out := &in.StartingDeadlineSeconds, &out.StartingDeadlineSeconds
*out = new(int64)
**out = **in
} else {
out.StartingDeadlineSeconds = nil
}
out.ConcurrencyPolicy = in.ConcurrencyPolicy
if in.Suspend != nil {
in, out := &in.Suspend, &out.Suspend
*out = new(bool)
**out = **in
} else {
out.Suspend = nil
}
if err := DeepCopy_batch_JobTemplateSpec(&in.JobTemplate, &out.JobTemplate, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_batch_CronJobStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*CronJobStatus)
out := out.(*CronJobStatus)
if in.Active != nil {
in, out := &in.Active, &out.Active
*out = make([]api.ObjectReference, len(*in))
for i := range *in {
(*out)[i] = (*in)[i]
}
} else {
out.Active = nil
}
if in.LastScheduleTime != nil {
in, out := &in.LastScheduleTime, &out.LastScheduleTime
*out = new(unversioned.Time)
**out = (*in).DeepCopy()
} else {
out.LastScheduleTime = nil
}
return nil
}
}
func DeepCopy_batch_Job(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_batch_Job(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*Job) in := in.(*Job)
...@@ -215,93 +305,3 @@ func DeepCopy_batch_JobTemplateSpec(in interface{}, out interface{}, c *conversi ...@@ -215,93 +305,3 @@ func DeepCopy_batch_JobTemplateSpec(in interface{}, out interface{}, c *conversi
return nil return nil
} }
} }
func DeepCopy_batch_ScheduledJob(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScheduledJob)
out := out.(*ScheduledJob)
out.TypeMeta = in.TypeMeta
if err := api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil {
return err
}
if err := DeepCopy_batch_ScheduledJobSpec(&in.Spec, &out.Spec, c); err != nil {
return err
}
if err := DeepCopy_batch_ScheduledJobStatus(&in.Status, &out.Status, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_batch_ScheduledJobList(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScheduledJobList)
out := out.(*ScheduledJobList)
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ScheduledJob, len(*in))
for i := range *in {
if err := DeepCopy_batch_ScheduledJob(&(*in)[i], &(*out)[i], c); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
}
func DeepCopy_batch_ScheduledJobSpec(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScheduledJobSpec)
out := out.(*ScheduledJobSpec)
out.Schedule = in.Schedule
if in.StartingDeadlineSeconds != nil {
in, out := &in.StartingDeadlineSeconds, &out.StartingDeadlineSeconds
*out = new(int64)
**out = **in
} else {
out.StartingDeadlineSeconds = nil
}
out.ConcurrencyPolicy = in.ConcurrencyPolicy
if in.Suspend != nil {
in, out := &in.Suspend, &out.Suspend
*out = new(bool)
**out = **in
} else {
out.Suspend = nil
}
if err := DeepCopy_batch_JobTemplateSpec(&in.JobTemplate, &out.JobTemplate, c); err != nil {
return err
}
return nil
}
}
func DeepCopy_batch_ScheduledJobStatus(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*ScheduledJobStatus)
out := out.(*ScheduledJobStatus)
if in.Active != nil {
in, out := &in.Active, &out.Active
*out = make([]api.ObjectReference, len(*in))
for i := range *in {
(*out)[i] = (*in)[i]
}
} else {
out.Active = nil
}
if in.LastScheduleTime != nil {
in, out := &in.LastScheduleTime, &out.LastScheduleTime
*out = new(unversioned.Time)
**out = (*in).DeepCopy()
} else {
out.LastScheduleTime = nil
}
return nil
}
}
...@@ -14,10 +14,10 @@ go_library( ...@@ -14,10 +14,10 @@ go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"batch_client.go", "batch_client.go",
"cronjob.go",
"doc.go", "doc.go",
"generated_expansion.go", "generated_expansion.go",
"job.go", "job.go",
"scheduledjob.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
......
...@@ -25,7 +25,7 @@ import ( ...@@ -25,7 +25,7 @@ import (
type BatchInterface interface { type BatchInterface interface {
RESTClient() restclient.Interface RESTClient() restclient.Interface
JobsGetter JobsGetter
ScheduledJobsGetter CronJobsGetter
} }
// BatchClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. // BatchClient is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group.
...@@ -37,8 +37,8 @@ func (c *BatchClient) Jobs(namespace string) JobInterface { ...@@ -37,8 +37,8 @@ func (c *BatchClient) Jobs(namespace string) JobInterface {
return newJobs(c, namespace) return newJobs(c, namespace)
} }
func (c *BatchClient) ScheduledJobs(namespace string) ScheduledJobInterface { func (c *BatchClient) CronJobs(namespace string) CronJobInterface {
return newScheduledJobs(c, namespace) return newCronJobs(c, namespace)
} }
// NewForConfig creates a new BatchClient for the given config. // NewForConfig creates a new BatchClient for the given config.
......
...@@ -23,34 +23,34 @@ import ( ...@@ -23,34 +23,34 @@ import (
watch "k8s.io/kubernetes/pkg/watch" watch "k8s.io/kubernetes/pkg/watch"
) )
// ScheduledJobsGetter has a method to return a ScheduledJobInterface. // CronJobsGetter has a method to return a CronJobInterface.
// A group's client should implement this interface. // A group's client should implement this interface.
type ScheduledJobsGetter interface { type CronJobsGetter interface {
ScheduledJobs(namespace string) ScheduledJobInterface CronJobs(namespace string) CronJobInterface
} }
// ScheduledJobInterface has methods to work with ScheduledJob resources. // CronJobInterface has methods to work with CronJob resources.
type ScheduledJobInterface interface { type CronJobInterface interface {
Create(*batch.ScheduledJob) (*batch.ScheduledJob, error) Create(*batch.CronJob) (*batch.CronJob, error)
Update(*batch.ScheduledJob) (*batch.ScheduledJob, error) Update(*batch.CronJob) (*batch.CronJob, error)
UpdateStatus(*batch.ScheduledJob) (*batch.ScheduledJob, error) UpdateStatus(*batch.CronJob) (*batch.CronJob, error)
Delete(name string, options *api.DeleteOptions) error Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*batch.ScheduledJob, error) Get(name string) (*batch.CronJob, error)
List(opts api.ListOptions) (*batch.ScheduledJobList, error) List(opts api.ListOptions) (*batch.CronJobList, error)
Watch(opts api.ListOptions) (watch.Interface, error) Watch(opts api.ListOptions) (watch.Interface, error)
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *batch.ScheduledJob, err error) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *batch.CronJob, err error)
ScheduledJobExpansion CronJobExpansion
} }
// scheduledJobs implements ScheduledJobInterface // scheduledJobs implements CronJobInterface
type scheduledJobs struct { type scheduledJobs struct {
client restclient.Interface client restclient.Interface
ns string ns string
} }
// newScheduledJobs returns a ScheduledJobs // newCronJobs returns a CronJobs
func newScheduledJobs(c *BatchClient, namespace string) *scheduledJobs { func newCronJobs(c *BatchClient, namespace string) *scheduledJobs {
return &scheduledJobs{ return &scheduledJobs{
client: c.RESTClient(), client: c.RESTClient(),
ns: namespace, ns: namespace,
...@@ -58,11 +58,11 @@ func newScheduledJobs(c *BatchClient, namespace string) *scheduledJobs { ...@@ -58,11 +58,11 @@ func newScheduledJobs(c *BatchClient, namespace string) *scheduledJobs {
} }
// Create takes the representation of a scheduledJob and creates it. Returns the server's representation of the scheduledJob, and an error, if there is any. // Create takes the representation of a scheduledJob and creates it. Returns the server's representation of the scheduledJob, and an error, if there is any.
func (c *scheduledJobs) Create(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) { func (c *scheduledJobs) Create(scheduledJob *batch.CronJob) (result *batch.CronJob, err error) {
result = &batch.ScheduledJob{} result = &batch.CronJob{}
err = c.client.Post(). err = c.client.Post().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
Body(scheduledJob). Body(scheduledJob).
Do(). Do().
Into(result) Into(result)
...@@ -70,11 +70,11 @@ func (c *scheduledJobs) Create(scheduledJob *batch.ScheduledJob) (result *batch. ...@@ -70,11 +70,11 @@ func (c *scheduledJobs) Create(scheduledJob *batch.ScheduledJob) (result *batch.
} }
// Update takes the representation of a scheduledJob and updates it. Returns the server's representation of the scheduledJob, and an error, if there is any. // Update takes the representation of a scheduledJob and updates it. Returns the server's representation of the scheduledJob, and an error, if there is any.
func (c *scheduledJobs) Update(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) { func (c *scheduledJobs) Update(scheduledJob *batch.CronJob) (result *batch.CronJob, err error) {
result = &batch.ScheduledJob{} result = &batch.CronJob{}
err = c.client.Put(). err = c.client.Put().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
Name(scheduledJob.Name). Name(scheduledJob.Name).
Body(scheduledJob). Body(scheduledJob).
Do(). Do().
...@@ -82,11 +82,11 @@ func (c *scheduledJobs) Update(scheduledJob *batch.ScheduledJob) (result *batch. ...@@ -82,11 +82,11 @@ func (c *scheduledJobs) Update(scheduledJob *batch.ScheduledJob) (result *batch.
return return
} }
func (c *scheduledJobs) UpdateStatus(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) { func (c *scheduledJobs) UpdateStatus(scheduledJob *batch.CronJob) (result *batch.CronJob, err error) {
result = &batch.ScheduledJob{} result = &batch.CronJob{}
err = c.client.Put(). err = c.client.Put().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
Name(scheduledJob.Name). Name(scheduledJob.Name).
SubResource("status"). SubResource("status").
Body(scheduledJob). Body(scheduledJob).
...@@ -99,7 +99,7 @@ func (c *scheduledJobs) UpdateStatus(scheduledJob *batch.ScheduledJob) (result * ...@@ -99,7 +99,7 @@ func (c *scheduledJobs) UpdateStatus(scheduledJob *batch.ScheduledJob) (result *
func (c *scheduledJobs) Delete(name string, options *api.DeleteOptions) error { func (c *scheduledJobs) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
Name(name). Name(name).
Body(options). Body(options).
Do(). Do().
...@@ -110,7 +110,7 @@ func (c *scheduledJobs) Delete(name string, options *api.DeleteOptions) error { ...@@ -110,7 +110,7 @@ func (c *scheduledJobs) Delete(name string, options *api.DeleteOptions) error {
func (c *scheduledJobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { func (c *scheduledJobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
VersionedParams(&listOptions, api.ParameterCodec). VersionedParams(&listOptions, api.ParameterCodec).
Body(options). Body(options).
Do(). Do().
...@@ -118,23 +118,23 @@ func (c *scheduledJobs) DeleteCollection(options *api.DeleteOptions, listOptions ...@@ -118,23 +118,23 @@ func (c *scheduledJobs) DeleteCollection(options *api.DeleteOptions, listOptions
} }
// Get takes name of the scheduledJob, and returns the corresponding scheduledJob object, and an error if there is any. // Get takes name of the scheduledJob, and returns the corresponding scheduledJob object, and an error if there is any.
func (c *scheduledJobs) Get(name string) (result *batch.ScheduledJob, err error) { func (c *scheduledJobs) Get(name string) (result *batch.CronJob, err error) {
result = &batch.ScheduledJob{} result = &batch.CronJob{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
Name(name). Name(name).
Do(). Do().
Into(result) Into(result)
return return
} }
// List takes label and field selectors, and returns the list of ScheduledJobs that match those selectors. // List takes label and field selectors, and returns the list of CronJobs that match those selectors.
func (c *scheduledJobs) List(opts api.ListOptions) (result *batch.ScheduledJobList, err error) { func (c *scheduledJobs) List(opts api.ListOptions) (result *batch.CronJobList, err error) {
result = &batch.ScheduledJobList{} result = &batch.CronJobList{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Do(). Do().
Into(result) Into(result)
...@@ -146,17 +146,17 @@ func (c *scheduledJobs) Watch(opts api.ListOptions) (watch.Interface, error) { ...@@ -146,17 +146,17 @@ func (c *scheduledJobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get(). return c.client.Get().
Prefix("watch"). Prefix("watch").
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Watch() Watch()
} }
// Patch applies the patch and returns the patched scheduledJob. // Patch applies the patch and returns the patched scheduledJob.
func (c *scheduledJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *batch.ScheduledJob, err error) { func (c *scheduledJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *batch.CronJob, err error) {
result = &batch.ScheduledJob{} result = &batch.CronJob{}
err = c.client.Patch(pt). err = c.client.Patch(pt).
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
SubResource(subresources...). SubResource(subresources...).
Name(name). Name(name).
Body(data). Body(data).
......
...@@ -15,8 +15,8 @@ go_library( ...@@ -15,8 +15,8 @@ go_library(
srcs = [ srcs = [
"doc.go", "doc.go",
"fake_batch_client.go", "fake_batch_client.go",
"fake_cronjob.go",
"fake_job.go", "fake_job.go",
"fake_scheduledjob.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
......
...@@ -30,8 +30,8 @@ func (c *FakeBatch) Jobs(namespace string) internalversion.JobInterface { ...@@ -30,8 +30,8 @@ func (c *FakeBatch) Jobs(namespace string) internalversion.JobInterface {
return &FakeJobs{c, namespace} return &FakeJobs{c, namespace}
} }
func (c *FakeBatch) ScheduledJobs(namespace string) internalversion.ScheduledJobInterface { func (c *FakeBatch) CronJobs(namespace string) internalversion.CronJobInterface {
return &FakeScheduledJobs{c, namespace} return &FakeCronJobs{c, namespace}
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate
......
...@@ -25,71 +25,71 @@ import ( ...@@ -25,71 +25,71 @@ import (
watch "k8s.io/kubernetes/pkg/watch" watch "k8s.io/kubernetes/pkg/watch"
) )
// FakeScheduledJobs implements ScheduledJobInterface // FakeCronJobs implements CronJobInterface
type FakeScheduledJobs struct { type FakeCronJobs struct {
Fake *FakeBatch Fake *FakeBatch
ns string ns string
} }
var scheduledjobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "", Resource: "scheduledjobs"} var cronjobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "", Resource: "cronjobs"}
func (c *FakeScheduledJobs) Create(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) { func (c *FakeCronJobs) Create(scheduledJob *batch.CronJob) (result *batch.CronJob, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewCreateAction(scheduledjobsResource, c.ns, scheduledJob), &batch.ScheduledJob{}) Invokes(core.NewCreateAction(cronjobsResource, c.ns, scheduledJob), &batch.CronJob{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*batch.ScheduledJob), err return obj.(*batch.CronJob), err
} }
func (c *FakeScheduledJobs) Update(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) { func (c *FakeCronJobs) Update(scheduledJob *batch.CronJob) (result *batch.CronJob, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewUpdateAction(scheduledjobsResource, c.ns, scheduledJob), &batch.ScheduledJob{}) Invokes(core.NewUpdateAction(cronjobsResource, c.ns, scheduledJob), &batch.CronJob{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*batch.ScheduledJob), err return obj.(*batch.CronJob), err
} }
func (c *FakeScheduledJobs) UpdateStatus(scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error) { func (c *FakeCronJobs) UpdateStatus(scheduledJob *batch.CronJob) (*batch.CronJob, error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(scheduledjobsResource, "status", c.ns, scheduledJob), &batch.ScheduledJob{}) Invokes(core.NewUpdateSubresourceAction(cronjobsResource, "status", c.ns, scheduledJob), &batch.CronJob{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*batch.ScheduledJob), err return obj.(*batch.CronJob), err
} }
func (c *FakeScheduledJobs) Delete(name string, options *api.DeleteOptions) error { func (c *FakeCronJobs) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(core.NewDeleteAction(scheduledjobsResource, c.ns, name), &batch.ScheduledJob{}) Invokes(core.NewDeleteAction(cronjobsResource, c.ns, name), &batch.CronJob{})
return err return err
} }
func (c *FakeScheduledJobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error { func (c *FakeCronJobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(scheduledjobsResource, c.ns, listOptions) action := core.NewDeleteCollectionAction(cronjobsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &batch.ScheduledJobList{}) _, err := c.Fake.Invokes(action, &batch.CronJobList{})
return err return err
} }
func (c *FakeScheduledJobs) Get(name string) (result *batch.ScheduledJob, err error) { func (c *FakeCronJobs) Get(name string) (result *batch.CronJob, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewGetAction(scheduledjobsResource, c.ns, name), &batch.ScheduledJob{}) Invokes(core.NewGetAction(cronjobsResource, c.ns, name), &batch.CronJob{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*batch.ScheduledJob), err return obj.(*batch.CronJob), err
} }
func (c *FakeScheduledJobs) List(opts api.ListOptions) (result *batch.ScheduledJobList, err error) { func (c *FakeCronJobs) List(opts api.ListOptions) (result *batch.CronJobList, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewListAction(scheduledjobsResource, c.ns, opts), &batch.ScheduledJobList{}) Invokes(core.NewListAction(cronjobsResource, c.ns, opts), &batch.CronJobList{})
if obj == nil { if obj == nil {
return nil, err return nil, err
...@@ -99,8 +99,8 @@ func (c *FakeScheduledJobs) List(opts api.ListOptions) (result *batch.ScheduledJ ...@@ -99,8 +99,8 @@ func (c *FakeScheduledJobs) List(opts api.ListOptions) (result *batch.ScheduledJ
if label == nil { if label == nil {
label = labels.Everything() label = labels.Everything()
} }
list := &batch.ScheduledJobList{} list := &batch.CronJobList{}
for _, item := range obj.(*batch.ScheduledJobList).Items { for _, item := range obj.(*batch.CronJobList).Items {
if label.Matches(labels.Set(item.Labels)) { if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item) list.Items = append(list.Items, item)
} }
...@@ -109,19 +109,19 @@ func (c *FakeScheduledJobs) List(opts api.ListOptions) (result *batch.ScheduledJ ...@@ -109,19 +109,19 @@ func (c *FakeScheduledJobs) List(opts api.ListOptions) (result *batch.ScheduledJ
} }
// Watch returns a watch.Interface that watches the requested scheduledJobs. // Watch returns a watch.Interface that watches the requested scheduledJobs.
func (c *FakeScheduledJobs) Watch(opts api.ListOptions) (watch.Interface, error) { func (c *FakeCronJobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake. return c.Fake.
InvokesWatch(core.NewWatchAction(scheduledjobsResource, c.ns, opts)) InvokesWatch(core.NewWatchAction(cronjobsResource, c.ns, opts))
} }
// Patch applies the patch and returns the patched scheduledJob. // Patch applies the patch and returns the patched scheduledJob.
func (c *FakeScheduledJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *batch.ScheduledJob, err error) { func (c *FakeCronJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *batch.CronJob, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewPatchSubresourceAction(scheduledjobsResource, c.ns, name, data, subresources...), &batch.ScheduledJob{}) Invokes(core.NewPatchSubresourceAction(cronjobsResource, c.ns, name, data, subresources...), &batch.CronJob{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*batch.ScheduledJob), err return obj.(*batch.CronJob), err
} }
...@@ -18,4 +18,4 @@ package internalversion ...@@ -18,4 +18,4 @@ package internalversion
type JobExpansion interface{} type JobExpansion interface{}
type ScheduledJobExpansion interface{} type CronJobExpansion interface{}
...@@ -14,10 +14,10 @@ go_library( ...@@ -14,10 +14,10 @@ go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"batch_client.go", "batch_client.go",
"cronjob.go",
"doc.go", "doc.go",
"generated_expansion.go", "generated_expansion.go",
"job.go", "job.go",
"scheduledjob.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
......
...@@ -28,7 +28,7 @@ import ( ...@@ -28,7 +28,7 @@ import (
type BatchV2alpha1Interface interface { type BatchV2alpha1Interface interface {
RESTClient() restclient.Interface RESTClient() restclient.Interface
JobsGetter JobsGetter
ScheduledJobsGetter CronJobsGetter
} }
// BatchV2alpha1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group. // BatchV2alpha1Client is used to interact with features provided by the k8s.io/kubernetes/pkg/apimachinery/registered.Group group.
...@@ -40,8 +40,8 @@ func (c *BatchV2alpha1Client) Jobs(namespace string) JobInterface { ...@@ -40,8 +40,8 @@ func (c *BatchV2alpha1Client) Jobs(namespace string) JobInterface {
return newJobs(c, namespace) return newJobs(c, namespace)
} }
func (c *BatchV2alpha1Client) ScheduledJobs(namespace string) ScheduledJobInterface { func (c *BatchV2alpha1Client) CronJobs(namespace string) CronJobInterface {
return newScheduledJobs(c, namespace) return newCronJobs(c, namespace)
} }
// NewForConfig creates a new BatchV2alpha1Client for the given config. // NewForConfig creates a new BatchV2alpha1Client for the given config.
......
...@@ -24,83 +24,83 @@ import ( ...@@ -24,83 +24,83 @@ import (
watch "k8s.io/kubernetes/pkg/watch" watch "k8s.io/kubernetes/pkg/watch"
) )
// ScheduledJobsGetter has a method to return a ScheduledJobInterface. // CronJobsGetter has a method to return a CronJobInterface.
// A group's client should implement this interface. // A group's client should implement this interface.
type ScheduledJobsGetter interface { type CronJobsGetter interface {
ScheduledJobs(namespace string) ScheduledJobInterface CronJobs(namespace string) CronJobInterface
} }
// ScheduledJobInterface has methods to work with ScheduledJob resources. // CronJobInterface has methods to work with CronJob resources.
type ScheduledJobInterface interface { type CronJobInterface interface {
Create(*v2alpha1.ScheduledJob) (*v2alpha1.ScheduledJob, error) Create(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
Update(*v2alpha1.ScheduledJob) (*v2alpha1.ScheduledJob, error) Update(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
UpdateStatus(*v2alpha1.ScheduledJob) (*v2alpha1.ScheduledJob, error) UpdateStatus(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
Delete(name string, options *v1.DeleteOptions) error Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string) (*v2alpha1.ScheduledJob, error) Get(name string) (*v2alpha1.CronJob, error)
List(opts v1.ListOptions) (*v2alpha1.ScheduledJobList, error) List(opts v1.ListOptions) (*v2alpha1.CronJobList, error)
Watch(opts v1.ListOptions) (watch.Interface, error) Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.ScheduledJob, err error) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error)
ScheduledJobExpansion CronJobExpansion
} }
// scheduledJobs implements ScheduledJobInterface // cronJobs implements CronJobInterface
type scheduledJobs struct { type cronJobs struct {
client restclient.Interface client restclient.Interface
ns string ns string
} }
// newScheduledJobs returns a ScheduledJobs // newCronJobs returns a CronJobs
func newScheduledJobs(c *BatchV2alpha1Client, namespace string) *scheduledJobs { func newCronJobs(c *BatchV2alpha1Client, namespace string) *cronJobs {
return &scheduledJobs{ return &cronJobs{
client: c.RESTClient(), client: c.RESTClient(),
ns: namespace, ns: namespace,
} }
} }
// Create takes the representation of a scheduledJob and creates it. Returns the server's representation of the scheduledJob, and an error, if there is any. // Create takes the representation of a cronJob and creates it. Returns the server's representation of the cronJob, and an error, if there is any.
func (c *scheduledJobs) Create(scheduledJob *v2alpha1.ScheduledJob) (result *v2alpha1.ScheduledJob, err error) { func (c *cronJobs) Create(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
result = &v2alpha1.ScheduledJob{} result = &v2alpha1.CronJob{}
err = c.client.Post(). err = c.client.Post().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
Body(scheduledJob). Body(cronJob).
Do(). Do().
Into(result) Into(result)
return return
} }
// Update takes the representation of a scheduledJob and updates it. Returns the server's representation of the scheduledJob, and an error, if there is any. // Update takes the representation of a cronJob and updates it. Returns the server's representation of the cronJob, and an error, if there is any.
func (c *scheduledJobs) Update(scheduledJob *v2alpha1.ScheduledJob) (result *v2alpha1.ScheduledJob, err error) { func (c *cronJobs) Update(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
result = &v2alpha1.ScheduledJob{} result = &v2alpha1.CronJob{}
err = c.client.Put(). err = c.client.Put().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
Name(scheduledJob.Name). Name(cronJob.Name).
Body(scheduledJob). Body(cronJob).
Do(). Do().
Into(result) Into(result)
return return
} }
func (c *scheduledJobs) UpdateStatus(scheduledJob *v2alpha1.ScheduledJob) (result *v2alpha1.ScheduledJob, err error) { func (c *cronJobs) UpdateStatus(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
result = &v2alpha1.ScheduledJob{} result = &v2alpha1.CronJob{}
err = c.client.Put(). err = c.client.Put().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
Name(scheduledJob.Name). Name(cronJob.Name).
SubResource("status"). SubResource("status").
Body(scheduledJob). Body(cronJob).
Do(). Do().
Into(result) Into(result)
return return
} }
// Delete takes name of the scheduledJob and deletes it. Returns an error if one occurs. // Delete takes name of the cronJob and deletes it. Returns an error if one occurs.
func (c *scheduledJobs) Delete(name string, options *v1.DeleteOptions) error { func (c *cronJobs) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
Name(name). Name(name).
Body(options). Body(options).
Do(). Do().
...@@ -108,56 +108,56 @@ func (c *scheduledJobs) Delete(name string, options *v1.DeleteOptions) error { ...@@ -108,56 +108,56 @@ func (c *scheduledJobs) Delete(name string, options *v1.DeleteOptions) error {
} }
// DeleteCollection deletes a collection of objects. // DeleteCollection deletes a collection of objects.
func (c *scheduledJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { func (c *cronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete(). return c.client.Delete().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
VersionedParams(&listOptions, api.ParameterCodec). VersionedParams(&listOptions, api.ParameterCodec).
Body(options). Body(options).
Do(). Do().
Error() Error()
} }
// Get takes name of the scheduledJob, and returns the corresponding scheduledJob object, and an error if there is any. // Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any.
func (c *scheduledJobs) Get(name string) (result *v2alpha1.ScheduledJob, err error) { func (c *cronJobs) Get(name string) (result *v2alpha1.CronJob, err error) {
result = &v2alpha1.ScheduledJob{} result = &v2alpha1.CronJob{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
Name(name). Name(name).
Do(). Do().
Into(result) Into(result)
return return
} }
// List takes label and field selectors, and returns the list of ScheduledJobs that match those selectors. // List takes label and field selectors, and returns the list of CronJobs that match those selectors.
func (c *scheduledJobs) List(opts v1.ListOptions) (result *v2alpha1.ScheduledJobList, err error) { func (c *cronJobs) List(opts v1.ListOptions) (result *v2alpha1.CronJobList, err error) {
result = &v2alpha1.ScheduledJobList{} result = &v2alpha1.CronJobList{}
err = c.client.Get(). err = c.client.Get().
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Do(). Do().
Into(result) Into(result)
return return
} }
// Watch returns a watch.Interface that watches the requested scheduledJobs. // Watch returns a watch.Interface that watches the requested cronJobs.
func (c *scheduledJobs) Watch(opts v1.ListOptions) (watch.Interface, error) { func (c *cronJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.client.Get(). return c.client.Get().
Prefix("watch"). Prefix("watch").
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
VersionedParams(&opts, api.ParameterCodec). VersionedParams(&opts, api.ParameterCodec).
Watch() Watch()
} }
// Patch applies the patch and returns the patched scheduledJob. // Patch applies the patch and returns the patched cronJob.
func (c *scheduledJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.ScheduledJob, err error) { func (c *cronJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error) {
result = &v2alpha1.ScheduledJob{} result = &v2alpha1.CronJob{}
err = c.client.Patch(pt). err = c.client.Patch(pt).
Namespace(c.ns). Namespace(c.ns).
Resource("scheduledjobs"). Resource("cronjobs").
SubResource(subresources...). SubResource(subresources...).
Name(name). Name(name).
Body(data). Body(data).
......
...@@ -15,8 +15,8 @@ go_library( ...@@ -15,8 +15,8 @@ go_library(
srcs = [ srcs = [
"doc.go", "doc.go",
"fake_batch_client.go", "fake_batch_client.go",
"fake_cronjob.go",
"fake_job.go", "fake_job.go",
"fake_scheduledjob.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
......
...@@ -30,8 +30,8 @@ func (c *FakeBatchV2alpha1) Jobs(namespace string) v2alpha1.JobInterface { ...@@ -30,8 +30,8 @@ func (c *FakeBatchV2alpha1) Jobs(namespace string) v2alpha1.JobInterface {
return &FakeJobs{c, namespace} return &FakeJobs{c, namespace}
} }
func (c *FakeBatchV2alpha1) ScheduledJobs(namespace string) v2alpha1.ScheduledJobInterface { func (c *FakeBatchV2alpha1) CronJobs(namespace string) v2alpha1.CronJobInterface {
return &FakeScheduledJobs{c, namespace} return &FakeCronJobs{c, namespace}
} }
// RESTClient returns a RESTClient that is used to communicate // RESTClient returns a RESTClient that is used to communicate
......
...@@ -26,71 +26,71 @@ import ( ...@@ -26,71 +26,71 @@ import (
watch "k8s.io/kubernetes/pkg/watch" watch "k8s.io/kubernetes/pkg/watch"
) )
// FakeScheduledJobs implements ScheduledJobInterface // FakeCronJobs implements CronJobInterface
type FakeScheduledJobs struct { type FakeCronJobs struct {
Fake *FakeBatchV2alpha1 Fake *FakeBatchV2alpha1
ns string ns string
} }
var scheduledjobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "scheduledjobs"} var cronjobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}
func (c *FakeScheduledJobs) Create(scheduledJob *v2alpha1.ScheduledJob) (result *v2alpha1.ScheduledJob, err error) { func (c *FakeCronJobs) Create(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewCreateAction(scheduledjobsResource, c.ns, scheduledJob), &v2alpha1.ScheduledJob{}) Invokes(core.NewCreateAction(cronjobsResource, c.ns, cronJob), &v2alpha1.CronJob{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v2alpha1.ScheduledJob), err return obj.(*v2alpha1.CronJob), err
} }
func (c *FakeScheduledJobs) Update(scheduledJob *v2alpha1.ScheduledJob) (result *v2alpha1.ScheduledJob, err error) { func (c *FakeCronJobs) Update(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewUpdateAction(scheduledjobsResource, c.ns, scheduledJob), &v2alpha1.ScheduledJob{}) Invokes(core.NewUpdateAction(cronjobsResource, c.ns, cronJob), &v2alpha1.CronJob{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v2alpha1.ScheduledJob), err return obj.(*v2alpha1.CronJob), err
} }
func (c *FakeScheduledJobs) UpdateStatus(scheduledJob *v2alpha1.ScheduledJob) (*v2alpha1.ScheduledJob, error) { func (c *FakeCronJobs) UpdateStatus(cronJob *v2alpha1.CronJob) (*v2alpha1.CronJob, error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(scheduledjobsResource, "status", c.ns, scheduledJob), &v2alpha1.ScheduledJob{}) Invokes(core.NewUpdateSubresourceAction(cronjobsResource, "status", c.ns, cronJob), &v2alpha1.CronJob{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v2alpha1.ScheduledJob), err return obj.(*v2alpha1.CronJob), err
} }
func (c *FakeScheduledJobs) Delete(name string, options *v1.DeleteOptions) error { func (c *FakeCronJobs) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake. _, err := c.Fake.
Invokes(core.NewDeleteAction(scheduledjobsResource, c.ns, name), &v2alpha1.ScheduledJob{}) Invokes(core.NewDeleteAction(cronjobsResource, c.ns, name), &v2alpha1.CronJob{})
return err return err
} }
func (c *FakeScheduledJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { func (c *FakeCronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := core.NewDeleteCollectionAction(scheduledjobsResource, c.ns, listOptions) action := core.NewDeleteCollectionAction(cronjobsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v2alpha1.ScheduledJobList{}) _, err := c.Fake.Invokes(action, &v2alpha1.CronJobList{})
return err return err
} }
func (c *FakeScheduledJobs) Get(name string) (result *v2alpha1.ScheduledJob, err error) { func (c *FakeCronJobs) Get(name string) (result *v2alpha1.CronJob, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewGetAction(scheduledjobsResource, c.ns, name), &v2alpha1.ScheduledJob{}) Invokes(core.NewGetAction(cronjobsResource, c.ns, name), &v2alpha1.CronJob{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v2alpha1.ScheduledJob), err return obj.(*v2alpha1.CronJob), err
} }
func (c *FakeScheduledJobs) List(opts v1.ListOptions) (result *v2alpha1.ScheduledJobList, err error) { func (c *FakeCronJobs) List(opts v1.ListOptions) (result *v2alpha1.CronJobList, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewListAction(scheduledjobsResource, c.ns, opts), &v2alpha1.ScheduledJobList{}) Invokes(core.NewListAction(cronjobsResource, c.ns, opts), &v2alpha1.CronJobList{})
if obj == nil { if obj == nil {
return nil, err return nil, err
...@@ -100,8 +100,8 @@ func (c *FakeScheduledJobs) List(opts v1.ListOptions) (result *v2alpha1.Schedule ...@@ -100,8 +100,8 @@ func (c *FakeScheduledJobs) List(opts v1.ListOptions) (result *v2alpha1.Schedule
if label == nil { if label == nil {
label = labels.Everything() label = labels.Everything()
} }
list := &v2alpha1.ScheduledJobList{} list := &v2alpha1.CronJobList{}
for _, item := range obj.(*v2alpha1.ScheduledJobList).Items { for _, item := range obj.(*v2alpha1.CronJobList).Items {
if label.Matches(labels.Set(item.Labels)) { if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item) list.Items = append(list.Items, item)
} }
...@@ -109,20 +109,20 @@ func (c *FakeScheduledJobs) List(opts v1.ListOptions) (result *v2alpha1.Schedule ...@@ -109,20 +109,20 @@ func (c *FakeScheduledJobs) List(opts v1.ListOptions) (result *v2alpha1.Schedule
return list, err return list, err
} }
// Watch returns a watch.Interface that watches the requested scheduledJobs. // Watch returns a watch.Interface that watches the requested cronJobs.
func (c *FakeScheduledJobs) Watch(opts v1.ListOptions) (watch.Interface, error) { func (c *FakeCronJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake. return c.Fake.
InvokesWatch(core.NewWatchAction(scheduledjobsResource, c.ns, opts)) InvokesWatch(core.NewWatchAction(cronjobsResource, c.ns, opts))
} }
// Patch applies the patch and returns the patched scheduledJob. // Patch applies the patch and returns the patched cronJob.
func (c *FakeScheduledJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.ScheduledJob, err error) { func (c *FakeCronJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error) {
obj, err := c.Fake. obj, err := c.Fake.
Invokes(core.NewPatchSubresourceAction(scheduledjobsResource, c.ns, name, data, subresources...), &v2alpha1.ScheduledJob{}) Invokes(core.NewPatchSubresourceAction(cronjobsResource, c.ns, name, data, subresources...), &v2alpha1.CronJob{})
if obj == nil { if obj == nil {
return nil, err return nil, err
} }
return obj.(*v2alpha1.ScheduledJob), err return obj.(*v2alpha1.CronJob), err
} }
...@@ -18,4 +18,4 @@ package v2alpha1 ...@@ -18,4 +18,4 @@ package v2alpha1
type JobExpansion interface{} type JobExpansion interface{}
type ScheduledJobExpansion interface{} type CronJobExpansion interface{}
...@@ -13,10 +13,10 @@ load( ...@@ -13,10 +13,10 @@ load(
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"cronjob.go",
"expansion_generated.go", "expansion_generated.go",
"job.go", "job.go",
"job_expansion.go", "job_expansion.go",
"scheduledjob.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
......
...@@ -25,70 +25,70 @@ import ( ...@@ -25,70 +25,70 @@ import (
"k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/labels"
) )
// ScheduledJobLister helps list ScheduledJobs. // CronJobLister helps list CronJobs.
type ScheduledJobLister interface { type CronJobLister interface {
// List lists all ScheduledJobs in the indexer. // List lists all CronJobs in the indexer.
List(selector labels.Selector) (ret []*batch.ScheduledJob, err error) List(selector labels.Selector) (ret []*batch.CronJob, err error)
// ScheduledJobs returns an object that can list and get ScheduledJobs. // CronJobs returns an object that can list and get CronJobs.
ScheduledJobs(namespace string) ScheduledJobNamespaceLister CronJobs(namespace string) CronJobNamespaceLister
ScheduledJobListerExpansion CronJobListerExpansion
} }
// scheduledJobLister implements the ScheduledJobLister interface. // cronJobLister implements the CronJobLister interface.
type scheduledJobLister struct { type cronJobLister struct {
indexer cache.Indexer indexer cache.Indexer
} }
// NewScheduledJobLister returns a new ScheduledJobLister. // NewCronJobLister returns a new CronJobLister.
func NewScheduledJobLister(indexer cache.Indexer) ScheduledJobLister { func NewCronJobLister(indexer cache.Indexer) CronJobLister {
return &scheduledJobLister{indexer: indexer} return &cronJobLister{indexer: indexer}
} }
// List lists all ScheduledJobs in the indexer. // List lists all CronJobs in the indexer.
func (s *scheduledJobLister) List(selector labels.Selector) (ret []*batch.ScheduledJob, err error) { func (s *cronJobLister) List(selector labels.Selector) (ret []*batch.CronJob, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) { err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*batch.ScheduledJob)) ret = append(ret, m.(*batch.CronJob))
}) })
return ret, err return ret, err
} }
// ScheduledJobs returns an object that can list and get ScheduledJobs. // CronJobs returns an object that can list and get CronJobs.
func (s *scheduledJobLister) ScheduledJobs(namespace string) ScheduledJobNamespaceLister { func (s *cronJobLister) CronJobs(namespace string) CronJobNamespaceLister {
return scheduledJobNamespaceLister{indexer: s.indexer, namespace: namespace} return cronJobNamespaceLister{indexer: s.indexer, namespace: namespace}
} }
// ScheduledJobNamespaceLister helps list and get ScheduledJobs. // CronJobNamespaceLister helps list and get CronJobs.
type ScheduledJobNamespaceLister interface { type CronJobNamespaceLister interface {
// List lists all ScheduledJobs in the indexer for a given namespace. // List lists all CronJobs in the indexer for a given namespace.
List(selector labels.Selector) (ret []*batch.ScheduledJob, err error) List(selector labels.Selector) (ret []*batch.CronJob, err error)
// Get retrieves the ScheduledJob from the indexer for a given namespace and name. // Get retrieves the CronJob from the indexer for a given namespace and name.
Get(name string) (*batch.ScheduledJob, error) Get(name string) (*batch.CronJob, error)
ScheduledJobNamespaceListerExpansion CronJobNamespaceListerExpansion
} }
// scheduledJobNamespaceLister implements the ScheduledJobNamespaceLister // cronJobNamespaceLister implements the CronJobNamespaceLister
// interface. // interface.
type scheduledJobNamespaceLister struct { type cronJobNamespaceLister struct {
indexer cache.Indexer indexer cache.Indexer
namespace string namespace string
} }
// List lists all ScheduledJobs in the indexer for a given namespace. // List lists all CronJobs in the indexer for a given namespace.
func (s scheduledJobNamespaceLister) List(selector labels.Selector) (ret []*batch.ScheduledJob, err error) { func (s cronJobNamespaceLister) List(selector labels.Selector) (ret []*batch.CronJob, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*batch.ScheduledJob)) ret = append(ret, m.(*batch.CronJob))
}) })
return ret, err return ret, err
} }
// Get retrieves the ScheduledJob from the indexer for a given namespace and name. // Get retrieves the CronJob from the indexer for a given namespace and name.
func (s scheduledJobNamespaceLister) Get(name string) (*batch.ScheduledJob, error) { func (s cronJobNamespaceLister) Get(name string) (*batch.CronJob, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if !exists { if !exists {
return nil, errors.NewNotFound(batch.Resource("scheduledjob"), name) return nil, errors.NewNotFound(batch.Resource("cronjob"), name)
} }
return obj.(*batch.ScheduledJob), nil return obj.(*batch.CronJob), nil
} }
...@@ -18,10 +18,10 @@ limitations under the License. ...@@ -18,10 +18,10 @@ limitations under the License.
package internalversion package internalversion
// ScheduledJobListerExpansion allows custom methods to be added to // CronJobListerExpansion allows custom methods to be added to
// ScheduledJobLister. // CronJobLister.
type ScheduledJobListerExpansion interface{} type CronJobListerExpansion interface{}
// ScheduledJobNamespaceListerExpansion allows custom methods to be added to // CronJobNamespaceListerExpansion allows custom methods to be added to
// ScheduledJobNamespaeLister. // CronJobNamespaeLister.
type ScheduledJobNamespaceListerExpansion interface{} type CronJobNamespaceListerExpansion interface{}
...@@ -13,9 +13,9 @@ load( ...@@ -13,9 +13,9 @@ load(
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = [ srcs = [
"cronjob.go",
"expansion_generated.go", "expansion_generated.go",
"job.go", "job.go",
"scheduledjob.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
......
...@@ -26,70 +26,70 @@ import ( ...@@ -26,70 +26,70 @@ import (
"k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/labels"
) )
// ScheduledJobLister helps list ScheduledJobs. // CronJobLister helps list CronJobs.
type ScheduledJobLister interface { type CronJobLister interface {
// List lists all ScheduledJobs in the indexer. // List lists all CronJobs in the indexer.
List(selector labels.Selector) (ret []*v2alpha1.ScheduledJob, err error) List(selector labels.Selector) (ret []*v2alpha1.CronJob, err error)
// ScheduledJobs returns an object that can list and get ScheduledJobs. // CronJobs returns an object that can list and get CronJobs.
ScheduledJobs(namespace string) ScheduledJobNamespaceLister CronJobs(namespace string) CronJobNamespaceLister
ScheduledJobListerExpansion CronJobListerExpansion
} }
// scheduledJobLister implements the ScheduledJobLister interface. // cronJobLister implements the CronJobLister interface.
type scheduledJobLister struct { type cronJobLister struct {
indexer cache.Indexer indexer cache.Indexer
} }
// NewScheduledJobLister returns a new ScheduledJobLister. // NewCronJobLister returns a new CronJobLister.
func NewScheduledJobLister(indexer cache.Indexer) ScheduledJobLister { func NewCronJobLister(indexer cache.Indexer) CronJobLister {
return &scheduledJobLister{indexer: indexer} return &cronJobLister{indexer: indexer}
} }
// List lists all ScheduledJobs in the indexer. // List lists all CronJobs in the indexer.
func (s *scheduledJobLister) List(selector labels.Selector) (ret []*v2alpha1.ScheduledJob, err error) { func (s *cronJobLister) List(selector labels.Selector) (ret []*v2alpha1.CronJob, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) { err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v2alpha1.ScheduledJob)) ret = append(ret, m.(*v2alpha1.CronJob))
}) })
return ret, err return ret, err
} }
// ScheduledJobs returns an object that can list and get ScheduledJobs. // CronJobs returns an object that can list and get CronJobs.
func (s *scheduledJobLister) ScheduledJobs(namespace string) ScheduledJobNamespaceLister { func (s *cronJobLister) CronJobs(namespace string) CronJobNamespaceLister {
return scheduledJobNamespaceLister{indexer: s.indexer, namespace: namespace} return cronJobNamespaceLister{indexer: s.indexer, namespace: namespace}
} }
// ScheduledJobNamespaceLister helps list and get ScheduledJobs. // CronJobNamespaceLister helps list and get CronJobs.
type ScheduledJobNamespaceLister interface { type CronJobNamespaceLister interface {
// List lists all ScheduledJobs in the indexer for a given namespace. // List lists all CronJobs in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v2alpha1.ScheduledJob, err error) List(selector labels.Selector) (ret []*v2alpha1.CronJob, err error)
// Get retrieves the ScheduledJob from the indexer for a given namespace and name. // Get retrieves the CronJob from the indexer for a given namespace and name.
Get(name string) (*v2alpha1.ScheduledJob, error) Get(name string) (*v2alpha1.CronJob, error)
ScheduledJobNamespaceListerExpansion CronJobNamespaceListerExpansion
} }
// scheduledJobNamespaceLister implements the ScheduledJobNamespaceLister // cronJobNamespaceLister implements the CronJobNamespaceLister
// interface. // interface.
type scheduledJobNamespaceLister struct { type cronJobNamespaceLister struct {
indexer cache.Indexer indexer cache.Indexer
namespace string namespace string
} }
// List lists all ScheduledJobs in the indexer for a given namespace. // List lists all CronJobs in the indexer for a given namespace.
func (s scheduledJobNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.ScheduledJob, err error) { func (s cronJobNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.CronJob, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v2alpha1.ScheduledJob)) ret = append(ret, m.(*v2alpha1.CronJob))
}) })
return ret, err return ret, err
} }
// Get retrieves the ScheduledJob from the indexer for a given namespace and name. // Get retrieves the CronJob from the indexer for a given namespace and name.
func (s scheduledJobNamespaceLister) Get(name string) (*v2alpha1.ScheduledJob, error) { func (s cronJobNamespaceLister) Get(name string) (*v2alpha1.CronJob, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if !exists { if !exists {
return nil, errors.NewNotFound(batch.Resource("scheduledjob"), name) return nil, errors.NewNotFound(batch.Resource("cronjob"), name)
} }
return obj.(*v2alpha1.ScheduledJob), nil return obj.(*v2alpha1.CronJob), nil
} }
...@@ -26,10 +26,10 @@ type JobListerExpansion interface{} ...@@ -26,10 +26,10 @@ type JobListerExpansion interface{}
// JobNamespaeLister. // JobNamespaeLister.
type JobNamespaceListerExpansion interface{} type JobNamespaceListerExpansion interface{}
// ScheduledJobListerExpansion allows custom methods to be added to // CronJobListerExpansion allows custom methods to be added to
// ScheduledJobLister. // CronJobLister.
type ScheduledJobListerExpansion interface{} type CronJobListerExpansion interface{}
// ScheduledJobNamespaceListerExpansion allows custom methods to be added to // CronJobNamespaceListerExpansion allows custom methods to be added to
// ScheduledJobNamespaeLister. // CronJobNamespaeLister.
type ScheduledJobNamespaceListerExpansion interface{} type CronJobNamespaceListerExpansion interface{}
...@@ -14,13 +14,13 @@ See the License for the specific language governing permissions and ...@@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package scheduledjob package cronjob
/* /*
I did not use watch or expectations. Those add a lot of corner cases, and we aren't I did not use watch or expectations. Those add a lot of corner cases, and we aren't
expecting a large volume of jobs or scheduledJobs. (We are favoring correctness expecting a large volume of jobs or scheduledJobs. (We are favoring correctness
over scalability. If we find a single controller thread is too slow because over scalability. If we find a single controller thread is too slow because
there are a lot of Jobs or ScheduledJobs, we we can parallelize by Namespace. there are a lot of Jobs or CronJobs, we we can parallelize by Namespace.
If we find the load on the API server is too high, we can use a watch and If we find the load on the API server is too high, we can use a watch and
UndeltaStore.) UndeltaStore.)
...@@ -49,9 +49,9 @@ import ( ...@@ -49,9 +49,9 @@ import (
"k8s.io/kubernetes/pkg/util/wait" "k8s.io/kubernetes/pkg/util/wait"
) )
// Utilities for dealing with Jobs and ScheduledJobs and time. // Utilities for dealing with Jobs and CronJobs and time.
type ScheduledJobController struct { type CronJobController struct {
kubeClient clientset.Interface kubeClient clientset.Interface
jobControl jobControlInterface jobControl jobControlInterface
sjControl sjControlInterface sjControl sjControlInterface
...@@ -59,51 +59,51 @@ type ScheduledJobController struct { ...@@ -59,51 +59,51 @@ type ScheduledJobController struct {
recorder record.EventRecorder recorder record.EventRecorder
} }
func NewScheduledJobController(kubeClient clientset.Interface) *ScheduledJobController { func NewCronJobController(kubeClient clientset.Interface) *CronJobController {
eventBroadcaster := record.NewBroadcaster() eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(glog.Infof) eventBroadcaster.StartLogging(glog.Infof)
// TODO: remove the wrapper when every clients have moved to use the clientset. // TODO: remove the wrapper when every clients have moved to use the clientset.
eventBroadcaster.StartRecordingToSink(&unversionedcore.EventSinkImpl{Interface: kubeClient.Core().Events("")}) eventBroadcaster.StartRecordingToSink(&unversionedcore.EventSinkImpl{Interface: kubeClient.Core().Events("")})
if kubeClient != nil && kubeClient.Core().RESTClient().GetRateLimiter() != nil { if kubeClient != nil && kubeClient.Core().RESTClient().GetRateLimiter() != nil {
metrics.RegisterMetricAndTrackRateLimiterUsage("scheduledjob_controller", kubeClient.Core().RESTClient().GetRateLimiter()) metrics.RegisterMetricAndTrackRateLimiterUsage("cronjob_controller", kubeClient.Core().RESTClient().GetRateLimiter())
} }
jm := &ScheduledJobController{ jm := &CronJobController{
kubeClient: kubeClient, kubeClient: kubeClient,
jobControl: realJobControl{KubeClient: kubeClient}, jobControl: realJobControl{KubeClient: kubeClient},
sjControl: &realSJControl{KubeClient: kubeClient}, sjControl: &realSJControl{KubeClient: kubeClient},
podControl: &realPodControl{KubeClient: kubeClient}, podControl: &realPodControl{KubeClient: kubeClient},
recorder: eventBroadcaster.NewRecorder(api.EventSource{Component: "scheduledjob-controller"}), recorder: eventBroadcaster.NewRecorder(api.EventSource{Component: "cronjob-controller"}),
} }
return jm return jm
} }
func NewScheduledJobControllerFromClient(kubeClient clientset.Interface) *ScheduledJobController { func NewCronJobControllerFromClient(kubeClient clientset.Interface) *CronJobController {
jm := NewScheduledJobController(kubeClient) jm := NewCronJobController(kubeClient)
return jm return jm
} }
// Run the main goroutine responsible for watching and syncing jobs. // Run the main goroutine responsible for watching and syncing jobs.
func (jm *ScheduledJobController) Run(stopCh <-chan struct{}) { func (jm *CronJobController) Run(stopCh <-chan struct{}) {
defer utilruntime.HandleCrash() defer utilruntime.HandleCrash()
glog.Infof("Starting ScheduledJob Manager") glog.Infof("Starting CronJob Manager")
// Check things every 10 second. // Check things every 10 second.
go wait.Until(jm.SyncAll, 10*time.Second, stopCh) go wait.Until(jm.SyncAll, 10*time.Second, stopCh)
<-stopCh <-stopCh
glog.Infof("Shutting down ScheduledJob Manager") glog.Infof("Shutting down CronJob Manager")
} }
// SyncAll lists all the ScheduledJobs and Jobs and reconciles them. // SyncAll lists all the CronJobs and Jobs and reconciles them.
func (jm *ScheduledJobController) SyncAll() { func (jm *CronJobController) SyncAll() {
sjl, err := jm.kubeClient.Batch().ScheduledJobs(api.NamespaceAll).List(api.ListOptions{}) sjl, err := jm.kubeClient.Batch().CronJobs(api.NamespaceAll).List(api.ListOptions{})
if err != nil { if err != nil {
glog.Errorf("Error listing scheduledjobs: %v", err) glog.Errorf("Error listing cronjobs: %v", err)
return return
} }
sjs := sjl.Items sjs := sjl.Items
glog.V(4).Infof("Found %d scheduledjobs", len(sjs)) glog.V(4).Infof("Found %d cronjobs", len(sjs))
jl, err := jm.kubeClient.Batch().Jobs(api.NamespaceAll).List(api.ListOptions{}) jl, err := jm.kubeClient.Batch().Jobs(api.NamespaceAll).List(api.ListOptions{})
if err != nil { if err != nil {
...@@ -121,11 +121,11 @@ func (jm *ScheduledJobController) SyncAll() { ...@@ -121,11 +121,11 @@ func (jm *ScheduledJobController) SyncAll() {
} }
} }
// SyncOne reconciles a ScheduledJob with a list of any Jobs that it created. // SyncOne reconciles a CronJob with a list of any Jobs that it created.
// All known jobs created by "sj" should be included in "js". // All known jobs created by "sj" should be included in "js".
// The current time is passed in to facilitate testing. // The current time is passed in to facilitate testing.
// It has no receiver, to facilitate testing. // It has no receiver, to facilitate testing.
func SyncOne(sj batch.ScheduledJob, js []batch.Job, now time.Time, jc jobControlInterface, sjc sjControlInterface, pc podControlInterface, recorder record.EventRecorder) { func SyncOne(sj batch.CronJob, js []batch.Job, now time.Time, jc jobControlInterface, sjc sjControlInterface, pc podControlInterface, recorder record.EventRecorder) {
nameForLog := fmt.Sprintf("%s/%s", sj.Namespace, sj.Name) nameForLog := fmt.Sprintf("%s/%s", sj.Namespace, sj.Name)
for i := range js { for i := range js {
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package scheduledjob package cronjob
import ( import (
"testing" "testing"
...@@ -72,17 +72,17 @@ func justAfterThePriorHour() time.Time { ...@@ -72,17 +72,17 @@ func justAfterThePriorHour() time.Time {
return T1 return T1
} }
// returns a scheduledJob with some fields filled in. // returns a cronJob with some fields filled in.
func scheduledJob() batch.ScheduledJob { func cronJob() batch.CronJob {
return batch.ScheduledJob{ return batch.CronJob{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: "snazzycats", Namespace: "snazzycats",
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
SelfLink: "/apis/batch/v2alpha1/namespaces/snazzycats/scheduledjobs/myscheduledjob", SelfLink: "/apis/batch/v2alpha1/namespaces/snazzycats/cronjobs/mycronjob",
CreationTimestamp: unversioned.Time{Time: justBeforeTheHour()}, CreationTimestamp: unversioned.Time{Time: justBeforeTheHour()},
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -190,7 +190,7 @@ func TestSyncOne_RunOrNot(t *testing.T) { ...@@ -190,7 +190,7 @@ func TestSyncOne_RunOrNot(t *testing.T) {
"still active, is time, not past deadline": {A, F, onTheHour, longDead, T, T, justAfterTheHour(), T, F, 2}, "still active, is time, not past deadline": {A, F, onTheHour, longDead, T, T, justAfterTheHour(), T, F, 2},
} }
for name, tc := range testCases { for name, tc := range testCases {
sj := scheduledJob() sj := cronJob()
sj.Spec.ConcurrencyPolicy = tc.concurrencyPolicy sj.Spec.ConcurrencyPolicy = tc.concurrencyPolicy
sj.Spec.Suspend = &tc.suspend sj.Spec.Suspend = &tc.suspend
sj.Spec.Schedule = tc.schedule sj.Spec.Schedule = tc.schedule
...@@ -338,7 +338,7 @@ func TestSyncOne_Status(t *testing.T) { ...@@ -338,7 +338,7 @@ func TestSyncOne_Status(t *testing.T) {
for name, tc := range testCases { for name, tc := range testCases {
// Setup the test // Setup the test
sj := scheduledJob() sj := cronJob()
sj.Spec.ConcurrencyPolicy = tc.concurrencyPolicy sj.Spec.ConcurrencyPolicy = tc.concurrencyPolicy
sj.Spec.Suspend = &tc.suspend sj.Spec.Suspend = &tc.suspend
sj.Spec.Schedule = tc.schedule sj.Spec.Schedule = tc.schedule
......
...@@ -14,5 +14,5 @@ See the License for the specific language governing permissions and ...@@ -14,5 +14,5 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// Package scheduledjob contains the controller for ScheduledJob objects. // Package cronjob contains the controller for CronJob objects.
package scheduledjob package cronjob
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package scheduledjob package cronjob
import ( import (
"fmt" "fmt"
...@@ -27,10 +27,10 @@ import ( ...@@ -27,10 +27,10 @@ import (
"k8s.io/kubernetes/pkg/labels" "k8s.io/kubernetes/pkg/labels"
) )
// sjControlInterface is an interface that knows how to update ScheduledJob status // sjControlInterface is an interface that knows how to update CronJob status
// created as an interface to allow testing. // created as an interface to allow testing.
type sjControlInterface interface { type sjControlInterface interface {
UpdateStatus(sj *batch.ScheduledJob) (*batch.ScheduledJob, error) UpdateStatus(sj *batch.CronJob) (*batch.CronJob, error)
} }
// realSJControl is the default implementation of sjControlInterface. // realSJControl is the default implementation of sjControlInterface.
...@@ -40,18 +40,18 @@ type realSJControl struct { ...@@ -40,18 +40,18 @@ type realSJControl struct {
var _ sjControlInterface = &realSJControl{} var _ sjControlInterface = &realSJControl{}
func (c *realSJControl) UpdateStatus(sj *batch.ScheduledJob) (*batch.ScheduledJob, error) { func (c *realSJControl) UpdateStatus(sj *batch.CronJob) (*batch.CronJob, error) {
return c.KubeClient.Batch().ScheduledJobs(sj.Namespace).UpdateStatus(sj) return c.KubeClient.Batch().CronJobs(sj.Namespace).UpdateStatus(sj)
} }
// fakeSJControl is the default implementation of sjControlInterface. // fakeSJControl is the default implementation of sjControlInterface.
type fakeSJControl struct { type fakeSJControl struct {
Updates []batch.ScheduledJob Updates []batch.CronJob
} }
var _ sjControlInterface = &fakeSJControl{} var _ sjControlInterface = &fakeSJControl{}
func (c *fakeSJControl) UpdateStatus(sj *batch.ScheduledJob) (*batch.ScheduledJob, error) { func (c *fakeSJControl) UpdateStatus(sj *batch.CronJob) (*batch.CronJob, error) {
c.Updates = append(c.Updates, *sj) c.Updates = append(c.Updates, *sj)
return sj, nil return sj, nil
} }
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package scheduledjob package cronjob
import ( import (
"encoding/json" "encoding/json"
...@@ -33,9 +33,9 @@ import ( ...@@ -33,9 +33,9 @@ import (
hashutil "k8s.io/kubernetes/pkg/util/hash" hashutil "k8s.io/kubernetes/pkg/util/hash"
) )
// Utilities for dealing with Jobs and ScheduledJobs and time. // Utilities for dealing with Jobs and CronJobs and time.
func inActiveList(sj batch.ScheduledJob, uid types.UID) bool { func inActiveList(sj batch.CronJob, uid types.UID) bool {
for _, j := range sj.Status.Active { for _, j := range sj.Status.Active {
if j.UID == uid { if j.UID == uid {
return true return true
...@@ -44,7 +44,7 @@ func inActiveList(sj batch.ScheduledJob, uid types.UID) bool { ...@@ -44,7 +44,7 @@ func inActiveList(sj batch.ScheduledJob, uid types.UID) bool {
return false return false
} }
func deleteFromActiveList(sj *batch.ScheduledJob, uid types.UID) { func deleteFromActiveList(sj *batch.CronJob, uid types.UID) {
if sj == nil { if sj == nil {
return return
} }
...@@ -70,8 +70,8 @@ func getParentUIDFromJob(j batch.Job) (types.UID, bool) { ...@@ -70,8 +70,8 @@ func getParentUIDFromJob(j batch.Job) (types.UID, bool) {
glog.V(4).Infof("Job with unparsable created-by annotation, name %s namespace %s: %v", j.Name, j.Namespace, err) glog.V(4).Infof("Job with unparsable created-by annotation, name %s namespace %s: %v", j.Name, j.Namespace, err)
return types.UID(""), false return types.UID(""), false
} }
if sr.Reference.Kind != "ScheduledJob" { if sr.Reference.Kind != "CronJob" {
glog.V(4).Infof("Job with non-ScheduledJob parent, name %s namespace %s", j.Name, j.Namespace) glog.V(4).Infof("Job with non-CronJob parent, name %s namespace %s", j.Name, j.Namespace)
return types.UID(""), false return types.UID(""), false
} }
// Don't believe a job that claims to have a parent in a different namespace. // Don't believe a job that claims to have a parent in a different namespace.
...@@ -85,7 +85,7 @@ func getParentUIDFromJob(j batch.Job) (types.UID, bool) { ...@@ -85,7 +85,7 @@ func getParentUIDFromJob(j batch.Job) (types.UID, bool) {
// groupJobsByParent groups jobs into a map keyed by the job parent UID (e.g. scheduledJob). // groupJobsByParent groups jobs into a map keyed by the job parent UID (e.g. scheduledJob).
// It has no receiver, to facilitate testing. // It has no receiver, to facilitate testing.
func groupJobsByParent(sjs []batch.ScheduledJob, js []batch.Job) map[types.UID][]batch.Job { func groupJobsByParent(sjs []batch.CronJob, js []batch.Job) map[types.UID][]batch.Job {
jobsBySj := make(map[types.UID][]batch.Job) jobsBySj := make(map[types.UID][]batch.Job)
for _, job := range js { for _, job := range js {
parentUID, found := getParentUIDFromJob(job) parentUID, found := getParentUIDFromJob(job)
...@@ -120,7 +120,7 @@ func getNextStartTimeAfter(schedule string, now time.Time) (time.Time, error) { ...@@ -120,7 +120,7 @@ func getNextStartTimeAfter(schedule string, now time.Time) (time.Time, error) {
// //
// If there are too many (>100) unstarted times, just give up and return an empty slice. // If there are too many (>100) unstarted times, just give up and return an empty slice.
// If there were missed times prior to the last known start time, then those are not returned. // If there were missed times prior to the last known start time, then those are not returned.
func getRecentUnmetScheduleTimes(sj batch.ScheduledJob, now time.Time) ([]time.Time, error) { func getRecentUnmetScheduleTimes(sj batch.CronJob, now time.Time) ([]time.Time, error) {
starts := []time.Time{} starts := []time.Time{}
sched, err := cron.ParseStandard(sj.Spec.Schedule) sched, err := cron.ParseStandard(sj.Spec.Schedule)
if err != nil { if err != nil {
...@@ -135,7 +135,7 @@ func getRecentUnmetScheduleTimes(sj batch.ScheduledJob, now time.Time) ([]time.T ...@@ -135,7 +135,7 @@ func getRecentUnmetScheduleTimes(sj batch.ScheduledJob, now time.Time) ([]time.T
// in kubernetes says it may need to be recreated), or that we have // in kubernetes says it may need to be recreated), or that we have
// started a job, but have not noticed it yet (distributed systems can // started a job, but have not noticed it yet (distributed systems can
// have arbitrary delays). In any case, use the creation time of the // have arbitrary delays). In any case, use the creation time of the
// ScheduledJob as last known start time. // CronJob as last known start time.
earliestTime = sj.ObjectMeta.CreationTimestamp.Time earliestTime = sj.ObjectMeta.CreationTimestamp.Time
} }
...@@ -172,8 +172,8 @@ func getRecentUnmetScheduleTimes(sj batch.ScheduledJob, now time.Time) ([]time.T ...@@ -172,8 +172,8 @@ func getRecentUnmetScheduleTimes(sj batch.ScheduledJob, now time.Time) ([]time.T
// XXX unit test this // XXX unit test this
// getJobFromTemplate makes a Job from a ScheduledJob // getJobFromTemplate makes a Job from a CronJob
func getJobFromTemplate(sj *batch.ScheduledJob, scheduledTime time.Time) (*batch.Job, error) { func getJobFromTemplate(sj *batch.CronJob, scheduledTime time.Time) (*batch.Job, error) {
// TODO: consider adding the following labels: // TODO: consider adding the following labels:
// nominal-start-time=$RFC_3339_DATE_OF_INTENDED_START -- for user convenience // nominal-start-time=$RFC_3339_DATE_OF_INTENDED_START -- for user convenience
// scheduled-job-name=$SJ_NAME -- for user convenience // scheduled-job-name=$SJ_NAME -- for user convenience
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package scheduledjob package cronjob
import ( import (
//"fmt" //"fmt"
...@@ -37,14 +37,14 @@ func TestGetJobFromTemplate(t *testing.T) { ...@@ -37,14 +37,14 @@ func TestGetJobFromTemplate(t *testing.T) {
var one int64 = 1 var one int64 = 1
var no bool = false var no bool = false
sj := batch.ScheduledJob{ sj := batch.CronJob{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: "snazzycats", Namespace: "snazzycats",
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
SelfLink: "/apis/extensions/v1beta1/namespaces/snazzycats/jobs/myscheduledjob", SelfLink: "/apis/extensions/v1beta1/namespaces/snazzycats/jobs/mycronjob",
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -77,7 +77,7 @@ func TestGetJobFromTemplate(t *testing.T) { ...@@ -77,7 +77,7 @@ func TestGetJobFromTemplate(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Did not expect error: %s", err) t.Errorf("Did not expect error: %s", err)
} }
if !strings.HasPrefix(job.ObjectMeta.Name, "myscheduledjob-") { if !strings.HasPrefix(job.ObjectMeta.Name, "mycronjob-") {
t.Errorf("Wrong Name") t.Errorf("Wrong Name")
} }
if len(job.ObjectMeta.Labels) != 1 { if len(job.ObjectMeta.Labels) != 1 {
...@@ -90,7 +90,7 @@ func TestGetJobFromTemplate(t *testing.T) { ...@@ -90,7 +90,7 @@ func TestGetJobFromTemplate(t *testing.T) {
if !ok { if !ok {
t.Errorf("Missing created-by annotation") t.Errorf("Missing created-by annotation")
} }
expectedCreatedBy := `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ScheduledJob","namespace":"snazzycats","name":"myscheduledjob","uid":"1a2b3c","apiVersion":"extensions"}} expectedCreatedBy := `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"CronJob","namespace":"snazzycats","name":"mycronjob","uid":"1a2b3c","apiVersion":"extensions"}}
` `
if len(v) != len(expectedCreatedBy) { if len(v) != len(expectedCreatedBy) {
t.Errorf("Wrong length for created-by annotation, expected %v got %v", len(expectedCreatedBy), len(v)) t.Errorf("Wrong length for created-by annotation, expected %v got %v", len(expectedCreatedBy), len(v))
...@@ -140,7 +140,7 @@ func TestGetParentUIDFromJob(t *testing.T) { ...@@ -140,7 +140,7 @@ func TestGetParentUIDFromJob(t *testing.T) {
} }
{ {
// Case 2: Has UID annotation // Case 2: Has UID annotation
j.ObjectMeta.Annotations = map[string]string{api.CreatedByAnnotation: `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ScheduledJob","namespace":"default","name":"pi","uid":"5ef034e0-1890-11e6-8935-42010af0003e","apiVersion":"extensions","resourceVersion":"427339"}}`} j.ObjectMeta.Annotations = map[string]string{api.CreatedByAnnotation: `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"CronJob","namespace":"default","name":"pi","uid":"5ef034e0-1890-11e6-8935-42010af0003e","apiVersion":"extensions","resourceVersion":"427339"}}`}
expectedUID := types.UID("5ef034e0-1890-11e6-8935-42010af0003e") expectedUID := types.UID("5ef034e0-1890-11e6-8935-42010af0003e")
...@@ -158,14 +158,14 @@ func TestGroupJobsByParent(t *testing.T) { ...@@ -158,14 +158,14 @@ func TestGroupJobsByParent(t *testing.T) {
uid1 := types.UID("11111111-1111-1111-1111-111111111111") uid1 := types.UID("11111111-1111-1111-1111-111111111111")
uid2 := types.UID("22222222-2222-2222-2222-222222222222") uid2 := types.UID("22222222-2222-2222-2222-222222222222")
uid3 := types.UID("33333333-3333-3333-3333-333333333333") uid3 := types.UID("33333333-3333-3333-3333-333333333333")
createdBy1 := map[string]string{api.CreatedByAnnotation: `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ScheduledJob","namespace":"x","name":"pi","uid":"11111111-1111-1111-1111-111111111111","apiVersion":"extensions","resourceVersion":"111111"}}`} createdBy1 := map[string]string{api.CreatedByAnnotation: `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"CronJob","namespace":"x","name":"pi","uid":"11111111-1111-1111-1111-111111111111","apiVersion":"extensions","resourceVersion":"111111"}}`}
createdBy2 := map[string]string{api.CreatedByAnnotation: `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ScheduledJob","namespace":"x","name":"pi","uid":"22222222-2222-2222-2222-222222222222","apiVersion":"extensions","resourceVersion":"222222"}}`} createdBy2 := map[string]string{api.CreatedByAnnotation: `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"CronJob","namespace":"x","name":"pi","uid":"22222222-2222-2222-2222-222222222222","apiVersion":"extensions","resourceVersion":"222222"}}`}
createdBy3 := map[string]string{api.CreatedByAnnotation: `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ScheduledJob","namespace":"y","name":"pi","uid":"33333333-3333-3333-3333-333333333333","apiVersion":"extensions","resourceVersion":"333333"}}`} createdBy3 := map[string]string{api.CreatedByAnnotation: `{"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"CronJob","namespace":"y","name":"pi","uid":"33333333-3333-3333-3333-333333333333","apiVersion":"extensions","resourceVersion":"333333"}}`}
noCreatedBy := map[string]string{} noCreatedBy := map[string]string{}
{ {
// Case 1: There are no jobs and scheduledJobs // Case 1: There are no jobs and scheduledJobs
sjs := []batch.ScheduledJob{} sjs := []batch.CronJob{}
js := []batch.Job{} js := []batch.Job{}
jobsBySj := groupJobsByParent(sjs, js) jobsBySj := groupJobsByParent(sjs, js)
if len(jobsBySj) != 0 { if len(jobsBySj) != 0 {
...@@ -175,7 +175,7 @@ func TestGroupJobsByParent(t *testing.T) { ...@@ -175,7 +175,7 @@ func TestGroupJobsByParent(t *testing.T) {
{ {
// Case 2: there is one controller with no job. // Case 2: there is one controller with no job.
sjs := []batch.ScheduledJob{ sjs := []batch.CronJob{
{ObjectMeta: api.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}}, {ObjectMeta: api.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}},
} }
js := []batch.Job{} js := []batch.Job{}
...@@ -187,7 +187,7 @@ func TestGroupJobsByParent(t *testing.T) { ...@@ -187,7 +187,7 @@ func TestGroupJobsByParent(t *testing.T) {
{ {
// Case 3: there is one controller with one job it created. // Case 3: there is one controller with one job it created.
sjs := []batch.ScheduledJob{ sjs := []batch.CronJob{
{ObjectMeta: api.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}}, {ObjectMeta: api.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}},
} }
js := []batch.Job{ js := []batch.Job{
...@@ -219,7 +219,7 @@ func TestGroupJobsByParent(t *testing.T) { ...@@ -219,7 +219,7 @@ func TestGroupJobsByParent(t *testing.T) {
{ObjectMeta: api.ObjectMeta{Name: "b", Namespace: "y", Annotations: createdBy3}}, {ObjectMeta: api.ObjectMeta{Name: "b", Namespace: "y", Annotations: createdBy3}},
{ObjectMeta: api.ObjectMeta{Name: "d", Namespace: "y", Annotations: noCreatedBy}}, {ObjectMeta: api.ObjectMeta{Name: "d", Namespace: "y", Annotations: noCreatedBy}},
} }
sjs := []batch.ScheduledJob{ sjs := []batch.CronJob{
{ObjectMeta: api.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}}, {ObjectMeta: api.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}},
{ObjectMeta: api.ObjectMeta{Name: "f", Namespace: "x", UID: uid2}}, {ObjectMeta: api.ObjectMeta{Name: "f", Namespace: "x", UID: uid2}},
{ObjectMeta: api.ObjectMeta{Name: "g", Namespace: "y", UID: uid3}}, {ObjectMeta: api.ObjectMeta{Name: "g", Namespace: "y", UID: uid3}},
...@@ -269,13 +269,13 @@ func TestGetRecentUnmetScheduleTimes(t *testing.T) { ...@@ -269,13 +269,13 @@ func TestGetRecentUnmetScheduleTimes(t *testing.T) {
t.Errorf("test setup error: %v", err) t.Errorf("test setup error: %v", err)
} }
sj := batch.ScheduledJob{ sj := batch.CronJob{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"), UID: types.UID("1a2b3c"),
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: schedule, Schedule: schedule,
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{}, JobTemplate: batch.JobTemplateSpec{},
......
...@@ -81,7 +81,7 @@ var ( ...@@ -81,7 +81,7 @@ var (
# Start the perl container to compute π to 2000 places and print it out. # Start the perl container to compute π to 2000 places and print it out.
kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)' kubectl run pi --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'
# Start the scheduled job to compute π to 2000 places and print it out every 5 minutes. # Start the cron job to compute π to 2000 places and print it out every 5 minutes.
kubectl run pi --schedule="0/5 * * * ?" --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'`) kubectl run pi --schedule="0/5 * * * ?" --image=perl --restart=OnFailure -- perl -Mbignum=bpi -wle 'print bpi(2000)'`)
) )
...@@ -197,7 +197,7 @@ func Run(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobr ...@@ -197,7 +197,7 @@ func Run(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobr
generatorName := cmdutil.GetFlagString(cmd, "generator") generatorName := cmdutil.GetFlagString(cmd, "generator")
schedule := cmdutil.GetFlagString(cmd, "schedule") schedule := cmdutil.GetFlagString(cmd, "schedule")
if len(schedule) != 0 && len(generatorName) == 0 { if len(schedule) != 0 && len(generatorName) == 0 {
generatorName = "scheduledjob/v2alpha1" generatorName = "cronjob/v2alpha1"
} }
if len(generatorName) == 0 { if len(generatorName) == 0 {
clientset, err := f.ClientSet() clientset, err := f.ClientSet()
......
...@@ -198,7 +198,7 @@ const ( ...@@ -198,7 +198,7 @@ const (
DeploymentBasicV1Beta1GeneratorName = "deployment-basic/v1beta1" DeploymentBasicV1Beta1GeneratorName = "deployment-basic/v1beta1"
JobV1Beta1GeneratorName = "job/v1beta1" JobV1Beta1GeneratorName = "job/v1beta1"
JobV1GeneratorName = "job/v1" JobV1GeneratorName = "job/v1"
ScheduledJobV2Alpha1GeneratorName = "scheduledjob/v2alpha1" CronJobV2Alpha1GeneratorName = "cronjob/v2alpha1"
NamespaceV1GeneratorName = "namespace/v1" NamespaceV1GeneratorName = "namespace/v1"
ResourceQuotaV1GeneratorName = "resourcequotas/v1" ResourceQuotaV1GeneratorName = "resourcequotas/v1"
SecretV1GeneratorName = "secret/v1" SecretV1GeneratorName = "secret/v1"
...@@ -235,12 +235,12 @@ func DefaultGenerators(cmdName string) map[string]kubectl.Generator { ...@@ -235,12 +235,12 @@ func DefaultGenerators(cmdName string) map[string]kubectl.Generator {
} }
case "run": case "run":
generator = map[string]kubectl.Generator{ generator = map[string]kubectl.Generator{
RunV1GeneratorName: kubectl.BasicReplicationController{}, RunV1GeneratorName: kubectl.BasicReplicationController{},
RunPodV1GeneratorName: kubectl.BasicPod{}, RunPodV1GeneratorName: kubectl.BasicPod{},
DeploymentV1Beta1GeneratorName: kubectl.DeploymentV1Beta1{}, DeploymentV1Beta1GeneratorName: kubectl.DeploymentV1Beta1{},
JobV1Beta1GeneratorName: kubectl.JobV1Beta1{}, JobV1Beta1GeneratorName: kubectl.JobV1Beta1{},
JobV1GeneratorName: kubectl.JobV1{}, JobV1GeneratorName: kubectl.JobV1{},
ScheduledJobV2Alpha1GeneratorName: kubectl.ScheduledJobV2Alpha1{}, CronJobV2Alpha1GeneratorName: kubectl.CronJobV2Alpha1{},
} }
case "autoscale": case "autoscale":
generator = map[string]kubectl.Generator{ generator = map[string]kubectl.Generator{
......
...@@ -116,7 +116,7 @@ func describerMap(c clientset.Interface) map[unversioned.GroupKind]Describer { ...@@ -116,7 +116,7 @@ func describerMap(c clientset.Interface) map[unversioned.GroupKind]Describer {
extensions.Kind("Job"): &JobDescriber{c}, extensions.Kind("Job"): &JobDescriber{c},
extensions.Kind("Ingress"): &IngressDescriber{c}, extensions.Kind("Ingress"): &IngressDescriber{c},
batch.Kind("Job"): &JobDescriber{c}, batch.Kind("Job"): &JobDescriber{c},
batch.Kind("ScheduledJob"): &ScheduledJobDescriber{c}, batch.Kind("CronJob"): &CronJobDescriber{c},
apps.Kind("StatefulSet"): &StatefulSetDescriber{c}, apps.Kind("StatefulSet"): &StatefulSetDescriber{c},
certificates.Kind("CertificateSigningRequest"): &CertificateSigningRequestDescriber{c}, certificates.Kind("CertificateSigningRequest"): &CertificateSigningRequestDescriber{c},
storage.Kind("StorageClass"): &StorageClassDescriber{c}, storage.Kind("StorageClass"): &StorageClassDescriber{c},
...@@ -1222,13 +1222,13 @@ func describeJob(job *batch.Job, events *api.EventList) (string, error) { ...@@ -1222,13 +1222,13 @@ func describeJob(job *batch.Job, events *api.EventList) (string, error) {
}) })
} }
// ScheduledJobDescriber generates information about a scheduled job and the jobs it has created. // CronJobDescriber generates information about a scheduled job and the jobs it has created.
type ScheduledJobDescriber struct { type CronJobDescriber struct {
clientset.Interface clientset.Interface
} }
func (d *ScheduledJobDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (string, error) { func (d *CronJobDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (string, error) {
scheduledJob, err := d.Batch().ScheduledJobs(namespace).Get(name) scheduledJob, err := d.Batch().CronJobs(namespace).Get(name)
if err != nil { if err != nil {
return "", err return "", err
} }
...@@ -1238,10 +1238,10 @@ func (d *ScheduledJobDescriber) Describe(namespace, name string, describerSettin ...@@ -1238,10 +1238,10 @@ func (d *ScheduledJobDescriber) Describe(namespace, name string, describerSettin
events, _ = d.Core().Events(namespace).Search(scheduledJob) events, _ = d.Core().Events(namespace).Search(scheduledJob)
} }
return describeScheduledJob(scheduledJob, events) return describeCronJob(scheduledJob, events)
} }
func describeScheduledJob(scheduledJob *batch.ScheduledJob, events *api.EventList) (string, error) { func describeCronJob(scheduledJob *batch.CronJob, events *api.EventList) (string, error) {
return tabbedString(func(out io.Writer) error { return tabbedString(func(out io.Writer) error {
fmt.Fprintf(out, "Name:\t%s\n", scheduledJob.Name) fmt.Fprintf(out, "Name:\t%s\n", scheduledJob.Name)
fmt.Fprintf(out, "Namespace:\t%s\n", scheduledJob.Namespace) fmt.Fprintf(out, "Namespace:\t%s\n", scheduledJob.Namespace)
......
...@@ -477,7 +477,7 @@ var ( ...@@ -477,7 +477,7 @@ var (
replicationControllerColumns = []string{"NAME", "DESIRED", "CURRENT", "READY", "AGE"} replicationControllerColumns = []string{"NAME", "DESIRED", "CURRENT", "READY", "AGE"}
replicaSetColumns = []string{"NAME", "DESIRED", "CURRENT", "READY", "AGE"} replicaSetColumns = []string{"NAME", "DESIRED", "CURRENT", "READY", "AGE"}
jobColumns = []string{"NAME", "DESIRED", "SUCCESSFUL", "AGE"} jobColumns = []string{"NAME", "DESIRED", "SUCCESSFUL", "AGE"}
scheduledJobColumns = []string{"NAME", "SCHEDULE", "SUSPEND", "ACTIVE", "LAST-SCHEDULE"} cronJobColumns = []string{"NAME", "SCHEDULE", "SUSPEND", "ACTIVE", "LAST-SCHEDULE"}
serviceColumns = []string{"NAME", "CLUSTER-IP", "EXTERNAL-IP", "PORT(S)", "AGE"} serviceColumns = []string{"NAME", "CLUSTER-IP", "EXTERNAL-IP", "PORT(S)", "AGE"}
ingressColumns = []string{"NAME", "HOSTS", "ADDRESS", "PORTS", "AGE"} ingressColumns = []string{"NAME", "HOSTS", "ADDRESS", "PORTS", "AGE"}
statefulSetColumns = []string{"NAME", "DESIRED", "CURRENT", "AGE"} statefulSetColumns = []string{"NAME", "DESIRED", "CURRENT", "AGE"}
...@@ -544,8 +544,8 @@ func (h *HumanReadablePrinter) addDefaultHandlers() { ...@@ -544,8 +544,8 @@ func (h *HumanReadablePrinter) addDefaultHandlers() {
h.Handler(daemonSetColumns, printDaemonSetList) h.Handler(daemonSetColumns, printDaemonSetList)
h.Handler(jobColumns, printJob) h.Handler(jobColumns, printJob)
h.Handler(jobColumns, printJobList) h.Handler(jobColumns, printJobList)
h.Handler(scheduledJobColumns, printScheduledJob) h.Handler(cronJobColumns, printCronJob)
h.Handler(scheduledJobColumns, printScheduledJobList) h.Handler(cronJobColumns, printCronJobList)
h.Handler(serviceColumns, printService) h.Handler(serviceColumns, printService)
h.Handler(serviceColumns, printServiceList) h.Handler(serviceColumns, printServiceList)
h.Handler(ingressColumns, printIngress) h.Handler(ingressColumns, printIngress)
...@@ -1028,9 +1028,9 @@ func printJobList(list *batch.JobList, w io.Writer, options PrintOptions) error ...@@ -1028,9 +1028,9 @@ func printJobList(list *batch.JobList, w io.Writer, options PrintOptions) error
return nil return nil
} }
func printScheduledJob(scheduledJob *batch.ScheduledJob, w io.Writer, options PrintOptions) error { func printCronJob(cronJob *batch.CronJob, w io.Writer, options PrintOptions) error {
name := scheduledJob.Name name := cronJob.Name
namespace := scheduledJob.Namespace namespace := cronJob.Namespace
if options.WithNamespace { if options.WithNamespace {
if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil { if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil {
...@@ -1039,14 +1039,14 @@ func printScheduledJob(scheduledJob *batch.ScheduledJob, w io.Writer, options Pr ...@@ -1039,14 +1039,14 @@ func printScheduledJob(scheduledJob *batch.ScheduledJob, w io.Writer, options Pr
} }
lastScheduleTime := "<none>" lastScheduleTime := "<none>"
if scheduledJob.Status.LastScheduleTime != nil { if cronJob.Status.LastScheduleTime != nil {
lastScheduleTime = scheduledJob.Status.LastScheduleTime.Time.Format(time.RFC1123Z) lastScheduleTime = cronJob.Status.LastScheduleTime.Time.Format(time.RFC1123Z)
} }
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%d\t%s\n", if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%d\t%s\n",
name, name,
scheduledJob.Spec.Schedule, cronJob.Spec.Schedule,
printBoolPtr(scheduledJob.Spec.Suspend), printBoolPtr(cronJob.Spec.Suspend),
len(scheduledJob.Status.Active), len(cronJob.Status.Active),
lastScheduleTime, lastScheduleTime,
); err != nil { ); err != nil {
return err return err
...@@ -1055,9 +1055,9 @@ func printScheduledJob(scheduledJob *batch.ScheduledJob, w io.Writer, options Pr ...@@ -1055,9 +1055,9 @@ func printScheduledJob(scheduledJob *batch.ScheduledJob, w io.Writer, options Pr
return nil return nil
} }
func printScheduledJobList(list *batch.ScheduledJobList, w io.Writer, options PrintOptions) error { func printCronJobList(list *batch.CronJobList, w io.Writer, options PrintOptions) error {
for _, scheduledJob := range list.Items { for _, cronJob := range list.Items {
if err := printScheduledJob(&scheduledJob, w, options); err != nil { if err := printCronJob(&cronJob, w, options); err != nil {
return err return err
} }
} }
......
...@@ -401,9 +401,9 @@ func (JobV1) Generate(genericParams map[string]interface{}) (runtime.Object, err ...@@ -401,9 +401,9 @@ func (JobV1) Generate(genericParams map[string]interface{}) (runtime.Object, err
return &job, nil return &job, nil
} }
type ScheduledJobV2Alpha1 struct{} type CronJobV2Alpha1 struct{}
func (ScheduledJobV2Alpha1) ParamNames() []GeneratorParam { func (CronJobV2Alpha1) ParamNames() []GeneratorParam {
return []GeneratorParam{ return []GeneratorParam{
{"labels", false}, {"labels", false},
{"default-name", false}, {"default-name", false},
...@@ -425,7 +425,7 @@ func (ScheduledJobV2Alpha1) ParamNames() []GeneratorParam { ...@@ -425,7 +425,7 @@ func (ScheduledJobV2Alpha1) ParamNames() []GeneratorParam {
} }
} }
func (ScheduledJobV2Alpha1) Generate(genericParams map[string]interface{}) (runtime.Object, error) { func (CronJobV2Alpha1) Generate(genericParams map[string]interface{}) (runtime.Object, error) {
args, err := getArgs(genericParams) args, err := getArgs(genericParams)
if err != nil { if err != nil {
return nil, err return nil, err
...@@ -477,12 +477,12 @@ func (ScheduledJobV2Alpha1) Generate(genericParams map[string]interface{}) (runt ...@@ -477,12 +477,12 @@ func (ScheduledJobV2Alpha1) Generate(genericParams map[string]interface{}) (runt
} }
podSpec.RestartPolicy = restartPolicy podSpec.RestartPolicy = restartPolicy
scheduledJob := batchv2alpha1.ScheduledJob{ cronJob := batchv2alpha1.CronJob{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: name, Name: name,
Labels: labels, Labels: labels,
}, },
Spec: batchv2alpha1.ScheduledJobSpec{ Spec: batchv2alpha1.CronJobSpec{
Schedule: params["schedule"], Schedule: params["schedule"],
ConcurrencyPolicy: batchv2alpha1.AllowConcurrent, ConcurrencyPolicy: batchv2alpha1.AllowConcurrent,
JobTemplate: batchv2alpha1.JobTemplateSpec{ JobTemplate: batchv2alpha1.JobTemplateSpec{
...@@ -498,7 +498,7 @@ func (ScheduledJobV2Alpha1) Generate(genericParams map[string]interface{}) (runt ...@@ -498,7 +498,7 @@ func (ScheduledJobV2Alpha1) Generate(genericParams map[string]interface{}) (runt
}, },
} }
return &scheduledJob, nil return &cronJob, nil
} }
type BasicReplicationController struct{} type BasicReplicationController struct{}
......
...@@ -14,6 +14,6 @@ See the License for the specific language governing permissions and ...@@ -14,6 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// Package scheduledjob provides Registry interface and it's RESTStorage // Package cronjob provides Registry interface and it's RESTStorage
// implementation for storing ScheduledJob api objects. // implementation for storing ScheduledJob api objects.
package scheduledjob // import "k8s.io/kubernetes/pkg/registry/batch/scheduledjob" package cronjob // import "k8s.io/kubernetes/pkg/registry/batch/cronjob"
...@@ -18,7 +18,7 @@ go_library( ...@@ -18,7 +18,7 @@ go_library(
"//pkg/api:go_default_library", "//pkg/api:go_default_library",
"//pkg/api/rest:go_default_library", "//pkg/api/rest:go_default_library",
"//pkg/apis/batch:go_default_library", "//pkg/apis/batch:go_default_library",
"//pkg/registry/batch/scheduledjob:go_default_library", "//pkg/registry/batch/cronjob:go_default_library",
"//pkg/registry/cachesize:go_default_library", "//pkg/registry/cachesize:go_default_library",
"//pkg/registry/generic:go_default_library", "//pkg/registry/generic:go_default_library",
"//pkg/registry/generic/registry:go_default_library", "//pkg/registry/generic/registry:go_default_library",
......
...@@ -20,7 +20,7 @@ import ( ...@@ -20,7 +20,7 @@ import (
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/rest" "k8s.io/kubernetes/pkg/api/rest"
"k8s.io/kubernetes/pkg/apis/batch" "k8s.io/kubernetes/pkg/apis/batch"
"k8s.io/kubernetes/pkg/registry/batch/scheduledjob" "k8s.io/kubernetes/pkg/registry/batch/cronjob"
"k8s.io/kubernetes/pkg/registry/cachesize" "k8s.io/kubernetes/pkg/registry/cachesize"
"k8s.io/kubernetes/pkg/registry/generic" "k8s.io/kubernetes/pkg/registry/generic"
"k8s.io/kubernetes/pkg/registry/generic/registry" "k8s.io/kubernetes/pkg/registry/generic/registry"
...@@ -33,23 +33,23 @@ type REST struct { ...@@ -33,23 +33,23 @@ type REST struct {
*registry.Store *registry.Store
} }
// NewREST returns a RESTStorage object that will work against ScheduledJobs. // NewREST returns a RESTStorage object that will work against CronJobs.
func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) { func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
prefix := "/" + opts.ResourcePrefix prefix := "/" + opts.ResourcePrefix
newListFunc := func() runtime.Object { return &batch.ScheduledJobList{} } newListFunc := func() runtime.Object { return &batch.CronJobList{} }
storageInterface, dFunc := opts.Decorator( storageInterface, dFunc := opts.Decorator(
opts.StorageConfig, opts.StorageConfig,
cachesize.GetWatchCacheSizeByResource(cachesize.ScheduledJobs), cachesize.GetWatchCacheSizeByResource(cachesize.CronJobs),
&batch.ScheduledJob{}, &batch.CronJob{},
prefix, prefix,
scheduledjob.Strategy, cronjob.Strategy,
newListFunc, newListFunc,
storage.NoTriggerPublisher, storage.NoTriggerPublisher,
) )
store := &registry.Store{ store := &registry.Store{
NewFunc: func() runtime.Object { return &batch.ScheduledJob{} }, NewFunc: func() runtime.Object { return &batch.CronJob{} },
// NewListFunc returns an object capable of storing results of an etcd list. // NewListFunc returns an object capable of storing results of an etcd list.
NewListFunc: newListFunc, NewListFunc: newListFunc,
...@@ -65,27 +65,27 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) { ...@@ -65,27 +65,27 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
}, },
// Retrieve the name field of a scheduled job // Retrieve the name field of a scheduled job
ObjectNameFunc: func(obj runtime.Object) (string, error) { ObjectNameFunc: func(obj runtime.Object) (string, error) {
return obj.(*batch.ScheduledJob).Name, nil return obj.(*batch.CronJob).Name, nil
}, },
// Used to match objects based on labels/fields for list and watch // Used to match objects based on labels/fields for list and watch
PredicateFunc: scheduledjob.MatchScheduledJob, PredicateFunc: cronjob.MatchCronJob,
QualifiedResource: batch.Resource("scheduledjobs"), QualifiedResource: batch.Resource("cronjobs"),
EnableGarbageCollection: opts.EnableGarbageCollection, EnableGarbageCollection: opts.EnableGarbageCollection,
DeleteCollectionWorkers: opts.DeleteCollectionWorkers, DeleteCollectionWorkers: opts.DeleteCollectionWorkers,
// Used to validate scheduled job creation // Used to validate scheduled job creation
CreateStrategy: scheduledjob.Strategy, CreateStrategy: cronjob.Strategy,
// Used to validate scheduled job updates // Used to validate scheduled job updates
UpdateStrategy: scheduledjob.Strategy, UpdateStrategy: cronjob.Strategy,
DeleteStrategy: scheduledjob.Strategy, DeleteStrategy: cronjob.Strategy,
Storage: storageInterface, Storage: storageInterface,
DestroyFunc: dFunc, DestroyFunc: dFunc,
} }
statusStore := *store statusStore := *store
statusStore.UpdateStrategy = scheduledjob.StatusStrategy statusStore.UpdateStrategy = cronjob.StatusStrategy
return &REST{store}, &StatusREST{store: &statusStore} return &REST{store}, &StatusREST{store: &statusStore}
} }
...@@ -96,7 +96,7 @@ type StatusREST struct { ...@@ -96,7 +96,7 @@ type StatusREST struct {
} }
func (r *StatusREST) New() runtime.Object { func (r *StatusREST) New() runtime.Object {
return &batch.ScheduledJob{} return &batch.CronJob{}
} }
// Get retrieves the object from the storage. It is required to support Patch. // Get retrieves the object from the storage. It is required to support Patch.
......
...@@ -38,13 +38,13 @@ func newStorage(t *testing.T) (*REST, *StatusREST, *etcdtesting.EtcdTestServer) ...@@ -38,13 +38,13 @@ func newStorage(t *testing.T) (*REST, *StatusREST, *etcdtesting.EtcdTestServer)
return storage, statusStorage, server return storage, statusStorage, server
} }
func validNewScheduledJob() *batch.ScheduledJob { func validNewCronJob() *batch.CronJob {
return &batch.ScheduledJob{ return &batch.CronJob{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "foo", Name: "foo",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -72,14 +72,14 @@ func TestCreate(t *testing.T) { ...@@ -72,14 +72,14 @@ func TestCreate(t *testing.T) {
defer server.Terminate(t) defer server.Terminate(t)
defer storage.Store.DestroyFunc() defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store)
validScheduledJob := validNewScheduledJob() validCronJob := validNewCronJob()
validScheduledJob.ObjectMeta = api.ObjectMeta{} validCronJob.ObjectMeta = api.ObjectMeta{}
test.TestCreate( test.TestCreate(
// valid // valid
validScheduledJob, validCronJob,
// invalid (empty spec) // invalid (empty spec)
&batch.ScheduledJob{ &batch.CronJob{
Spec: batch.ScheduledJobSpec{}, Spec: batch.CronJobSpec{},
}, },
) )
} }
...@@ -97,16 +97,16 @@ func TestUpdate(t *testing.T) { ...@@ -97,16 +97,16 @@ func TestUpdate(t *testing.T) {
schedule := "1 1 1 1 ?" schedule := "1 1 1 1 ?"
test.TestUpdate( test.TestUpdate(
// valid // valid
validNewScheduledJob(), validNewCronJob(),
// updateFunc // updateFunc
func(obj runtime.Object) runtime.Object { func(obj runtime.Object) runtime.Object {
object := obj.(*batch.ScheduledJob) object := obj.(*batch.CronJob)
object.Spec.Schedule = schedule object.Spec.Schedule = schedule
return object return object
}, },
// invalid updateFunc // invalid updateFunc
func(obj runtime.Object) runtime.Object { func(obj runtime.Object) runtime.Object {
object := obj.(*batch.ScheduledJob) object := obj.(*batch.CronJob)
object.Spec.Schedule = "* * *" object.Spec.Schedule = "* * *"
return object return object
}, },
...@@ -123,7 +123,7 @@ func TestDelete(t *testing.T) { ...@@ -123,7 +123,7 @@ func TestDelete(t *testing.T) {
defer server.Terminate(t) defer server.Terminate(t)
defer storage.Store.DestroyFunc() defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store)
test.TestDelete(validNewScheduledJob()) test.TestDelete(validNewCronJob())
} }
func TestGet(t *testing.T) { func TestGet(t *testing.T) {
...@@ -136,7 +136,7 @@ func TestGet(t *testing.T) { ...@@ -136,7 +136,7 @@ func TestGet(t *testing.T) {
defer server.Terminate(t) defer server.Terminate(t)
defer storage.Store.DestroyFunc() defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store)
test.TestGet(validNewScheduledJob()) test.TestGet(validNewCronJob())
} }
func TestList(t *testing.T) { func TestList(t *testing.T) {
...@@ -149,7 +149,7 @@ func TestList(t *testing.T) { ...@@ -149,7 +149,7 @@ func TestList(t *testing.T) {
defer server.Terminate(t) defer server.Terminate(t)
defer storage.Store.DestroyFunc() defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store)
test.TestList(validNewScheduledJob()) test.TestList(validNewCronJob())
} }
func TestWatch(t *testing.T) { func TestWatch(t *testing.T) {
...@@ -163,7 +163,7 @@ func TestWatch(t *testing.T) { ...@@ -163,7 +163,7 @@ func TestWatch(t *testing.T) {
defer storage.Store.DestroyFunc() defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store) test := registrytest.New(t, storage.Store)
test.TestWatch( test.TestWatch(
validNewScheduledJob(), validNewCronJob(),
// matching labels // matching labels
[]labels.Set{}, []labels.Set{},
// not matching labels // not matching labels
......
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package scheduledjob package cronjob
import ( import (
"fmt" "fmt"
...@@ -36,7 +36,7 @@ type scheduledJobStrategy struct { ...@@ -36,7 +36,7 @@ type scheduledJobStrategy struct {
api.NameGenerator api.NameGenerator
} }
// Strategy is the default logic that applies when creating and updating ScheduledJob objects. // Strategy is the default logic that applies when creating and updating CronJob objects.
var Strategy = scheduledJobStrategy{api.Scheme, api.SimpleNameGenerator} var Strategy = scheduledJobStrategy{api.Scheme, api.SimpleNameGenerator}
// NamespaceScoped returns true because all scheduled jobs need to be within a namespace. // NamespaceScoped returns true because all scheduled jobs need to be within a namespace.
...@@ -46,21 +46,21 @@ func (scheduledJobStrategy) NamespaceScoped() bool { ...@@ -46,21 +46,21 @@ func (scheduledJobStrategy) NamespaceScoped() bool {
// PrepareForCreate clears the status of a scheduled job before creation. // PrepareForCreate clears the status of a scheduled job before creation.
func (scheduledJobStrategy) PrepareForCreate(ctx api.Context, obj runtime.Object) { func (scheduledJobStrategy) PrepareForCreate(ctx api.Context, obj runtime.Object) {
scheduledJob := obj.(*batch.ScheduledJob) scheduledJob := obj.(*batch.CronJob)
scheduledJob.Status = batch.ScheduledJobStatus{} scheduledJob.Status = batch.CronJobStatus{}
} }
// PrepareForUpdate clears fields that are not allowed to be set by end users on update. // PrepareForUpdate clears fields that are not allowed to be set by end users on update.
func (scheduledJobStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) { func (scheduledJobStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) {
newScheduledJob := obj.(*batch.ScheduledJob) newCronJob := obj.(*batch.CronJob)
oldScheduledJob := old.(*batch.ScheduledJob) oldCronJob := old.(*batch.CronJob)
newScheduledJob.Status = oldScheduledJob.Status newCronJob.Status = oldCronJob.Status
} }
// Validate validates a new scheduled job. // Validate validates a new scheduled job.
func (scheduledJobStrategy) Validate(ctx api.Context, obj runtime.Object) field.ErrorList { func (scheduledJobStrategy) Validate(ctx api.Context, obj runtime.Object) field.ErrorList {
scheduledJob := obj.(*batch.ScheduledJob) scheduledJob := obj.(*batch.CronJob)
return validation.ValidateScheduledJob(scheduledJob) return validation.ValidateCronJob(scheduledJob)
} }
// Canonicalize normalizes the object after validation. // Canonicalize normalizes the object after validation.
...@@ -78,7 +78,7 @@ func (scheduledJobStrategy) AllowCreateOnUpdate() bool { ...@@ -78,7 +78,7 @@ func (scheduledJobStrategy) AllowCreateOnUpdate() bool {
// ValidateUpdate is the default update validation for an end user. // ValidateUpdate is the default update validation for an end user.
func (scheduledJobStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList { func (scheduledJobStrategy) ValidateUpdate(ctx api.Context, obj, old runtime.Object) field.ErrorList {
return validation.ValidateScheduledJob(obj.(*batch.ScheduledJob)) return validation.ValidateCronJob(obj.(*batch.CronJob))
} }
type scheduledJobStatusStrategy struct { type scheduledJobStatusStrategy struct {
...@@ -88,8 +88,8 @@ type scheduledJobStatusStrategy struct { ...@@ -88,8 +88,8 @@ type scheduledJobStatusStrategy struct {
var StatusStrategy = scheduledJobStatusStrategy{Strategy} var StatusStrategy = scheduledJobStatusStrategy{Strategy}
func (scheduledJobStatusStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) { func (scheduledJobStatusStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) {
newJob := obj.(*batch.ScheduledJob) newJob := obj.(*batch.CronJob)
oldJob := old.(*batch.ScheduledJob) oldJob := old.(*batch.CronJob)
newJob.Spec = oldJob.Spec newJob.Spec = oldJob.Spec
} }
...@@ -97,24 +97,24 @@ func (scheduledJobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runti ...@@ -97,24 +97,24 @@ func (scheduledJobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runti
return field.ErrorList{} return field.ErrorList{}
} }
// ScheduledJobToSelectableFields returns a field set that represents the object for matching purposes. // CronJobToSelectableFields returns a field set that represents the object for matching purposes.
func ScheduledJobToSelectableFields(scheduledJob *batch.ScheduledJob) fields.Set { func CronJobToSelectableFields(scheduledJob *batch.CronJob) fields.Set {
return generic.ObjectMetaFieldsSet(&scheduledJob.ObjectMeta, true) return generic.ObjectMetaFieldsSet(&scheduledJob.ObjectMeta, true)
} }
// MatchScheduledJob is the filter used by the generic etcd backend to route // MatchCronJob is the filter used by the generic etcd backend to route
// watch events from etcd to clients of the apiserver only interested in specific // watch events from etcd to clients of the apiserver only interested in specific
// labels/fields. // labels/fields.
func MatchScheduledJob(label labels.Selector, field fields.Selector) storage.SelectionPredicate { func MatchCronJob(label labels.Selector, field fields.Selector) storage.SelectionPredicate {
return storage.SelectionPredicate{ return storage.SelectionPredicate{
Label: label, Label: label,
Field: field, Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) { GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
scheduledJob, ok := obj.(*batch.ScheduledJob) scheduledJob, ok := obj.(*batch.CronJob)
if !ok { if !ok {
return nil, nil, fmt.Errorf("Given object is not a scheduled job.") return nil, nil, fmt.Errorf("Given object is not a scheduled job.")
} }
return labels.Set(scheduledJob.ObjectMeta.Labels), ScheduledJobToSelectableFields(scheduledJob), nil return labels.Set(scheduledJob.ObjectMeta.Labels), CronJobToSelectableFields(scheduledJob), nil
}, },
} }
} }
...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and ...@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package scheduledjob package cronjob
import ( import (
"testing" "testing"
...@@ -31,13 +31,13 @@ func newBool(a bool) *bool { ...@@ -31,13 +31,13 @@ func newBool(a bool) *bool {
return r return r
} }
func TestScheduledJobStrategy(t *testing.T) { func TestCronJobStrategy(t *testing.T) {
ctx := api.NewDefaultContext() ctx := api.NewDefaultContext()
if !Strategy.NamespaceScoped() { if !Strategy.NamespaceScoped() {
t.Errorf("ScheduledJob must be namespace scoped") t.Errorf("CronJob must be namespace scoped")
} }
if Strategy.AllowCreateOnUpdate() { if Strategy.AllowCreateOnUpdate() {
t.Errorf("ScheduledJob should not allow create on update") t.Errorf("CronJob should not allow create on update")
} }
validPodTemplateSpec := api.PodTemplateSpec{ validPodTemplateSpec := api.PodTemplateSpec{
...@@ -47,12 +47,12 @@ func TestScheduledJobStrategy(t *testing.T) { ...@@ -47,12 +47,12 @@ func TestScheduledJobStrategy(t *testing.T) {
Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}}, Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}},
}, },
} }
scheduledJob := &batch.ScheduledJob{ scheduledJob := &batch.CronJob{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "* * * * ?", Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -65,41 +65,41 @@ func TestScheduledJobStrategy(t *testing.T) { ...@@ -65,41 +65,41 @@ func TestScheduledJobStrategy(t *testing.T) {
Strategy.PrepareForCreate(ctx, scheduledJob) Strategy.PrepareForCreate(ctx, scheduledJob)
if len(scheduledJob.Status.Active) != 0 { if len(scheduledJob.Status.Active) != 0 {
t.Errorf("ScheduledJob does not allow setting status on create") t.Errorf("CronJob does not allow setting status on create")
} }
errs := Strategy.Validate(ctx, scheduledJob) errs := Strategy.Validate(ctx, scheduledJob)
if len(errs) != 0 { if len(errs) != 0 {
t.Errorf("Unexpected error validating %v", errs) t.Errorf("Unexpected error validating %v", errs)
} }
now := unversioned.Now() now := unversioned.Now()
updatedScheduledJob := &batch.ScheduledJob{ updatedCronJob := &batch.CronJob{
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "4"}, ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "4"},
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "5 5 5 * ?", Schedule: "5 5 5 * ?",
}, },
Status: batch.ScheduledJobStatus{ Status: batch.CronJobStatus{
LastScheduleTime: &now, LastScheduleTime: &now,
}, },
} }
// ensure we do not change status // ensure we do not change status
Strategy.PrepareForUpdate(ctx, updatedScheduledJob, scheduledJob) Strategy.PrepareForUpdate(ctx, updatedCronJob, scheduledJob)
if updatedScheduledJob.Status.Active != nil { if updatedCronJob.Status.Active != nil {
t.Errorf("PrepareForUpdate should have preserved prior version status") t.Errorf("PrepareForUpdate should have preserved prior version status")
} }
errs = Strategy.ValidateUpdate(ctx, updatedScheduledJob, scheduledJob) errs = Strategy.ValidateUpdate(ctx, updatedCronJob, scheduledJob)
if len(errs) == 0 { if len(errs) == 0 {
t.Errorf("Expected a validation error") t.Errorf("Expected a validation error")
} }
} }
func TestScheduledJobStatusStrategy(t *testing.T) { func TestCronJobStatusStrategy(t *testing.T) {
ctx := api.NewDefaultContext() ctx := api.NewDefaultContext()
if !StatusStrategy.NamespaceScoped() { if !StatusStrategy.NamespaceScoped() {
t.Errorf("ScheduledJob must be namespace scoped") t.Errorf("CronJob must be namespace scoped")
} }
if StatusStrategy.AllowCreateOnUpdate() { if StatusStrategy.AllowCreateOnUpdate() {
t.Errorf("ScheduledJob should not allow create on update") t.Errorf("CronJob should not allow create on update")
} }
validPodTemplateSpec := api.PodTemplateSpec{ validPodTemplateSpec := api.PodTemplateSpec{
Spec: api.PodSpec{ Spec: api.PodSpec{
...@@ -109,13 +109,13 @@ func TestScheduledJobStatusStrategy(t *testing.T) { ...@@ -109,13 +109,13 @@ func TestScheduledJobStatusStrategy(t *testing.T) {
}, },
} }
oldSchedule := "* * * * ?" oldSchedule := "* * * * ?"
oldScheduledJob := &batch.ScheduledJob{ oldCronJob := &batch.CronJob{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
ResourceVersion: "10", ResourceVersion: "10",
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: oldSchedule, Schedule: oldSchedule,
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -126,13 +126,13 @@ func TestScheduledJobStatusStrategy(t *testing.T) { ...@@ -126,13 +126,13 @@ func TestScheduledJobStatusStrategy(t *testing.T) {
}, },
} }
now := unversioned.Now() now := unversioned.Now()
newScheduledJob := &batch.ScheduledJob{ newCronJob := &batch.CronJob{
ObjectMeta: api.ObjectMeta{ ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob", Name: "mycronjob",
Namespace: api.NamespaceDefault, Namespace: api.NamespaceDefault,
ResourceVersion: "9", ResourceVersion: "9",
}, },
Spec: batch.ScheduledJobSpec{ Spec: batch.CronJobSpec{
Schedule: "5 5 * * ?", Schedule: "5 5 * * ?",
ConcurrencyPolicy: batch.AllowConcurrent, ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{ JobTemplate: batch.JobTemplateSpec{
...@@ -141,23 +141,23 @@ func TestScheduledJobStatusStrategy(t *testing.T) { ...@@ -141,23 +141,23 @@ func TestScheduledJobStatusStrategy(t *testing.T) {
}, },
}, },
}, },
Status: batch.ScheduledJobStatus{ Status: batch.CronJobStatus{
LastScheduleTime: &now, LastScheduleTime: &now,
}, },
} }
StatusStrategy.PrepareForUpdate(ctx, newScheduledJob, oldScheduledJob) StatusStrategy.PrepareForUpdate(ctx, newCronJob, oldCronJob)
if newScheduledJob.Status.LastScheduleTime == nil { if newCronJob.Status.LastScheduleTime == nil {
t.Errorf("ScheduledJob status updates must allow changes to scheduledJob status") t.Errorf("CronJob status updates must allow changes to scheduledJob status")
} }
if newScheduledJob.Spec.Schedule != oldSchedule { if newCronJob.Spec.Schedule != oldSchedule {
t.Errorf("ScheduledJob status updates must now allow changes to scheduledJob spec") t.Errorf("CronJob status updates must now allow changes to scheduledJob spec")
} }
errs := StatusStrategy.ValidateUpdate(ctx, newScheduledJob, oldScheduledJob) errs := StatusStrategy.ValidateUpdate(ctx, newCronJob, oldCronJob)
if len(errs) != 0 { if len(errs) != 0 {
t.Errorf("Unexpected error %v", errs) t.Errorf("Unexpected error %v", errs)
} }
if newScheduledJob.ResourceVersion != "9" { if newCronJob.ResourceVersion != "9" {
t.Errorf("Incoming resource version on update should not be mutated") t.Errorf("Incoming resource version on update should not be mutated")
} }
} }
...@@ -166,8 +166,8 @@ func TestScheduledJobStatusStrategy(t *testing.T) { ...@@ -166,8 +166,8 @@ func TestScheduledJobStatusStrategy(t *testing.T) {
func TestSelectableFieldLabelConversions(t *testing.T) { func TestSelectableFieldLabelConversions(t *testing.T) {
apitesting.TestSelectableFieldLabelConversionsOfKind(t, apitesting.TestSelectableFieldLabelConversionsOfKind(t,
"batch/v2alpha1", "batch/v2alpha1",
"ScheduledJob", "CronJob",
ScheduledJobToSelectableFields(&batch.ScheduledJob{}), CronJobToSelectableFields(&batch.CronJob{}),
nil, nil,
) )
} }
...@@ -16,11 +16,12 @@ go_library( ...@@ -16,11 +16,12 @@ go_library(
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
"//pkg/api/rest:go_default_library", "//pkg/api/rest:go_default_library",
"//pkg/api/unversioned:go_default_library",
"//pkg/apis/batch:go_default_library", "//pkg/apis/batch:go_default_library",
"//pkg/apis/batch/v1:go_default_library", "//pkg/apis/batch/v1:go_default_library",
"//pkg/apis/batch/v2alpha1:go_default_library", "//pkg/apis/batch/v2alpha1:go_default_library",
"//pkg/genericapiserver:go_default_library", "//pkg/genericapiserver:go_default_library",
"//pkg/registry/batch/cronjob/etcd:go_default_library",
"//pkg/registry/batch/job/etcd:go_default_library", "//pkg/registry/batch/job/etcd:go_default_library",
"//pkg/registry/batch/scheduledjob/etcd:go_default_library",
], ],
) )
...@@ -22,8 +22,8 @@ import ( ...@@ -22,8 +22,8 @@ import (
batchapiv1 "k8s.io/kubernetes/pkg/apis/batch/v1" batchapiv1 "k8s.io/kubernetes/pkg/apis/batch/v1"
batchapiv2alpha1 "k8s.io/kubernetes/pkg/apis/batch/v2alpha1" batchapiv2alpha1 "k8s.io/kubernetes/pkg/apis/batch/v2alpha1"
"k8s.io/kubernetes/pkg/genericapiserver" "k8s.io/kubernetes/pkg/genericapiserver"
cronjobetcd "k8s.io/kubernetes/pkg/registry/batch/cronjob/etcd"
jobetcd "k8s.io/kubernetes/pkg/registry/batch/job/etcd" jobetcd "k8s.io/kubernetes/pkg/registry/batch/job/etcd"
scheduledjobetcd "k8s.io/kubernetes/pkg/registry/batch/scheduledjob/etcd"
) )
type RESTStorageProvider struct{} type RESTStorageProvider struct{}
...@@ -66,10 +66,10 @@ func (p RESTStorageProvider) v2alpha1Storage(apiResourceConfigSource genericapis ...@@ -66,10 +66,10 @@ func (p RESTStorageProvider) v2alpha1Storage(apiResourceConfigSource genericapis
storage["jobs"] = jobsStorage storage["jobs"] = jobsStorage
storage["jobs/status"] = jobsStatusStorage storage["jobs/status"] = jobsStatusStorage
} }
if apiResourceConfigSource.ResourceEnabled(version.WithResource("scheduledjobs")) { if apiResourceConfigSource.ResourceEnabled(version.WithResource("cronjobs")) {
scheduledJobsStorage, scheduledJobsStatusStorage := scheduledjobetcd.NewREST(restOptionsGetter(batch.Resource("scheduledjobs"))) cronJobsStorage, cronJobsStatusStorage := cronjobetcd.NewREST(restOptionsGetter(batch.Resource("cronjobs")))
storage["scheduledjobs"] = scheduledJobsStorage storage["cronjobs"] = cronJobsStorage
storage["scheduledjobs/status"] = scheduledJobsStatusStorage storage["cronjobs/status"] = cronJobsStatusStorage
} }
return storage return storage
} }
......
...@@ -52,7 +52,7 @@ const ( ...@@ -52,7 +52,7 @@ const (
PodTemplates Resource = "podtemplates" PodTemplates Resource = "podtemplates"
Replicasets Resource = "replicasets" Replicasets Resource = "replicasets"
ResourceQuotas Resource = "resourcequotas" ResourceQuotas Resource = "resourcequotas"
ScheduledJobs Resource = "scheduledjobs" CronJobs Resource = "cronjobs"
Roles Resource = "roles" Roles Resource = "roles"
RoleBindings Resource = "rolebindings" RoleBindings Resource = "rolebindings"
Secrets Resource = "secrets" Secrets Resource = "secrets"
......
...@@ -86,7 +86,7 @@ func ClusterRoles() []rbac.ClusterRole { ...@@ -86,7 +86,7 @@ func ClusterRoles() []rbac.ClusterRole {
rbac.NewRule(ReadWrite...).Groups(autoscalingGroup).Resources("horizontalpodautoscalers").RuleOrDie(), rbac.NewRule(ReadWrite...).Groups(autoscalingGroup).Resources("horizontalpodautoscalers").RuleOrDie(),
rbac.NewRule(ReadWrite...).Groups(batchGroup).Resources("jobs", "scheduledjobs").RuleOrDie(), rbac.NewRule(ReadWrite...).Groups(batchGroup).Resources("jobs", "cronjobs").RuleOrDie(),
rbac.NewRule(ReadWrite...).Groups(extensionsGroup).Resources("jobs", "daemonsets", "horizontalpodautoscalers", rbac.NewRule(ReadWrite...).Groups(extensionsGroup).Resources("jobs", "daemonsets", "horizontalpodautoscalers",
"replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(), "replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(),
...@@ -116,7 +116,7 @@ func ClusterRoles() []rbac.ClusterRole { ...@@ -116,7 +116,7 @@ func ClusterRoles() []rbac.ClusterRole {
rbac.NewRule(ReadWrite...).Groups(autoscalingGroup).Resources("horizontalpodautoscalers").RuleOrDie(), rbac.NewRule(ReadWrite...).Groups(autoscalingGroup).Resources("horizontalpodautoscalers").RuleOrDie(),
rbac.NewRule(ReadWrite...).Groups(batchGroup).Resources("jobs", "scheduledjobs").RuleOrDie(), rbac.NewRule(ReadWrite...).Groups(batchGroup).Resources("jobs", "cronjobs").RuleOrDie(),
rbac.NewRule(ReadWrite...).Groups(extensionsGroup).Resources("jobs", "daemonsets", "horizontalpodautoscalers", rbac.NewRule(ReadWrite...).Groups(extensionsGroup).Resources("jobs", "daemonsets", "horizontalpodautoscalers",
"replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(), "replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(),
...@@ -139,7 +139,7 @@ func ClusterRoles() []rbac.ClusterRole { ...@@ -139,7 +139,7 @@ func ClusterRoles() []rbac.ClusterRole {
rbac.NewRule(Read...).Groups(autoscalingGroup).Resources("horizontalpodautoscalers").RuleOrDie(), rbac.NewRule(Read...).Groups(autoscalingGroup).Resources("horizontalpodautoscalers").RuleOrDie(),
rbac.NewRule(Read...).Groups(batchGroup).Resources("jobs", "scheduledjobs").RuleOrDie(), rbac.NewRule(Read...).Groups(batchGroup).Resources("jobs", "cronjobs").RuleOrDie(),
rbac.NewRule(Read...).Groups(extensionsGroup).Resources("jobs", "daemonsets", "horizontalpodautoscalers", rbac.NewRule(Read...).Groups(extensionsGroup).Resources("jobs", "daemonsets", "horizontalpodautoscalers",
"replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(), "replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(),
......
...@@ -22,6 +22,7 @@ go_library( ...@@ -22,6 +22,7 @@ go_library(
"cluster_logging_utils.go", "cluster_logging_utils.go",
"cluster_size_autoscaling.go", "cluster_size_autoscaling.go",
"cluster_upgrade.go", "cluster_upgrade.go",
"cronjob.go",
"daemon_restart.go", "daemon_restart.go",
"daemon_set.go", "daemon_set.go",
"dashboard.go", "dashboard.go",
...@@ -91,7 +92,6 @@ go_library( ...@@ -91,7 +92,6 @@ go_library(
"resize_nodes.go", "resize_nodes.go",
"resource_quota.go", "resource_quota.go",
"restart.go", "restart.go",
"scheduledjob.go",
"scheduler_predicates.go", "scheduler_predicates.go",
"security_context.go", "security_context.go",
"service.go", "service.go",
......
...@@ -188,17 +188,17 @@ var _ = framework.KubeDescribe("Generated release_1_5 clientset", func() { ...@@ -188,17 +188,17 @@ var _ = framework.KubeDescribe("Generated release_1_5 clientset", func() {
}) })
}) })
func newTestingScheduledJob(name string, value string) *v2alpha1.ScheduledJob { func newTestingCronJob(name string, value string) *v2alpha1.CronJob {
parallelism := int32(1) parallelism := int32(1)
completions := int32(1) completions := int32(1)
return &v2alpha1.ScheduledJob{ return &v2alpha1.CronJob{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: v1.ObjectMeta{
Name: name, Name: name,
Labels: map[string]string{ Labels: map[string]string{
"time": value, "time": value,
}, },
}, },
Spec: v2alpha1.ScheduledJobSpec{ Spec: v2alpha1.CronJobSpec{
Schedule: "*/1 * * * ?", Schedule: "*/1 * * * ?",
ConcurrencyPolicy: v2alpha1.AllowConcurrent, ConcurrencyPolicy: v2alpha1.AllowConcurrent,
JobTemplate: v2alpha1.JobTemplateSpec{ JobTemplate: v2alpha1.JobTemplateSpec{
...@@ -238,7 +238,7 @@ func newTestingScheduledJob(name string, value string) *v2alpha1.ScheduledJob { ...@@ -238,7 +238,7 @@ func newTestingScheduledJob(name string, value string) *v2alpha1.ScheduledJob {
var _ = framework.KubeDescribe("Generated release_1_5 clientset", func() { var _ = framework.KubeDescribe("Generated release_1_5 clientset", func() {
f := framework.NewDefaultFramework("clientset") f := framework.NewDefaultFramework("clientset")
It("should create v2alpha1 scheduleJobs, delete scheduleJobs, watch scheduleJobs", func() { It("should create v2alpha1 cronJobs, delete cronJobs, watch cronJobs", func() {
var enabled bool var enabled bool
groupList, err := f.ClientSet_1_5.Discovery().ServerGroups() groupList, err := f.ClientSet_1_5.Discovery().ServerGroups()
ExpectNoError(err) ExpectNoError(err)
...@@ -256,59 +256,59 @@ var _ = framework.KubeDescribe("Generated release_1_5 clientset", func() { ...@@ -256,59 +256,59 @@ var _ = framework.KubeDescribe("Generated release_1_5 clientset", func() {
framework.Logf("%s is not enabled, test skipped", v2alpha1.SchemeGroupVersion) framework.Logf("%s is not enabled, test skipped", v2alpha1.SchemeGroupVersion)
return return
} }
scheduleJobClient := f.ClientSet_1_5.BatchV2alpha1().ScheduledJobs(f.Namespace.Name) cronJobClient := f.ClientSet_1_5.BatchV2alpha1().CronJobs(f.Namespace.Name)
By("constructing the scheduledJob") By("constructing the cronJob")
name := "scheduledjob" + string(uuid.NewUUID()) name := "cronjob" + string(uuid.NewUUID())
value := strconv.Itoa(time.Now().Nanosecond()) value := strconv.Itoa(time.Now().Nanosecond())
scheduledJob := newTestingScheduledJob(name, value) cronJob := newTestingCronJob(name, value)
By("setting up watch") By("setting up watch")
selector := labels.SelectorFromSet(labels.Set(map[string]string{"time": value})).String() selector := labels.SelectorFromSet(labels.Set(map[string]string{"time": value})).String()
options := v1.ListOptions{LabelSelector: selector} options := v1.ListOptions{LabelSelector: selector}
scheduleJobs, err := scheduleJobClient.List(options) cronJobs, err := cronJobClient.List(options)
if err != nil { if err != nil {
framework.Failf("Failed to query for scheduleJobs: %v", err) framework.Failf("Failed to query for cronJobs: %v", err)
} }
Expect(len(scheduleJobs.Items)).To(Equal(0)) Expect(len(cronJobs.Items)).To(Equal(0))
options = v1.ListOptions{ options = v1.ListOptions{
LabelSelector: selector, LabelSelector: selector,
ResourceVersion: scheduleJobs.ListMeta.ResourceVersion, ResourceVersion: cronJobs.ListMeta.ResourceVersion,
} }
w, err := scheduleJobClient.Watch(options) w, err := cronJobClient.Watch(options)
if err != nil { if err != nil {
framework.Failf("Failed to set up watch: %v", err) framework.Failf("Failed to set up watch: %v", err)
} }
By("creating the scheduledJob") By("creating the cronJob")
scheduledJob, err = scheduleJobClient.Create(scheduledJob) cronJob, err = cronJobClient.Create(cronJob)
if err != nil { if err != nil {
framework.Failf("Failed to create scheduledJob: %v", err) framework.Failf("Failed to create cronJob: %v", err)
} }
By("verifying the scheduledJob is in kubernetes") By("verifying the cronJob is in kubernetes")
options = v1.ListOptions{ options = v1.ListOptions{
LabelSelector: selector, LabelSelector: selector,
ResourceVersion: scheduledJob.ResourceVersion, ResourceVersion: cronJob.ResourceVersion,
} }
scheduleJobs, err = scheduleJobClient.List(options) cronJobs, err = cronJobClient.List(options)
if err != nil { if err != nil {
framework.Failf("Failed to query for scheduleJobs: %v", err) framework.Failf("Failed to query for cronJobs: %v", err)
} }
Expect(len(scheduleJobs.Items)).To(Equal(1)) Expect(len(cronJobs.Items)).To(Equal(1))
By("verifying scheduledJob creation was observed") By("verifying cronJob creation was observed")
observeCreation(w) observeCreation(w)
By("deleting the scheduledJob") By("deleting the cronJob")
if err := scheduleJobClient.Delete(scheduledJob.Name, nil); err != nil { if err := cronJobClient.Delete(cronJob.Name, nil); err != nil {
framework.Failf("Failed to delete scheduledJob: %v", err) framework.Failf("Failed to delete cronJob: %v", err)
} }
options = v1.ListOptions{LabelSelector: selector} options = v1.ListOptions{LabelSelector: selector}
scheduleJobs, err = scheduleJobClient.List(options) cronJobs, err = cronJobClient.List(options)
if err != nil { if err != nil {
framework.Failf("Failed to list scheduleJobs to verify deletion: %v", err) framework.Failf("Failed to list cronJobs to verify deletion: %v", err)
} }
Expect(len(scheduleJobs.Items)).To(Equal(0)) Expect(len(cronJobs.Items)).To(Equal(0))
}) })
}) })
......
...@@ -183,39 +183,39 @@ var _ = framework.KubeDescribe("Kubectl alpha client", func() { ...@@ -183,39 +183,39 @@ var _ = framework.KubeDescribe("Kubectl alpha client", func() {
// Customized Wait / ForEach wrapper for this test. These demonstrate the // Customized Wait / ForEach wrapper for this test. These demonstrate the
framework.KubeDescribe("Kubectl run ScheduledJob", func() { framework.KubeDescribe("Kubectl run CronJob", func() {
var nsFlag string var nsFlag string
var sjName string var cjName string
BeforeEach(func() { BeforeEach(func() {
nsFlag = fmt.Sprintf("--namespace=%v", ns) nsFlag = fmt.Sprintf("--namespace=%v", ns)
sjName = "e2e-test-echo-scheduledjob" cjName = "e2e-test-echo-cronjob"
}) })
AfterEach(func() { AfterEach(func() {
framework.RunKubectlOrDie("delete", "scheduledjobs", sjName, nsFlag) framework.RunKubectlOrDie("delete", "cronjobs", cjName, nsFlag)
}) })
It("should create a ScheduledJob", func() { It("should create a CronJob", func() {
framework.SkipIfMissingResource(f.ClientPool, ScheduledJobGroupVersionResource, f.Namespace.Name) framework.SkipIfMissingResource(f.ClientPool, CronJobGroupVersionResource, f.Namespace.Name)
schedule := "*/5 * * * ?" schedule := "*/5 * * * ?"
framework.RunKubectlOrDie("run", sjName, "--restart=OnFailure", "--generator=scheduledjob/v2alpha1", framework.RunKubectlOrDie("run", cjName, "--restart=OnFailure", "--generator=cronjob/v2alpha1",
"--schedule="+schedule, "--image="+busyboxImage, nsFlag) "--schedule="+schedule, "--image="+busyboxImage, nsFlag)
By("verifying the ScheduledJob " + sjName + " was created") By("verifying the CronJob " + cjName + " was created")
sj, err := c.Batch().ScheduledJobs(ns).Get(sjName) sj, err := c.Batch().CronJobs(ns).Get(cjName)
if err != nil { if err != nil {
framework.Failf("Failed getting ScheduledJob %s: %v", sjName, err) framework.Failf("Failed getting CronJob %s: %v", cjName, err)
} }
if sj.Spec.Schedule != schedule { if sj.Spec.Schedule != schedule {
framework.Failf("Failed creating a ScheduledJob with correct schedule %s", schedule) framework.Failf("Failed creating a CronJob with correct schedule %s", schedule)
} }
containers := sj.Spec.JobTemplate.Spec.Template.Spec.Containers containers := sj.Spec.JobTemplate.Spec.Template.Spec.Containers
if containers == nil || len(containers) != 1 || containers[0].Image != busyboxImage { if containers == nil || len(containers) != 1 || containers[0].Image != busyboxImage {
framework.Failf("Failed creating ScheduledJob %s for 1 pod with expected image %s: %#v", sjName, busyboxImage, containers) framework.Failf("Failed creating CronJob %s for 1 pod with expected image %s: %#v", cjName, busyboxImage, containers)
} }
if sj.Spec.JobTemplate.Spec.Template.Spec.RestartPolicy != api.RestartPolicyOnFailure { if sj.Spec.JobTemplate.Spec.Template.Spec.RestartPolicy != api.RestartPolicyOnFailure {
framework.Failf("Failed creating a ScheduledJob with correct restart policy for --restart=OnFailure") framework.Failf("Failed creating a CronJob with correct restart policy for --restart=OnFailure")
} }
}) })
}) })
......
...@@ -586,7 +586,7 @@ k8s.io/kubernetes/pkg/controller/replicaset,fgrzadkowski,0 ...@@ -586,7 +586,7 @@ k8s.io/kubernetes/pkg/controller/replicaset,fgrzadkowski,0
k8s.io/kubernetes/pkg/controller/replication,fgrzadkowski,0 k8s.io/kubernetes/pkg/controller/replication,fgrzadkowski,0
k8s.io/kubernetes/pkg/controller/resourcequota,ghodss,1 k8s.io/kubernetes/pkg/controller/resourcequota,ghodss,1
k8s.io/kubernetes/pkg/controller/route,gmarek,0 k8s.io/kubernetes/pkg/controller/route,gmarek,0
k8s.io/kubernetes/pkg/controller/scheduledjob,soltysh,1 k8s.io/kubernetes/pkg/controller/cronjob,soltysh,1
k8s.io/kubernetes/pkg/controller/service,asalkeld,0 k8s.io/kubernetes/pkg/controller/service,asalkeld,0
k8s.io/kubernetes/pkg/controller/serviceaccount,liggitt,0 k8s.io/kubernetes/pkg/controller/serviceaccount,liggitt,0
k8s.io/kubernetes/pkg/controller/volume/attachdetach,luxas,1 k8s.io/kubernetes/pkg/controller/volume/attachdetach,luxas,1
...@@ -674,8 +674,8 @@ k8s.io/kubernetes/pkg/registry/autoscaling/horizontalpodautoscaler,bgrant0607,1 ...@@ -674,8 +674,8 @@ k8s.io/kubernetes/pkg/registry/autoscaling/horizontalpodautoscaler,bgrant0607,1
k8s.io/kubernetes/pkg/registry/autoscaling/horizontalpodautoscaler/etcd,justinsb,1 k8s.io/kubernetes/pkg/registry/autoscaling/horizontalpodautoscaler/etcd,justinsb,1
k8s.io/kubernetes/pkg/registry/batch/job,kargakis,1 k8s.io/kubernetes/pkg/registry/batch/job,kargakis,1
k8s.io/kubernetes/pkg/registry/batch/job/etcd,Q-Lee,1 k8s.io/kubernetes/pkg/registry/batch/job/etcd,Q-Lee,1
k8s.io/kubernetes/pkg/registry/batch/scheduledjob,nikhiljindal,1 k8s.io/kubernetes/pkg/registry/batch/cronjob,nikhiljindal,1
k8s.io/kubernetes/pkg/registry/batch/scheduledjob/etcd,mtaufen,1 k8s.io/kubernetes/pkg/registry/batch/cronjob/etcd,mtaufen,1
k8s.io/kubernetes/pkg/registry/certificates/certificates,smarterclayton,1 k8s.io/kubernetes/pkg/registry/certificates/certificates,smarterclayton,1
k8s.io/kubernetes/pkg/registry/core/componentstatus,krousey,1 k8s.io/kubernetes/pkg/registry/core/componentstatus,krousey,1
k8s.io/kubernetes/pkg/registry/core/configmap,janetkuo,1 k8s.io/kubernetes/pkg/registry/core/configmap,janetkuo,1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment