Rename ScheduledJob to CronJob

This commit is contained in:
Maciej Szulik 2016-11-01 23:46:23 +01:00
parent 0c7421fb51
commit 41d88d30dd
73 changed files with 1805 additions and 1804 deletions

View File

@ -172,7 +172,7 @@ func Run(s *options.ServerRunOptions) error {
s.GenericServerRunOptions.StorageConfig, s.GenericServerRunOptions.DefaultStorageMediaType, api.Codecs,
genericapiserver.NewDefaultResourceEncodingConfig(), storageGroupsToEncodingVersion,
// 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)
if err != nil {
glog.Fatalf("error in initializing storage factory: %s", err)

View File

@ -41,6 +41,7 @@ go_library(
"//pkg/cloudprovider/providers/vsphere:go_default_library",
"//pkg/controller:go_default_library",
"//pkg/controller/certificates:go_default_library",
"//pkg/controller/cronjob:go_default_library",
"//pkg/controller/daemon:go_default_library",
"//pkg/controller/deployment:go_default_library",
"//pkg/controller/disruption:go_default_library",
@ -59,7 +60,6 @@ go_library(
"//pkg/controller/replication:go_default_library",
"//pkg/controller/resourcequota:go_default_library",
"//pkg/controller/route:go_default_library",
"//pkg/controller/scheduledjob:go_default_library",
"//pkg/controller/service:go_default_library",
"//pkg/controller/serviceaccount:go_default_library",
"//pkg/controller/volume/attachdetach:go_default_library",

View File

@ -47,6 +47,7 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/controller"
certcontroller "k8s.io/kubernetes/pkg/controller/certificates"
"k8s.io/kubernetes/pkg/controller/cronjob"
"k8s.io/kubernetes/pkg/controller/daemon"
"k8s.io/kubernetes/pkg/controller/deployment"
"k8s.io/kubernetes/pkg/controller/disruption"
@ -65,7 +66,6 @@ import (
replicationcontroller "k8s.io/kubernetes/pkg/controller/replication"
resourcequotacontroller "k8s.io/kubernetes/pkg/controller/resourcequota"
routecontroller "k8s.io/kubernetes/pkg/controller/route"
"k8s.io/kubernetes/pkg/controller/scheduledjob"
servicecontroller "k8s.io/kubernetes/pkg/controller/service"
serviceaccountcontroller "k8s.io/kubernetes/pkg/controller/serviceaccount"
"k8s.io/kubernetes/pkg/controller/volume/attachdetach"
@ -466,11 +466,11 @@ func StartControllers(s *options.CMServer, kubeconfig *restclient.Config, rootCl
resources, found = resourceMap[groupVersion]
if containsVersion(versions, groupVersion) && found {
glog.Infof("Starting %s apis", groupVersion)
if containsResource(resources, "scheduledjobs") {
glog.Infof("Starting scheduledjob controller")
if containsResource(resources, "cronjobs") {
glog.Infof("Starting cronjob controller")
// // 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"}
go scheduledjob.NewScheduledJobController(client("scheduledjob-controller")).
go cronjob.NewCronJobController(client("cronjob-controller")).
Run(wait.NeverStop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))

View File

@ -83,11 +83,11 @@ func TestDefaulting(t *testing.T) {
{Group: "autoscaling", Version: "v1", Kind: "HorizontalPodAutoscalerList"}: {},
{Group: "batch", Version: "v1", Kind: "Job"}: {},
{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: "JobList"}: {},
{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: "KubeSchedulerConfiguration"}: {},
{Group: "componentconfig", Version: "v1alpha1", Kind: "KubeletConfiguration"}: {},

View File

@ -172,7 +172,7 @@ func FuzzerFor(t *testing.T, version unversioned.GroupVersion, src rand.Source)
j.ManualSelector = nil
}
},
func(sj *batch.ScheduledJobSpec, c fuzz.Continue) {
func(sj *batch.CronJobSpec, c fuzz.Continue) {
c.FuzzNoCustom(sj)
suspend := c.RandBool()
sj.Suspend = &suspend

View File

@ -49,8 +49,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&Job{},
&JobList{},
&JobTemplate{},
&ScheduledJob{},
&ScheduledJobList{},
&CronJob{},
&CronJobList{},
&api.ListOptions{},
)
return nil

View File

@ -2822,7 +2822,7 @@ func (x *JobCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ScheduledJob) CodecEncodeSelf(e *codec1978.Encoder) {
func (x *CronJob) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -2967,7 +2967,7 @@ func (x *ScheduledJob) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
func (x *ScheduledJob) CodecDecodeSelf(d *codec1978.Decoder) {
func (x *CronJob) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -2997,7 +2997,7 @@ func (x *ScheduledJob) CodecDecodeSelf(d *codec1978.Decoder) {
}
}
func (x *ScheduledJob) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
func (x *CronJob) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3040,14 +3040,14 @@ func (x *ScheduledJob) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
}
case "spec":
if r.TryDecodeAsNil() {
x.Spec = ScheduledJobSpec{}
x.Spec = CronJobSpec{}
} else {
yyv269 := &x.Spec
yyv269.CodecDecodeSelf(d)
}
case "status":
if r.TryDecodeAsNil() {
x.Status = ScheduledJobStatus{}
x.Status = CronJobStatus{}
} else {
yyv270 := &x.Status
yyv270.CodecDecodeSelf(d)
@ -3059,7 +3059,7 @@ func (x *ScheduledJob) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ScheduledJob) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
func (x *CronJob) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3127,7 +3127,7 @@ func (x *ScheduledJob) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Spec = ScheduledJobSpec{}
x.Spec = CronJobSpec{}
} else {
yyv275 := &x.Spec
yyv275.CodecDecodeSelf(d)
@ -3144,7 +3144,7 @@ func (x *ScheduledJob) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Status = ScheduledJobStatus{}
x.Status = CronJobStatus{}
} else {
yyv276 := &x.Status
yyv276.CodecDecodeSelf(d)
@ -3165,7 +3165,7 @@ func (x *ScheduledJob) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ScheduledJobList) CodecEncodeSelf(e *codec1978.Encoder) {
func (x *CronJobList) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -3286,7 +3286,7 @@ func (x *ScheduledJobList) CodecEncodeSelf(e *codec1978.Encoder) {
_ = yym291
if false {
} else {
h.encSliceScheduledJob(([]ScheduledJob)(x.Items), e)
h.encSliceCronJob(([]CronJob)(x.Items), e)
}
}
} else {
@ -3300,7 +3300,7 @@ func (x *ScheduledJobList) CodecEncodeSelf(e *codec1978.Encoder) {
_ = yym292
if false {
} else {
h.encSliceScheduledJob(([]ScheduledJob)(x.Items), e)
h.encSliceCronJob(([]CronJob)(x.Items), e)
}
}
}
@ -3313,7 +3313,7 @@ func (x *ScheduledJobList) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
func (x *ScheduledJobList) CodecDecodeSelf(d *codec1978.Decoder) {
func (x *CronJobList) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3343,7 +3343,7 @@ func (x *ScheduledJobList) CodecDecodeSelf(d *codec1978.Decoder) {
}
}
func (x *ScheduledJobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
func (x *CronJobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3399,7 +3399,7 @@ func (x *ScheduledJobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
_ = yym301
if false {
} else {
h.decSliceScheduledJob((*[]ScheduledJob)(yyv300), d)
h.decSliceCronJob((*[]CronJob)(yyv300), d)
}
}
default:
@ -3409,7 +3409,7 @@ func (x *ScheduledJobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ScheduledJobList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
func (x *CronJobList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3490,7 +3490,7 @@ func (x *ScheduledJobList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
_ = yym308
if false {
} else {
h.decSliceScheduledJob((*[]ScheduledJob)(yyv307), d)
h.decSliceCronJob((*[]CronJob)(yyv307), d)
}
}
for {
@ -3509,7 +3509,7 @@ func (x *ScheduledJobList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ScheduledJobSpec) CodecEncodeSelf(e *codec1978.Encoder) {
func (x *CronJobSpec) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -3666,7 +3666,7 @@ func (x *ScheduledJobSpec) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
func (x *ScheduledJobSpec) CodecDecodeSelf(d *codec1978.Decoder) {
func (x *CronJobSpec) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3696,7 +3696,7 @@ func (x *ScheduledJobSpec) CodecDecodeSelf(d *codec1978.Decoder) {
}
}
func (x *ScheduledJobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
func (x *CronJobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3776,7 +3776,7 @@ func (x *ScheduledJobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ScheduledJobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
func (x *CronJobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3926,7 +3926,7 @@ func (x *ConcurrencyPolicy) CodecDecodeSelf(d *codec1978.Decoder) {
}
}
func (x *ScheduledJobStatus) CodecEncodeSelf(e *codec1978.Encoder) {
func (x *CronJobStatus) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -4043,7 +4043,7 @@ func (x *ScheduledJobStatus) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
func (x *ScheduledJobStatus) CodecDecodeSelf(d *codec1978.Decoder) {
func (x *CronJobStatus) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -4073,7 +4073,7 @@ func (x *ScheduledJobStatus) CodecDecodeSelf(d *codec1978.Decoder) {
}
}
func (x *ScheduledJobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
func (x *CronJobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -4135,7 +4135,7 @@ func (x *ScheduledJobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder)
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ScheduledJobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
func (x *CronJobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -4443,7 +4443,7 @@ func (x codecSelfer1234) decSliceJobCondition(v *[]JobCondition, d *codec1978.De
}
}
func (x codecSelfer1234) encSliceScheduledJob(v []ScheduledJob, e *codec1978.Encoder) {
func (x codecSelfer1234) encSliceCronJob(v []CronJob, e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -4456,7 +4456,7 @@ func (x codecSelfer1234) encSliceScheduledJob(v []ScheduledJob, e *codec1978.Enc
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.Decoder) {
func (x codecSelfer1234) decSliceCronJob(v *[]CronJob, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -4466,7 +4466,7 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
var yyc382 bool
if yyl382 == 0 {
if yyv382 == nil {
yyv382 = []ScheduledJob{}
yyv382 = []CronJob{}
yyc382 = true
} else if len(yyv382) != 0 {
yyv382 = yyv382[:0]
@ -4484,10 +4484,10 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
if yyrl382 <= cap(yyv382) {
yyv382 = yyv382[:yyrl382]
} else {
yyv382 = make([]ScheduledJob, yyrl382)
yyv382 = make([]CronJob, yyrl382)
}
} else {
yyv382 = make([]ScheduledJob, yyrl382)
yyv382 = make([]CronJob, yyrl382)
}
yyc382 = true
yyrr382 = len(yyv382)
@ -4502,7 +4502,7 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
for ; yyj382 < yyrr382; yyj382++ {
yyh382.ElemContainerState(yyj382)
if r.TryDecodeAsNil() {
yyv382[yyj382] = ScheduledJob{}
yyv382[yyj382] = CronJob{}
} else {
yyv383 := &yyv382[yyj382]
yyv383.CodecDecodeSelf(d)
@ -4511,10 +4511,10 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
}
if yyrt382 {
for ; yyj382 < yyl382; yyj382++ {
yyv382 = append(yyv382, ScheduledJob{})
yyv382 = append(yyv382, CronJob{})
yyh382.ElemContainerState(yyj382)
if r.TryDecodeAsNil() {
yyv382[yyj382] = ScheduledJob{}
yyv382[yyj382] = CronJob{}
} else {
yyv384 := &yyv382[yyj382]
yyv384.CodecDecodeSelf(d)
@ -4528,13 +4528,13 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
for ; !r.CheckBreak(); yyj382++ {
if yyj382 >= len(yyv382) {
yyv382 = append(yyv382, ScheduledJob{}) // var yyz382 ScheduledJob
yyv382 = append(yyv382, CronJob{}) // var yyz382 CronJob
yyc382 = true
}
yyh382.ElemContainerState(yyj382)
if yyj382 < len(yyv382) {
if r.TryDecodeAsNil() {
yyv382[yyj382] = ScheduledJob{}
yyv382[yyj382] = CronJob{}
} else {
yyv385 := &yyv382[yyj382]
yyv385.CodecDecodeSelf(d)
@ -4549,7 +4549,7 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
yyv382 = yyv382[:yyj382]
yyc382 = true
} else if yyj382 == 0 && yyv382 == nil {
yyv382 = []ScheduledJob{}
yyv382 = []CronJob{}
yyc382 = true
}
}

View File

@ -190,8 +190,8 @@ type JobCondition struct {
// +genclient=true
// ScheduledJob represents the configuration of a single scheduled job.
type ScheduledJob struct {
// CronJob represents the configuration of a single cron job.
type CronJob struct {
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
@ -201,28 +201,28 @@ type ScheduledJob struct {
// 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
// +optional
Spec ScheduledJobSpec `json:"spec,omitempty"`
Spec CronJobSpec `json:"spec,omitempty"`
// 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
// +optional
Status ScheduledJobStatus `json:"status,omitempty"`
Status CronJobStatus `json:"status,omitempty"`
}
// ScheduledJobList is a collection of scheduled jobs.
type ScheduledJobList struct {
// CronJobList is a collection of cron jobs.
type CronJobList struct {
unversioned.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of ScheduledJob.
Items []ScheduledJob `json:"items"`
// Items is the list of CronJob.
Items []CronJob `json:"items"`
}
// ScheduledJobSpec describes how the job execution will look like and when it will actually run.
type ScheduledJobSpec struct {
// CronJobSpec describes how the job execution will look like and when it will actually run.
type CronJobSpec struct {
// Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
Schedule string `json:"schedule"`
@ -242,7 +242,7 @@ type ScheduledJobSpec struct {
Suspend *bool `json:"suspend,omitempty"`
// JobTemplate is the object that describes the job that will be created when
// executing a ScheduledJob.
// executing a CronJob.
JobTemplate JobTemplateSpec `json:"jobTemplate"`
}
@ -253,7 +253,7 @@ type ScheduledJobSpec struct {
type ConcurrencyPolicy string
const (
// AllowConcurrent allows ScheduledJobs to run concurrently.
// AllowConcurrent allows CronJobs to run concurrently.
AllowConcurrent ConcurrencyPolicy = "Allow"
// ForbidConcurrent forbids concurrent runs, skipping next run if previous
@ -264,8 +264,8 @@ const (
ReplaceConcurrent ConcurrencyPolicy = "Replace"
)
// ScheduledJobStatus represents the current state of a Job.
type ScheduledJobStatus struct {
// CronJobStatus represents the current state of a cron job.
type CronJobStatus struct {
// Active holds pointers to currently running jobs.
// +optional
Active []api.ObjectReference `json:"active,omitempty"`

View File

@ -37,7 +37,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
}
// 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,
func(label, value string) (string, string, error) {
switch label {

View File

@ -24,7 +24,7 @@ func addDefaultingFuncs(scheme *runtime.Scheme) error {
RegisterDefaults(scheme)
return scheme.AddDefaultingFuncs(
SetDefaults_Job,
SetDefaults_ScheduledJob,
SetDefaults_CronJob,
)
}
@ -47,7 +47,7 @@ func SetDefaults_Job(obj *Job) {
}
}
func SetDefaults_ScheduledJob(obj *ScheduledJob) {
func SetDefaults_CronJob(obj *CronJob) {
if obj.Spec.ConcurrencyPolicy == "" {
obj.Spec.ConcurrencyPolicy = AllowConcurrent
}

View File

@ -32,10 +32,10 @@ limitations under the License.
JobStatus
JobTemplate
JobTemplateSpec
ScheduledJob
ScheduledJobList
ScheduledJobSpec
ScheduledJobStatus
CronJob
CronJobList
CronJobSpec
CronJobStatus
*/
package v2alpha1
@ -88,21 +88,21 @@ func (m *JobTemplateSpec) Reset() { *m = JobTemplateSpec{} }
func (*JobTemplateSpec) ProtoMessage() {}
func (*JobTemplateSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{6} }
func (m *ScheduledJob) Reset() { *m = ScheduledJob{} }
func (*ScheduledJob) ProtoMessage() {}
func (*ScheduledJob) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{7} }
func (m *CronJob) Reset() { *m = CronJob{} }
func (*CronJob) ProtoMessage() {}
func (*CronJob) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{7} }
func (m *ScheduledJobList) Reset() { *m = ScheduledJobList{} }
func (*ScheduledJobList) ProtoMessage() {}
func (*ScheduledJobList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{8} }
func (m *CronJobList) Reset() { *m = CronJobList{} }
func (*CronJobList) ProtoMessage() {}
func (*CronJobList) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{8} }
func (m *ScheduledJobSpec) Reset() { *m = ScheduledJobSpec{} }
func (*ScheduledJobSpec) ProtoMessage() {}
func (*ScheduledJobSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{9} }
func (m *CronJobSpec) Reset() { *m = CronJobSpec{} }
func (*CronJobSpec) ProtoMessage() {}
func (*CronJobSpec) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{9} }
func (m *ScheduledJobStatus) Reset() { *m = ScheduledJobStatus{} }
func (*ScheduledJobStatus) ProtoMessage() {}
func (*ScheduledJobStatus) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{10} }
func (m *CronJobStatus) Reset() { *m = CronJobStatus{} }
func (*CronJobStatus) ProtoMessage() {}
func (*CronJobStatus) Descriptor() ([]byte, []int) { return fileDescriptorGenerated, []int{10} }
func init() {
proto.RegisterType((*Job)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.Job")
@ -112,10 +112,10 @@ func init() {
proto.RegisterType((*JobStatus)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.JobStatus")
proto.RegisterType((*JobTemplate)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.JobTemplate")
proto.RegisterType((*JobTemplateSpec)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.JobTemplateSpec")
proto.RegisterType((*ScheduledJob)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.ScheduledJob")
proto.RegisterType((*ScheduledJobList)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.ScheduledJobList")
proto.RegisterType((*ScheduledJobSpec)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.ScheduledJobSpec")
proto.RegisterType((*ScheduledJobStatus)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.ScheduledJobStatus")
proto.RegisterType((*CronJob)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.CronJob")
proto.RegisterType((*CronJobList)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.CronJobList")
proto.RegisterType((*CronJobSpec)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.CronJobSpec")
proto.RegisterType((*CronJobStatus)(nil), "k8s.io.kubernetes.pkg.apis.batch.v2alpha1.CronJobStatus")
}
func (m *Job) Marshal() (data []byte, err error) {
size := m.Size()
@ -435,7 +435,7 @@ func (m *JobTemplateSpec) MarshalTo(data []byte) (int, error) {
return i, nil
}
func (m *ScheduledJob) Marshal() (data []byte, err error) {
func (m *CronJob) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
@ -445,7 +445,7 @@ func (m *ScheduledJob) Marshal() (data []byte, err error) {
return data[:n], nil
}
func (m *ScheduledJob) MarshalTo(data []byte) (int, error) {
func (m *CronJob) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
@ -477,7 +477,7 @@ func (m *ScheduledJob) MarshalTo(data []byte) (int, error) {
return i, nil
}
func (m *ScheduledJobList) Marshal() (data []byte, err error) {
func (m *CronJobList) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
@ -487,7 +487,7 @@ func (m *ScheduledJobList) Marshal() (data []byte, err error) {
return data[:n], nil
}
func (m *ScheduledJobList) MarshalTo(data []byte) (int, error) {
func (m *CronJobList) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
@ -515,7 +515,7 @@ func (m *ScheduledJobList) MarshalTo(data []byte) (int, error) {
return i, nil
}
func (m *ScheduledJobSpec) Marshal() (data []byte, err error) {
func (m *CronJobSpec) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
@ -525,7 +525,7 @@ func (m *ScheduledJobSpec) Marshal() (data []byte, err error) {
return data[:n], nil
}
func (m *ScheduledJobSpec) MarshalTo(data []byte) (int, error) {
func (m *CronJobSpec) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
@ -564,7 +564,7 @@ func (m *ScheduledJobSpec) MarshalTo(data []byte) (int, error) {
return i, nil
}
func (m *ScheduledJobStatus) Marshal() (data []byte, err error) {
func (m *CronJobStatus) Marshal() (data []byte, err error) {
size := m.Size()
data = make([]byte, size)
n, err := m.MarshalTo(data)
@ -574,7 +574,7 @@ func (m *ScheduledJobStatus) Marshal() (data []byte, err error) {
return data[:n], nil
}
func (m *ScheduledJobStatus) MarshalTo(data []byte) (int, error) {
func (m *CronJobStatus) MarshalTo(data []byte) (int, error) {
var i int
_ = i
var l int
@ -742,7 +742,7 @@ func (m *JobTemplateSpec) Size() (n int) {
return n
}
func (m *ScheduledJob) Size() (n int) {
func (m *CronJob) Size() (n int) {
var l int
_ = l
l = m.ObjectMeta.Size()
@ -754,7 +754,7 @@ func (m *ScheduledJob) Size() (n int) {
return n
}
func (m *ScheduledJobList) Size() (n int) {
func (m *CronJobList) Size() (n int) {
var l int
_ = l
l = m.ListMeta.Size()
@ -768,7 +768,7 @@ func (m *ScheduledJobList) Size() (n int) {
return n
}
func (m *ScheduledJobSpec) Size() (n int) {
func (m *CronJobSpec) Size() (n int) {
var l int
_ = l
l = len(m.Schedule)
@ -786,7 +786,7 @@ func (m *ScheduledJobSpec) Size() (n int) {
return n
}
func (m *ScheduledJobStatus) Size() (n int) {
func (m *CronJobStatus) Size() (n int) {
var l int
_ = l
if len(m.Active) > 0 {
@ -905,34 +905,34 @@ func (this *JobTemplateSpec) String() string {
}, "")
return s
}
func (this *ScheduledJob) String() string {
func (this *CronJob) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&ScheduledJob{`,
s := strings.Join([]string{`&CronJob{`,
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_kubernetes_pkg_api_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
`Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ScheduledJobSpec", "ScheduledJobSpec", 1), `&`, ``, 1) + `,`,
`Status:` + strings.Replace(strings.Replace(this.Status.String(), "ScheduledJobStatus", "ScheduledJobStatus", 1), `&`, ``, 1) + `,`,
`Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "CronJobSpec", "CronJobSpec", 1), `&`, ``, 1) + `,`,
`Status:` + strings.Replace(strings.Replace(this.Status.String(), "CronJobStatus", "CronJobStatus", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s
}
func (this *ScheduledJobList) String() string {
func (this *CronJobList) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&ScheduledJobList{`,
s := strings.Join([]string{`&CronJobList{`,
`ListMeta:` + strings.Replace(strings.Replace(this.ListMeta.String(), "ListMeta", "k8s_io_kubernetes_pkg_api_unversioned.ListMeta", 1), `&`, ``, 1) + `,`,
`Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "ScheduledJob", "ScheduledJob", 1), `&`, ``, 1) + `,`,
`Items:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Items), "CronJob", "CronJob", 1), `&`, ``, 1) + `,`,
`}`,
}, "")
return s
}
func (this *ScheduledJobSpec) String() string {
func (this *CronJobSpec) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&ScheduledJobSpec{`,
s := strings.Join([]string{`&CronJobSpec{`,
`Schedule:` + fmt.Sprintf("%v", this.Schedule) + `,`,
`StartingDeadlineSeconds:` + valueToStringGenerated(this.StartingDeadlineSeconds) + `,`,
`ConcurrencyPolicy:` + fmt.Sprintf("%v", this.ConcurrencyPolicy) + `,`,
@ -942,11 +942,11 @@ func (this *ScheduledJobSpec) String() string {
}, "")
return s
}
func (this *ScheduledJobStatus) String() string {
func (this *CronJobStatus) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&ScheduledJobStatus{`,
s := strings.Join([]string{`&CronJobStatus{`,
`Active:` + strings.Replace(strings.Replace(fmt.Sprintf("%v", this.Active), "ObjectReference", "k8s_io_kubernetes_pkg_api_v1.ObjectReference", 1), `&`, ``, 1) + `,`,
`LastScheduleTime:` + strings.Replace(fmt.Sprintf("%v", this.LastScheduleTime), "Time", "k8s_io_kubernetes_pkg_api_unversioned.Time", 1) + `,`,
`}`,
@ -2056,7 +2056,7 @@ func (m *JobTemplateSpec) Unmarshal(data []byte) error {
}
return nil
}
func (m *ScheduledJob) Unmarshal(data []byte) error {
func (m *CronJob) Unmarshal(data []byte) error {
l := len(data)
iNdEx := 0
for iNdEx < l {
@ -2079,10 +2079,10 @@ func (m *ScheduledJob) Unmarshal(data []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ScheduledJob: wiretype end group for non-group")
return fmt.Errorf("proto: CronJob: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ScheduledJob: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: CronJob: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
@ -2196,7 +2196,7 @@ func (m *ScheduledJob) Unmarshal(data []byte) error {
}
return nil
}
func (m *ScheduledJobList) Unmarshal(data []byte) error {
func (m *CronJobList) Unmarshal(data []byte) error {
l := len(data)
iNdEx := 0
for iNdEx < l {
@ -2219,10 +2219,10 @@ func (m *ScheduledJobList) Unmarshal(data []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ScheduledJobList: wiretype end group for non-group")
return fmt.Errorf("proto: CronJobList: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ScheduledJobList: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: CronJobList: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
@ -2281,7 +2281,7 @@ func (m *ScheduledJobList) Unmarshal(data []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Items = append(m.Items, ScheduledJob{})
m.Items = append(m.Items, CronJob{})
if err := m.Items[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil {
return err
}
@ -2307,7 +2307,7 @@ func (m *ScheduledJobList) Unmarshal(data []byte) error {
}
return nil
}
func (m *ScheduledJobSpec) Unmarshal(data []byte) error {
func (m *CronJobSpec) Unmarshal(data []byte) error {
l := len(data)
iNdEx := 0
for iNdEx < l {
@ -2330,10 +2330,10 @@ func (m *ScheduledJobSpec) Unmarshal(data []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ScheduledJobSpec: wiretype end group for non-group")
return fmt.Errorf("proto: CronJobSpec: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ScheduledJobSpec: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: CronJobSpec: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
@ -2486,7 +2486,7 @@ func (m *ScheduledJobSpec) Unmarshal(data []byte) error {
}
return nil
}
func (m *ScheduledJobStatus) Unmarshal(data []byte) error {
func (m *CronJobStatus) Unmarshal(data []byte) error {
l := len(data)
iNdEx := 0
for iNdEx < l {
@ -2509,10 +2509,10 @@ func (m *ScheduledJobStatus) Unmarshal(data []byte) error {
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: ScheduledJobStatus: wiretype end group for non-group")
return fmt.Errorf("proto: CronJobStatus: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: ScheduledJobStatus: illegal tag %d (wire type %d)", fieldNum, wire)
return fmt.Errorf("proto: CronJobStatus: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:

View File

@ -40,8 +40,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&Job{},
&JobList{},
&JobTemplate{},
&ScheduledJob{},
&ScheduledJobList{},
&CronJob{},
&CronJobList{},
&v1.ListOptions{},
&v1.DeleteOptions{},
)

View File

@ -2822,7 +2822,7 @@ func (x *JobCondition) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ScheduledJob) CodecEncodeSelf(e *codec1978.Encoder) {
func (x *CronJob) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -2967,7 +2967,7 @@ func (x *ScheduledJob) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
func (x *ScheduledJob) CodecDecodeSelf(d *codec1978.Decoder) {
func (x *CronJob) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -2997,7 +2997,7 @@ func (x *ScheduledJob) CodecDecodeSelf(d *codec1978.Decoder) {
}
}
func (x *ScheduledJob) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
func (x *CronJob) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3040,14 +3040,14 @@ func (x *ScheduledJob) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
}
case "spec":
if r.TryDecodeAsNil() {
x.Spec = ScheduledJobSpec{}
x.Spec = CronJobSpec{}
} else {
yyv269 := &x.Spec
yyv269.CodecDecodeSelf(d)
}
case "status":
if r.TryDecodeAsNil() {
x.Status = ScheduledJobStatus{}
x.Status = CronJobStatus{}
} else {
yyv270 := &x.Status
yyv270.CodecDecodeSelf(d)
@ -3059,7 +3059,7 @@ func (x *ScheduledJob) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ScheduledJob) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
func (x *CronJob) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3127,7 +3127,7 @@ func (x *ScheduledJob) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Spec = ScheduledJobSpec{}
x.Spec = CronJobSpec{}
} else {
yyv275 := &x.Spec
yyv275.CodecDecodeSelf(d)
@ -3144,7 +3144,7 @@ func (x *ScheduledJob) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
}
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() {
x.Status = ScheduledJobStatus{}
x.Status = CronJobStatus{}
} else {
yyv276 := &x.Status
yyv276.CodecDecodeSelf(d)
@ -3165,7 +3165,7 @@ func (x *ScheduledJob) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ScheduledJobList) CodecEncodeSelf(e *codec1978.Encoder) {
func (x *CronJobList) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -3286,7 +3286,7 @@ func (x *ScheduledJobList) CodecEncodeSelf(e *codec1978.Encoder) {
_ = yym291
if false {
} else {
h.encSliceScheduledJob(([]ScheduledJob)(x.Items), e)
h.encSliceCronJob(([]CronJob)(x.Items), e)
}
}
} else {
@ -3300,7 +3300,7 @@ func (x *ScheduledJobList) CodecEncodeSelf(e *codec1978.Encoder) {
_ = yym292
if false {
} else {
h.encSliceScheduledJob(([]ScheduledJob)(x.Items), e)
h.encSliceCronJob(([]CronJob)(x.Items), e)
}
}
}
@ -3313,7 +3313,7 @@ func (x *ScheduledJobList) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
func (x *ScheduledJobList) CodecDecodeSelf(d *codec1978.Decoder) {
func (x *CronJobList) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3343,7 +3343,7 @@ func (x *ScheduledJobList) CodecDecodeSelf(d *codec1978.Decoder) {
}
}
func (x *ScheduledJobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
func (x *CronJobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3399,7 +3399,7 @@ func (x *ScheduledJobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
_ = yym301
if false {
} else {
h.decSliceScheduledJob((*[]ScheduledJob)(yyv300), d)
h.decSliceCronJob((*[]CronJob)(yyv300), d)
}
}
default:
@ -3409,7 +3409,7 @@ func (x *ScheduledJobList) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ScheduledJobList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
func (x *CronJobList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3490,7 +3490,7 @@ func (x *ScheduledJobList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
_ = yym308
if false {
} else {
h.decSliceScheduledJob((*[]ScheduledJob)(yyv307), d)
h.decSliceCronJob((*[]CronJob)(yyv307), d)
}
}
for {
@ -3509,7 +3509,7 @@ func (x *ScheduledJobList) codecDecodeSelfFromArray(l int, d *codec1978.Decoder)
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x *ScheduledJobSpec) CodecEncodeSelf(e *codec1978.Encoder) {
func (x *CronJobSpec) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -3666,7 +3666,7 @@ func (x *ScheduledJobSpec) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
func (x *ScheduledJobSpec) CodecDecodeSelf(d *codec1978.Decoder) {
func (x *CronJobSpec) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3696,7 +3696,7 @@ func (x *ScheduledJobSpec) CodecDecodeSelf(d *codec1978.Decoder) {
}
}
func (x *ScheduledJobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
func (x *CronJobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3776,7 +3776,7 @@ func (x *ScheduledJobSpec) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ScheduledJobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
func (x *CronJobSpec) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -3926,7 +3926,7 @@ func (x *ConcurrencyPolicy) CodecDecodeSelf(d *codec1978.Decoder) {
}
}
func (x *ScheduledJobStatus) CodecEncodeSelf(e *codec1978.Encoder) {
func (x *CronJobStatus) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -4043,7 +4043,7 @@ func (x *ScheduledJobStatus) CodecEncodeSelf(e *codec1978.Encoder) {
}
}
func (x *ScheduledJobStatus) CodecDecodeSelf(d *codec1978.Decoder) {
func (x *CronJobStatus) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -4073,7 +4073,7 @@ func (x *ScheduledJobStatus) CodecDecodeSelf(d *codec1978.Decoder) {
}
}
func (x *ScheduledJobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
func (x *CronJobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -4135,7 +4135,7 @@ func (x *ScheduledJobStatus) codecDecodeSelfFromMap(l int, d *codec1978.Decoder)
z.DecSendContainerState(codecSelfer_containerMapEnd1234)
}
func (x *ScheduledJobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
func (x *CronJobStatus) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -4443,7 +4443,7 @@ func (x codecSelfer1234) decSliceJobCondition(v *[]JobCondition, d *codec1978.De
}
}
func (x codecSelfer1234) encSliceScheduledJob(v []ScheduledJob, e *codec1978.Encoder) {
func (x codecSelfer1234) encSliceCronJob(v []CronJob, e *codec1978.Encoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
@ -4456,7 +4456,7 @@ func (x codecSelfer1234) encSliceScheduledJob(v []ScheduledJob, e *codec1978.Enc
z.EncSendContainerState(codecSelfer_containerArrayEnd1234)
}
func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.Decoder) {
func (x codecSelfer1234) decSliceCronJob(v *[]CronJob, d *codec1978.Decoder) {
var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
@ -4466,7 +4466,7 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
var yyc382 bool
if yyl382 == 0 {
if yyv382 == nil {
yyv382 = []ScheduledJob{}
yyv382 = []CronJob{}
yyc382 = true
} else if len(yyv382) != 0 {
yyv382 = yyv382[:0]
@ -4484,10 +4484,10 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
if yyrl382 <= cap(yyv382) {
yyv382 = yyv382[:yyrl382]
} else {
yyv382 = make([]ScheduledJob, yyrl382)
yyv382 = make([]CronJob, yyrl382)
}
} else {
yyv382 = make([]ScheduledJob, yyrl382)
yyv382 = make([]CronJob, yyrl382)
}
yyc382 = true
yyrr382 = len(yyv382)
@ -4502,7 +4502,7 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
for ; yyj382 < yyrr382; yyj382++ {
yyh382.ElemContainerState(yyj382)
if r.TryDecodeAsNil() {
yyv382[yyj382] = ScheduledJob{}
yyv382[yyj382] = CronJob{}
} else {
yyv383 := &yyv382[yyj382]
yyv383.CodecDecodeSelf(d)
@ -4511,10 +4511,10 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
}
if yyrt382 {
for ; yyj382 < yyl382; yyj382++ {
yyv382 = append(yyv382, ScheduledJob{})
yyv382 = append(yyv382, CronJob{})
yyh382.ElemContainerState(yyj382)
if r.TryDecodeAsNil() {
yyv382[yyj382] = ScheduledJob{}
yyv382[yyj382] = CronJob{}
} else {
yyv384 := &yyv382[yyj382]
yyv384.CodecDecodeSelf(d)
@ -4528,13 +4528,13 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
for ; !r.CheckBreak(); yyj382++ {
if yyj382 >= len(yyv382) {
yyv382 = append(yyv382, ScheduledJob{}) // var yyz382 ScheduledJob
yyv382 = append(yyv382, CronJob{}) // var yyz382 CronJob
yyc382 = true
}
yyh382.ElemContainerState(yyj382)
if yyj382 < len(yyv382) {
if r.TryDecodeAsNil() {
yyv382[yyj382] = ScheduledJob{}
yyv382[yyj382] = CronJob{}
} else {
yyv385 := &yyv382[yyj382]
yyv385.CodecDecodeSelf(d)
@ -4549,7 +4549,7 @@ func (x codecSelfer1234) decSliceScheduledJob(v *[]ScheduledJob, d *codec1978.De
yyv382 = yyv382[:yyj382]
yyc382 = true
} else if yyj382 == 0 && yyv382 == nil {
yyv382 = []ScheduledJob{}
yyv382 = []CronJob{}
yyc382 = true
}
}

View File

@ -196,8 +196,8 @@ type JobCondition struct {
// +genclient=true
// ScheduledJob represents the configuration of a single scheduled job.
type ScheduledJob struct {
// CronJob represents the configuration of a single cron job.
type CronJob struct {
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
@ -207,28 +207,28 @@ type ScheduledJob struct {
// 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
// +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.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
// +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.
type ScheduledJobList struct {
// CronJobList is a collection of cron jobs.
type CronJobList struct {
unversioned.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional
unversioned.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Items is the list of ScheduledJob.
Items []ScheduledJob `json:"items" protobuf:"bytes,2,rep,name=items"`
// Items is the list of CronJob.
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.
type ScheduledJobSpec struct {
// CronJobSpec describes how the job execution will look like and when it will actually run.
type CronJobSpec struct {
// Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
@ -248,7 +248,7 @@ type ScheduledJobSpec struct {
Suspend *bool `json:"suspend,omitempty" protobuf:"varint,4,opt,name=suspend"`
// 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"`
}
@ -259,7 +259,7 @@ type ScheduledJobSpec struct {
type ConcurrencyPolicy string
const (
// AllowConcurrent allows ScheduledJobs to run concurrently.
// AllowConcurrent allows CronJobs to run concurrently.
AllowConcurrent ConcurrencyPolicy = "Allow"
// ForbidConcurrent forbids concurrent runs, skipping next run if previous
@ -270,8 +270,8 @@ const (
ReplaceConcurrent ConcurrencyPolicy = "Replace"
)
// ScheduledJobStatus represents the current state of a Job.
type ScheduledJobStatus struct {
// CronJobStatus represents the current state of a cron job.
type CronJobStatus struct {
// Active holds pointers to currently running jobs.
// +optional
Active []v1.ObjectReference `json:"active,omitempty" protobuf:"bytes,1,rep,name=active"`

View File

@ -110,48 +110,48 @@ func (JobTemplateSpec) SwaggerDoc() map[string]string {
return map_JobTemplateSpec
}
var map_ScheduledJob = map[string]string{
"": "ScheduledJob represents the configuration of a single scheduled job.",
var map_CronJob = map[string]string{
"": "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",
"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",
}
func (ScheduledJob) SwaggerDoc() map[string]string {
return map_ScheduledJob
func (CronJob) SwaggerDoc() map[string]string {
return map_CronJob
}
var map_ScheduledJobList = map[string]string{
"": "ScheduledJobList is a collection of scheduled jobs.",
var map_CronJobList = map[string]string{
"": "CronJobList is a collection of scheduled jobs.",
"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 {
return map_ScheduledJobList
func (CronJobList) SwaggerDoc() map[string]string {
return map_CronJobList
}
var map_ScheduledJobSpec = map[string]string{
"": "ScheduledJobSpec describes how the job execution will look like and when it will actually run.",
var map_CronJobSpec = map[string]string{
"": "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.",
"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.",
"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 {
return map_ScheduledJobSpec
func (CronJobSpec) SwaggerDoc() map[string]string {
return map_CronJobSpec
}
var map_ScheduledJobStatus = map[string]string{
"": "ScheduledJobStatus represents the current state of a Job.",
var map_CronJobStatus = map[string]string{
"": "CronJobStatus represents the current state of a Job.",
"active": "Active holds pointers to currently running jobs.",
"lastScheduleTime": "LastScheduleTime keeps information of when was the last time the job was successfully scheduled.",
}
func (ScheduledJobStatus) SwaggerDoc() map[string]string {
return map_ScheduledJobStatus
func (CronJobStatus) SwaggerDoc() map[string]string {
return map_CronJobStatus
}
// AUTO-GENERATED FUNCTIONS END HERE

View File

@ -38,6 +38,14 @@ func init() {
// Public to allow building arbitrary schemes.
func RegisterConversions(scheme *runtime.Scheme) error {
return scheme.AddGeneratedConversionFuncs(
Convert_v2alpha1_CronJob_To_batch_CronJob,
Convert_batch_CronJob_To_v2alpha1_CronJob,
Convert_v2alpha1_CronJobList_To_batch_CronJobList,
Convert_batch_CronJobList_To_v2alpha1_CronJobList,
Convert_v2alpha1_CronJobSpec_To_batch_CronJobSpec,
Convert_batch_CronJobSpec_To_v2alpha1_CronJobSpec,
Convert_v2alpha1_CronJobStatus_To_batch_CronJobStatus,
Convert_batch_CronJobStatus_To_v2alpha1_CronJobStatus,
Convert_v2alpha1_Job_To_batch_Job,
Convert_batch_Job_To_v2alpha1_Job,
Convert_v2alpha1_JobCondition_To_batch_JobCondition,
@ -52,17 +60,135 @@ func RegisterConversions(scheme *runtime.Scheme) error {
Convert_batch_JobTemplate_To_v2alpha1_JobTemplate,
Convert_v2alpha1_JobTemplateSpec_To_batch_JobTemplateSpec,
Convert_batch_JobTemplateSpec_To_v2alpha1_JobTemplateSpec,
Convert_v2alpha1_ScheduledJob_To_batch_ScheduledJob,
Convert_batch_ScheduledJob_To_v2alpha1_ScheduledJob,
Convert_v2alpha1_ScheduledJobList_To_batch_ScheduledJobList,
Convert_batch_ScheduledJobList_To_v2alpha1_ScheduledJobList,
Convert_v2alpha1_ScheduledJobSpec_To_batch_ScheduledJobSpec,
Convert_batch_ScheduledJobSpec_To_v2alpha1_ScheduledJobSpec,
Convert_v2alpha1_ScheduledJobStatus_To_batch_ScheduledJobStatus,
Convert_batch_ScheduledJobStatus_To_v2alpha1_ScheduledJobStatus,
)
}
func autoConvert_v2alpha1_CronJob_To_batch_CronJob(in *CronJob, out *batch.CronJob, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_v2alpha1_CronJobSpec_To_batch_CronJobSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_v2alpha1_CronJobStatus_To_batch_CronJobStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_v2alpha1_CronJob_To_batch_CronJob(in *CronJob, out *batch.CronJob, s conversion.Scope) error {
return autoConvert_v2alpha1_CronJob_To_batch_CronJob(in, out, s)
}
func autoConvert_batch_CronJob_To_v2alpha1_CronJob(in *batch.CronJob, out *CronJob, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_batch_CronJobSpec_To_v2alpha1_CronJobSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_batch_CronJobStatus_To_v2alpha1_CronJobStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_batch_CronJob_To_v2alpha1_CronJob(in *batch.CronJob, out *CronJob, s conversion.Scope) error {
return autoConvert_batch_CronJob_To_v2alpha1_CronJob(in, out, s)
}
func autoConvert_v2alpha1_CronJobList_To_batch_CronJobList(in *CronJobList, out *batch.CronJobList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]batch.CronJob, len(*in))
for i := range *in {
if err := Convert_v2alpha1_CronJob_To_batch_CronJob(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_v2alpha1_CronJobList_To_batch_CronJobList(in *CronJobList, out *batch.CronJobList, s conversion.Scope) error {
return autoConvert_v2alpha1_CronJobList_To_batch_CronJobList(in, out, s)
}
func autoConvert_batch_CronJobList_To_v2alpha1_CronJobList(in *batch.CronJobList, out *CronJobList, s conversion.Scope) error {
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 := Convert_batch_CronJob_To_v2alpha1_CronJob(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_batch_CronJobList_To_v2alpha1_CronJobList(in *batch.CronJobList, out *CronJobList, s conversion.Scope) error {
return autoConvert_batch_CronJobList_To_v2alpha1_CronJobList(in, out, s)
}
func autoConvert_v2alpha1_CronJobSpec_To_batch_CronJobSpec(in *CronJobSpec, out *batch.CronJobSpec, s conversion.Scope) error {
out.Schedule = in.Schedule
out.StartingDeadlineSeconds = (*int64)(unsafe.Pointer(in.StartingDeadlineSeconds))
out.ConcurrencyPolicy = batch.ConcurrencyPolicy(in.ConcurrencyPolicy)
out.Suspend = (*bool)(unsafe.Pointer(in.Suspend))
if err := Convert_v2alpha1_JobTemplateSpec_To_batch_JobTemplateSpec(&in.JobTemplate, &out.JobTemplate, s); err != nil {
return err
}
return nil
}
func Convert_v2alpha1_CronJobSpec_To_batch_CronJobSpec(in *CronJobSpec, out *batch.CronJobSpec, s conversion.Scope) error {
return autoConvert_v2alpha1_CronJobSpec_To_batch_CronJobSpec(in, out, s)
}
func autoConvert_batch_CronJobSpec_To_v2alpha1_CronJobSpec(in *batch.CronJobSpec, out *CronJobSpec, s conversion.Scope) error {
out.Schedule = in.Schedule
out.StartingDeadlineSeconds = (*int64)(unsafe.Pointer(in.StartingDeadlineSeconds))
out.ConcurrencyPolicy = ConcurrencyPolicy(in.ConcurrencyPolicy)
out.Suspend = (*bool)(unsafe.Pointer(in.Suspend))
if err := Convert_batch_JobTemplateSpec_To_v2alpha1_JobTemplateSpec(&in.JobTemplate, &out.JobTemplate, s); err != nil {
return err
}
return nil
}
func Convert_batch_CronJobSpec_To_v2alpha1_CronJobSpec(in *batch.CronJobSpec, out *CronJobSpec, s conversion.Scope) error {
return autoConvert_batch_CronJobSpec_To_v2alpha1_CronJobSpec(in, out, s)
}
func autoConvert_v2alpha1_CronJobStatus_To_batch_CronJobStatus(in *CronJobStatus, out *batch.CronJobStatus, s conversion.Scope) error {
out.Active = *(*[]api.ObjectReference)(unsafe.Pointer(&in.Active))
out.LastScheduleTime = (*unversioned.Time)(unsafe.Pointer(in.LastScheduleTime))
return nil
}
func Convert_v2alpha1_CronJobStatus_To_batch_CronJobStatus(in *CronJobStatus, out *batch.CronJobStatus, s conversion.Scope) error {
return autoConvert_v2alpha1_CronJobStatus_To_batch_CronJobStatus(in, out, s)
}
func autoConvert_batch_CronJobStatus_To_v2alpha1_CronJobStatus(in *batch.CronJobStatus, out *CronJobStatus, s conversion.Scope) error {
out.Active = *(*[]v1.ObjectReference)(unsafe.Pointer(&in.Active))
out.LastScheduleTime = (*unversioned.Time)(unsafe.Pointer(in.LastScheduleTime))
return nil
}
func Convert_batch_CronJobStatus_To_v2alpha1_CronJobStatus(in *batch.CronJobStatus, out *CronJobStatus, s conversion.Scope) error {
return autoConvert_batch_CronJobStatus_To_v2alpha1_CronJobStatus(in, out, s)
}
func autoConvert_v2alpha1_Job_To_batch_Job(in *Job, out *batch.Job, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
@ -278,129 +404,3 @@ func autoConvert_batch_JobTemplateSpec_To_v2alpha1_JobTemplateSpec(in *batch.Job
func Convert_batch_JobTemplateSpec_To_v2alpha1_JobTemplateSpec(in *batch.JobTemplateSpec, out *JobTemplateSpec, s conversion.Scope) error {
return autoConvert_batch_JobTemplateSpec_To_v2alpha1_JobTemplateSpec(in, out, s)
}
func autoConvert_v2alpha1_ScheduledJob_To_batch_ScheduledJob(in *ScheduledJob, out *batch.ScheduledJob, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_v2alpha1_ScheduledJobSpec_To_batch_ScheduledJobSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_v2alpha1_ScheduledJobStatus_To_batch_ScheduledJobStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_v2alpha1_ScheduledJob_To_batch_ScheduledJob(in *ScheduledJob, out *batch.ScheduledJob, s conversion.Scope) error {
return autoConvert_v2alpha1_ScheduledJob_To_batch_ScheduledJob(in, out, s)
}
func autoConvert_batch_ScheduledJob_To_v2alpha1_ScheduledJob(in *batch.ScheduledJob, out *ScheduledJob, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it?
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_batch_ScheduledJobSpec_To_v2alpha1_ScheduledJobSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_batch_ScheduledJobStatus_To_v2alpha1_ScheduledJobStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
func Convert_batch_ScheduledJob_To_v2alpha1_ScheduledJob(in *batch.ScheduledJob, out *ScheduledJob, s conversion.Scope) error {
return autoConvert_batch_ScheduledJob_To_v2alpha1_ScheduledJob(in, out, s)
}
func autoConvert_v2alpha1_ScheduledJobList_To_batch_ScheduledJobList(in *ScheduledJobList, out *batch.ScheduledJobList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]batch.ScheduledJob, len(*in))
for i := range *in {
if err := Convert_v2alpha1_ScheduledJob_To_batch_ScheduledJob(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_v2alpha1_ScheduledJobList_To_batch_ScheduledJobList(in *ScheduledJobList, out *batch.ScheduledJobList, s conversion.Scope) error {
return autoConvert_v2alpha1_ScheduledJobList_To_batch_ScheduledJobList(in, out, s)
}
func autoConvert_batch_ScheduledJobList_To_v2alpha1_ScheduledJobList(in *batch.ScheduledJobList, out *ScheduledJobList, s conversion.Scope) error {
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 := Convert_batch_ScheduledJob_To_v2alpha1_ScheduledJob(&(*in)[i], &(*out)[i], s); err != nil {
return err
}
}
} else {
out.Items = nil
}
return nil
}
func Convert_batch_ScheduledJobList_To_v2alpha1_ScheduledJobList(in *batch.ScheduledJobList, out *ScheduledJobList, s conversion.Scope) error {
return autoConvert_batch_ScheduledJobList_To_v2alpha1_ScheduledJobList(in, out, s)
}
func autoConvert_v2alpha1_ScheduledJobSpec_To_batch_ScheduledJobSpec(in *ScheduledJobSpec, out *batch.ScheduledJobSpec, s conversion.Scope) error {
out.Schedule = in.Schedule
out.StartingDeadlineSeconds = (*int64)(unsafe.Pointer(in.StartingDeadlineSeconds))
out.ConcurrencyPolicy = batch.ConcurrencyPolicy(in.ConcurrencyPolicy)
out.Suspend = (*bool)(unsafe.Pointer(in.Suspend))
if err := Convert_v2alpha1_JobTemplateSpec_To_batch_JobTemplateSpec(&in.JobTemplate, &out.JobTemplate, s); err != nil {
return err
}
return nil
}
func Convert_v2alpha1_ScheduledJobSpec_To_batch_ScheduledJobSpec(in *ScheduledJobSpec, out *batch.ScheduledJobSpec, s conversion.Scope) error {
return autoConvert_v2alpha1_ScheduledJobSpec_To_batch_ScheduledJobSpec(in, out, s)
}
func autoConvert_batch_ScheduledJobSpec_To_v2alpha1_ScheduledJobSpec(in *batch.ScheduledJobSpec, out *ScheduledJobSpec, s conversion.Scope) error {
out.Schedule = in.Schedule
out.StartingDeadlineSeconds = (*int64)(unsafe.Pointer(in.StartingDeadlineSeconds))
out.ConcurrencyPolicy = ConcurrencyPolicy(in.ConcurrencyPolicy)
out.Suspend = (*bool)(unsafe.Pointer(in.Suspend))
if err := Convert_batch_JobTemplateSpec_To_v2alpha1_JobTemplateSpec(&in.JobTemplate, &out.JobTemplate, s); err != nil {
return err
}
return nil
}
func Convert_batch_ScheduledJobSpec_To_v2alpha1_ScheduledJobSpec(in *batch.ScheduledJobSpec, out *ScheduledJobSpec, s conversion.Scope) error {
return autoConvert_batch_ScheduledJobSpec_To_v2alpha1_ScheduledJobSpec(in, out, s)
}
func autoConvert_v2alpha1_ScheduledJobStatus_To_batch_ScheduledJobStatus(in *ScheduledJobStatus, out *batch.ScheduledJobStatus, s conversion.Scope) error {
out.Active = *(*[]api.ObjectReference)(unsafe.Pointer(&in.Active))
out.LastScheduleTime = (*unversioned.Time)(unsafe.Pointer(in.LastScheduleTime))
return nil
}
func Convert_v2alpha1_ScheduledJobStatus_To_batch_ScheduledJobStatus(in *ScheduledJobStatus, out *batch.ScheduledJobStatus, s conversion.Scope) error {
return autoConvert_v2alpha1_ScheduledJobStatus_To_batch_ScheduledJobStatus(in, out, s)
}
func autoConvert_batch_ScheduledJobStatus_To_v2alpha1_ScheduledJobStatus(in *batch.ScheduledJobStatus, out *ScheduledJobStatus, s conversion.Scope) error {
out.Active = *(*[]v1.ObjectReference)(unsafe.Pointer(&in.Active))
out.LastScheduleTime = (*unversioned.Time)(unsafe.Pointer(in.LastScheduleTime))
return nil
}
func Convert_batch_ScheduledJobStatus_To_v2alpha1_ScheduledJobStatus(in *batch.ScheduledJobStatus, out *ScheduledJobStatus, s conversion.Scope) error {
return autoConvert_batch_ScheduledJobStatus_To_v2alpha1_ScheduledJobStatus(in, out, s)
}

View File

@ -36,6 +36,10 @@ func init() {
// to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
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_JobCondition, InType: reflect.TypeOf(&JobCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v2alpha1_JobList, InType: reflect.TypeOf(&JobList{})},
@ -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_JobTemplate, InType: reflect.TypeOf(&JobTemplate{})},
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 {
{
in := in.(*Job)
@ -215,93 +305,3 @@ func DeepCopy_v2alpha1_JobTemplateSpec(in interface{}, out interface{}, c *conve
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
}
}

View File

@ -29,14 +29,138 @@ import (
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
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(&JobList{}, func(obj interface{}) { SetObjectDefaults_JobList(obj.(*JobList)) })
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
}
func SetObjectDefaults_CronJob(in *CronJob) {
SetDefaults_CronJob(in)
v1.SetDefaults_PodSpec(&in.Spec.JobTemplate.Spec.Template.Spec)
for i := range in.Spec.JobTemplate.Spec.Template.Spec.Volumes {
a := &in.Spec.JobTemplate.Spec.Template.Spec.Volumes[i]
v1.SetDefaults_Volume(a)
if a.VolumeSource.Secret != nil {
v1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret)
}
if a.VolumeSource.ISCSI != nil {
v1.SetDefaults_ISCSIVolumeSource(a.VolumeSource.ISCSI)
}
if a.VolumeSource.RBD != nil {
v1.SetDefaults_RBDVolumeSource(a.VolumeSource.RBD)
}
if a.VolumeSource.DownwardAPI != nil {
v1.SetDefaults_DownwardAPIVolumeSource(a.VolumeSource.DownwardAPI)
for j := range a.VolumeSource.DownwardAPI.Items {
b := &a.VolumeSource.DownwardAPI.Items[j]
if b.FieldRef != nil {
v1.SetDefaults_ObjectFieldSelector(b.FieldRef)
}
}
}
if a.VolumeSource.ConfigMap != nil {
v1.SetDefaults_ConfigMapVolumeSource(a.VolumeSource.ConfigMap)
}
if a.VolumeSource.AzureDisk != nil {
v1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk)
}
}
for i := range in.Spec.JobTemplate.Spec.Template.Spec.InitContainers {
a := &in.Spec.JobTemplate.Spec.Template.Spec.InitContainers[i]
v1.SetDefaults_Container(a)
for j := range a.Ports {
b := &a.Ports[j]
v1.SetDefaults_ContainerPort(b)
}
for j := range a.Env {
b := &a.Env[j]
if b.ValueFrom != nil {
if b.ValueFrom.FieldRef != nil {
v1.SetDefaults_ObjectFieldSelector(b.ValueFrom.FieldRef)
}
}
}
v1.SetDefaults_ResourceList(&a.Resources.Limits)
v1.SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
v1.SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
v1.SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
}
}
if a.Lifecycle != nil {
if a.Lifecycle.PostStart != nil {
if a.Lifecycle.PostStart.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PostStart.HTTPGet)
}
}
if a.Lifecycle.PreStop != nil {
if a.Lifecycle.PreStop.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PreStop.HTTPGet)
}
}
}
}
for i := range in.Spec.JobTemplate.Spec.Template.Spec.Containers {
a := &in.Spec.JobTemplate.Spec.Template.Spec.Containers[i]
v1.SetDefaults_Container(a)
for j := range a.Ports {
b := &a.Ports[j]
v1.SetDefaults_ContainerPort(b)
}
for j := range a.Env {
b := &a.Env[j]
if b.ValueFrom != nil {
if b.ValueFrom.FieldRef != nil {
v1.SetDefaults_ObjectFieldSelector(b.ValueFrom.FieldRef)
}
}
}
v1.SetDefaults_ResourceList(&a.Resources.Limits)
v1.SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
v1.SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
v1.SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
}
}
if a.Lifecycle != nil {
if a.Lifecycle.PostStart != nil {
if a.Lifecycle.PostStart.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PostStart.HTTPGet)
}
}
if a.Lifecycle.PreStop != nil {
if a.Lifecycle.PreStop.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PreStop.HTTPGet)
}
}
}
}
}
func SetObjectDefaults_CronJobList(in *CronJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_CronJob(a)
}
}
func SetObjectDefaults_Job(in *Job) {
SetDefaults_Job(in)
v1.SetDefaults_PodSpec(&in.Spec.Template.Spec)
@ -276,127 +400,3 @@ func SetObjectDefaults_JobTemplate(in *JobTemplate) {
}
}
}
func SetObjectDefaults_ScheduledJob(in *ScheduledJob) {
SetDefaults_ScheduledJob(in)
v1.SetDefaults_PodSpec(&in.Spec.JobTemplate.Spec.Template.Spec)
for i := range in.Spec.JobTemplate.Spec.Template.Spec.Volumes {
a := &in.Spec.JobTemplate.Spec.Template.Spec.Volumes[i]
v1.SetDefaults_Volume(a)
if a.VolumeSource.Secret != nil {
v1.SetDefaults_SecretVolumeSource(a.VolumeSource.Secret)
}
if a.VolumeSource.ISCSI != nil {
v1.SetDefaults_ISCSIVolumeSource(a.VolumeSource.ISCSI)
}
if a.VolumeSource.RBD != nil {
v1.SetDefaults_RBDVolumeSource(a.VolumeSource.RBD)
}
if a.VolumeSource.DownwardAPI != nil {
v1.SetDefaults_DownwardAPIVolumeSource(a.VolumeSource.DownwardAPI)
for j := range a.VolumeSource.DownwardAPI.Items {
b := &a.VolumeSource.DownwardAPI.Items[j]
if b.FieldRef != nil {
v1.SetDefaults_ObjectFieldSelector(b.FieldRef)
}
}
}
if a.VolumeSource.ConfigMap != nil {
v1.SetDefaults_ConfigMapVolumeSource(a.VolumeSource.ConfigMap)
}
if a.VolumeSource.AzureDisk != nil {
v1.SetDefaults_AzureDiskVolumeSource(a.VolumeSource.AzureDisk)
}
}
for i := range in.Spec.JobTemplate.Spec.Template.Spec.InitContainers {
a := &in.Spec.JobTemplate.Spec.Template.Spec.InitContainers[i]
v1.SetDefaults_Container(a)
for j := range a.Ports {
b := &a.Ports[j]
v1.SetDefaults_ContainerPort(b)
}
for j := range a.Env {
b := &a.Env[j]
if b.ValueFrom != nil {
if b.ValueFrom.FieldRef != nil {
v1.SetDefaults_ObjectFieldSelector(b.ValueFrom.FieldRef)
}
}
}
v1.SetDefaults_ResourceList(&a.Resources.Limits)
v1.SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
v1.SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
v1.SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
}
}
if a.Lifecycle != nil {
if a.Lifecycle.PostStart != nil {
if a.Lifecycle.PostStart.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PostStart.HTTPGet)
}
}
if a.Lifecycle.PreStop != nil {
if a.Lifecycle.PreStop.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PreStop.HTTPGet)
}
}
}
}
for i := range in.Spec.JobTemplate.Spec.Template.Spec.Containers {
a := &in.Spec.JobTemplate.Spec.Template.Spec.Containers[i]
v1.SetDefaults_Container(a)
for j := range a.Ports {
b := &a.Ports[j]
v1.SetDefaults_ContainerPort(b)
}
for j := range a.Env {
b := &a.Env[j]
if b.ValueFrom != nil {
if b.ValueFrom.FieldRef != nil {
v1.SetDefaults_ObjectFieldSelector(b.ValueFrom.FieldRef)
}
}
}
v1.SetDefaults_ResourceList(&a.Resources.Limits)
v1.SetDefaults_ResourceList(&a.Resources.Requests)
if a.LivenessProbe != nil {
v1.SetDefaults_Probe(a.LivenessProbe)
if a.LivenessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.LivenessProbe.Handler.HTTPGet)
}
}
if a.ReadinessProbe != nil {
v1.SetDefaults_Probe(a.ReadinessProbe)
if a.ReadinessProbe.Handler.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.ReadinessProbe.Handler.HTTPGet)
}
}
if a.Lifecycle != nil {
if a.Lifecycle.PostStart != nil {
if a.Lifecycle.PostStart.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PostStart.HTTPGet)
}
}
if a.Lifecycle.PreStop != nil {
if a.Lifecycle.PreStop.HTTPGet != nil {
v1.SetDefaults_HTTPGetAction(a.Lifecycle.PreStop.HTTPGet)
}
}
}
}
}
func SetObjectDefaults_ScheduledJobList(in *ScheduledJobList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_ScheduledJob(a)
}
}

View File

@ -158,14 +158,14 @@ func ValidateJobStatusUpdate(status, oldStatus batch.JobStatus) field.ErrorList
return allErrs
}
func ValidateScheduledJob(scheduledJob *batch.ScheduledJob) field.ErrorList {
// ScheduledJobs and rcs have the same name validation
func ValidateCronJob(scheduledJob *batch.CronJob) field.ErrorList {
// CronJobs and rcs have the same name validation
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
}
func ValidateScheduledJobSpec(spec *batch.ScheduledJobSpec, fldPath *field.Path) field.ErrorList {
func ValidateCronJobSpec(spec *batch.CronJobSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if len(spec.Schedule) == 0 {

View File

@ -304,19 +304,19 @@ func TestValidateJobUpdateStatus(t *testing.T) {
}
}
func TestValidateScheduledJob(t *testing.T) {
func TestValidateCronJob(t *testing.T) {
validManualSelector := getValidManualSelector()
validPodTemplateSpec := getValidPodTemplateSpecForGenerated(getValidGeneratedSelector())
validPodTemplateSpec.Labels = map[string]string{}
successCases := map[string]batch.ScheduledJob{
successCases := map[string]batch.CronJob{
"basic scheduled job": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -328,11 +328,11 @@ func TestValidateScheduledJob(t *testing.T) {
},
"non-standard scheduled": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "@hourly",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -344,7 +344,7 @@ func TestValidateScheduledJob(t *testing.T) {
},
}
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)
}
}
@ -352,14 +352,14 @@ func TestValidateScheduledJob(t *testing.T) {
negative := int32(-1)
negative64 := int64(-1)
errorCases := map[string]batch.ScheduledJob{
errorCases := map[string]batch.CronJob{
"spec.schedule: Invalid value": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "error",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -371,11 +371,11 @@ func TestValidateScheduledJob(t *testing.T) {
},
"spec.schedule: Required value": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -387,11 +387,11 @@ func TestValidateScheduledJob(t *testing.T) {
},
"spec.startingDeadlineSeconds:must be greater than or equal to 0": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
StartingDeadlineSeconds: &negative64,
@ -404,11 +404,11 @@ func TestValidateScheduledJob(t *testing.T) {
},
"spec.concurrencyPolicy: Required value": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
JobTemplate: batch.JobTemplateSpec{
Spec: batch.JobSpec{
@ -419,11 +419,11 @@ func TestValidateScheduledJob(t *testing.T) {
},
"spec.jobTemplate.spec.parallelism:must be greater than or equal to 0": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -436,11 +436,11 @@ func TestValidateScheduledJob(t *testing.T) {
},
"spec.jobTemplate.spec.completions:must be greater than or equal to 0": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -454,11 +454,11 @@ func TestValidateScheduledJob(t *testing.T) {
},
"spec.jobTemplate.spec.activeDeadlineSeconds:must be greater than or equal to 0": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -471,11 +471,11 @@ func TestValidateScheduledJob(t *testing.T) {
},
"spec.jobTemplate.spec.selector: Invalid value: {\"matchLabels\":{\"a\":\"b\"}}: `selector` will be auto-generated": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -488,11 +488,11 @@ func TestValidateScheduledJob(t *testing.T) {
},
"spec.jobTemplate.spec.manualSelector: Unsupported value": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -505,11 +505,11 @@ func TestValidateScheduledJob(t *testing.T) {
},
"spec.jobTemplate.spec.template.spec.restartPolicy: Unsupported value": {
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -528,7 +528,7 @@ func TestValidateScheduledJob(t *testing.T) {
}
for k, v := range errorCases {
errs := ValidateScheduledJob(&v)
errs := ValidateCronJob(&v)
if len(errs) == 0 {
t.Errorf("expected failure for %s", k)
} else {

View File

@ -36,6 +36,10 @@ func init() {
// to allow building arbitrary schemes.
func RegisterDeepCopies(scheme *runtime.Scheme) error {
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_JobCondition, InType: reflect.TypeOf(&JobCondition{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_batch_JobList, InType: reflect.TypeOf(&JobList{})},
@ -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_JobTemplate, InType: reflect.TypeOf(&JobTemplate{})},
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 {
{
in := in.(*Job)
@ -215,93 +305,3 @@ func DeepCopy_batch_JobTemplateSpec(in interface{}, out interface{}, c *conversi
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
}
}

View File

@ -14,10 +14,10 @@ go_library(
name = "go_default_library",
srcs = [
"batch_client.go",
"cronjob.go",
"doc.go",
"generated_expansion.go",
"job.go",
"scheduledjob.go",
],
tags = ["automanaged"],
deps = [

View File

@ -25,7 +25,7 @@ import (
type BatchInterface interface {
RESTClient() restclient.Interface
JobsGetter
ScheduledJobsGetter
CronJobsGetter
}
// 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 {
return newJobs(c, namespace)
}
func (c *BatchClient) ScheduledJobs(namespace string) ScheduledJobInterface {
return newScheduledJobs(c, namespace)
func (c *BatchClient) CronJobs(namespace string) CronJobInterface {
return newCronJobs(c, namespace)
}
// NewForConfig creates a new BatchClient for the given config.

View File

@ -23,34 +23,34 @@ import (
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.
type ScheduledJobsGetter interface {
ScheduledJobs(namespace string) ScheduledJobInterface
type CronJobsGetter interface {
CronJobs(namespace string) CronJobInterface
}
// ScheduledJobInterface has methods to work with ScheduledJob resources.
type ScheduledJobInterface interface {
Create(*batch.ScheduledJob) (*batch.ScheduledJob, error)
Update(*batch.ScheduledJob) (*batch.ScheduledJob, error)
UpdateStatus(*batch.ScheduledJob) (*batch.ScheduledJob, error)
// CronJobInterface has methods to work with CronJob resources.
type CronJobInterface interface {
Create(*batch.CronJob) (*batch.CronJob, error)
Update(*batch.CronJob) (*batch.CronJob, error)
UpdateStatus(*batch.CronJob) (*batch.CronJob, error)
Delete(name string, options *api.DeleteOptions) error
DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error
Get(name string) (*batch.ScheduledJob, error)
List(opts api.ListOptions) (*batch.ScheduledJobList, error)
Get(name string) (*batch.CronJob, error)
List(opts api.ListOptions) (*batch.CronJobList, error)
Watch(opts api.ListOptions) (watch.Interface, error)
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *batch.ScheduledJob, err error)
ScheduledJobExpansion
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *batch.CronJob, err error)
CronJobExpansion
}
// scheduledJobs implements ScheduledJobInterface
// scheduledJobs implements CronJobInterface
type scheduledJobs struct {
client restclient.Interface
ns string
}
// newScheduledJobs returns a ScheduledJobs
func newScheduledJobs(c *BatchClient, namespace string) *scheduledJobs {
// newCronJobs returns a CronJobs
func newCronJobs(c *BatchClient, namespace string) *scheduledJobs {
return &scheduledJobs{
client: c.RESTClient(),
ns: namespace,
@ -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.
func (c *scheduledJobs) Create(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
result = &batch.ScheduledJob{}
func (c *scheduledJobs) Create(scheduledJob *batch.CronJob) (result *batch.CronJob, err error) {
result = &batch.CronJob{}
err = c.client.Post().
Namespace(c.ns).
Resource("scheduledjobs").
Resource("cronjobs").
Body(scheduledJob).
Do().
Into(result)
@ -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.
func (c *scheduledJobs) Update(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
result = &batch.ScheduledJob{}
func (c *scheduledJobs) Update(scheduledJob *batch.CronJob) (result *batch.CronJob, err error) {
result = &batch.CronJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("scheduledjobs").
Resource("cronjobs").
Name(scheduledJob.Name).
Body(scheduledJob).
Do().
@ -82,11 +82,11 @@ func (c *scheduledJobs) Update(scheduledJob *batch.ScheduledJob) (result *batch.
return
}
func (c *scheduledJobs) UpdateStatus(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
result = &batch.ScheduledJob{}
func (c *scheduledJobs) UpdateStatus(scheduledJob *batch.CronJob) (result *batch.CronJob, err error) {
result = &batch.CronJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("scheduledjobs").
Resource("cronjobs").
Name(scheduledJob.Name).
SubResource("status").
Body(scheduledJob).
@ -99,7 +99,7 @@ func (c *scheduledJobs) UpdateStatus(scheduledJob *batch.ScheduledJob) (result *
func (c *scheduledJobs) Delete(name string, options *api.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("scheduledjobs").
Resource("cronjobs").
Name(name).
Body(options).
Do().
@ -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 {
return c.client.Delete().
Namespace(c.ns).
Resource("scheduledjobs").
Resource("cronjobs").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
@ -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.
func (c *scheduledJobs) Get(name string) (result *batch.ScheduledJob, err error) {
result = &batch.ScheduledJob{}
func (c *scheduledJobs) Get(name string) (result *batch.CronJob, err error) {
result = &batch.CronJob{}
err = c.client.Get().
Namespace(c.ns).
Resource("scheduledjobs").
Resource("cronjobs").
Name(name).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of ScheduledJobs that match those selectors.
func (c *scheduledJobs) List(opts api.ListOptions) (result *batch.ScheduledJobList, err error) {
result = &batch.ScheduledJobList{}
// 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.CronJobList, err error) {
result = &batch.CronJobList{}
err = c.client.Get().
Namespace(c.ns).
Resource("scheduledjobs").
Resource("cronjobs").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
@ -146,17 +146,17 @@ func (c *scheduledJobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("scheduledjobs").
Resource("cronjobs").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// 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) {
result = &batch.ScheduledJob{}
func (c *scheduledJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *batch.CronJob, err error) {
result = &batch.CronJob{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("scheduledjobs").
Resource("cronjobs").
SubResource(subresources...).
Name(name).
Body(data).

View File

@ -15,8 +15,8 @@ go_library(
srcs = [
"doc.go",
"fake_batch_client.go",
"fake_cronjob.go",
"fake_job.go",
"fake_scheduledjob.go",
],
tags = ["automanaged"],
deps = [

View File

@ -30,8 +30,8 @@ func (c *FakeBatch) Jobs(namespace string) internalversion.JobInterface {
return &FakeJobs{c, namespace}
}
func (c *FakeBatch) ScheduledJobs(namespace string) internalversion.ScheduledJobInterface {
return &FakeScheduledJobs{c, namespace}
func (c *FakeBatch) CronJobs(namespace string) internalversion.CronJobInterface {
return &FakeCronJobs{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate

View File

@ -0,0 +1,127 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
batch "k8s.io/kubernetes/pkg/apis/batch"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
watch "k8s.io/kubernetes/pkg/watch"
)
// FakeCronJobs implements CronJobInterface
type FakeCronJobs struct {
Fake *FakeBatch
ns string
}
var cronjobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "", Resource: "cronjobs"}
func (c *FakeCronJobs) Create(scheduledJob *batch.CronJob) (result *batch.CronJob, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(cronjobsResource, c.ns, scheduledJob), &batch.CronJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.CronJob), err
}
func (c *FakeCronJobs) Update(scheduledJob *batch.CronJob) (result *batch.CronJob, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(cronjobsResource, c.ns, scheduledJob), &batch.CronJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.CronJob), err
}
func (c *FakeCronJobs) UpdateStatus(scheduledJob *batch.CronJob) (*batch.CronJob, error) {
obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(cronjobsResource, "status", c.ns, scheduledJob), &batch.CronJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.CronJob), err
}
func (c *FakeCronJobs) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(cronjobsResource, c.ns, name), &batch.CronJob{})
return err
}
func (c *FakeCronJobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(cronjobsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &batch.CronJobList{})
return err
}
func (c *FakeCronJobs) Get(name string) (result *batch.CronJob, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(cronjobsResource, c.ns, name), &batch.CronJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.CronJob), err
}
func (c *FakeCronJobs) List(opts api.ListOptions) (result *batch.CronJobList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(cronjobsResource, c.ns, opts), &batch.CronJobList{})
if obj == nil {
return nil, err
}
label, _, _ := core.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &batch.CronJobList{}
for _, item := range obj.(*batch.CronJobList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested scheduledJobs.
func (c *FakeCronJobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(cronjobsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched scheduledJob.
func (c *FakeCronJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *batch.CronJob, err error) {
obj, err := c.Fake.
Invokes(core.NewPatchSubresourceAction(cronjobsResource, c.ns, name, data, subresources...), &batch.CronJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.CronJob), err
}

View File

@ -1,127 +0,0 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
batch "k8s.io/kubernetes/pkg/apis/batch"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
watch "k8s.io/kubernetes/pkg/watch"
)
// FakeScheduledJobs implements ScheduledJobInterface
type FakeScheduledJobs struct {
Fake *FakeBatch
ns string
}
var scheduledjobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "", Resource: "scheduledjobs"}
func (c *FakeScheduledJobs) Create(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(scheduledjobsResource, c.ns, scheduledJob), &batch.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.ScheduledJob), err
}
func (c *FakeScheduledJobs) Update(scheduledJob *batch.ScheduledJob) (result *batch.ScheduledJob, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(scheduledjobsResource, c.ns, scheduledJob), &batch.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.ScheduledJob), err
}
func (c *FakeScheduledJobs) UpdateStatus(scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error) {
obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(scheduledjobsResource, "status", c.ns, scheduledJob), &batch.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.ScheduledJob), err
}
func (c *FakeScheduledJobs) Delete(name string, options *api.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(scheduledjobsResource, c.ns, name), &batch.ScheduledJob{})
return err
}
func (c *FakeScheduledJobs) DeleteCollection(options *api.DeleteOptions, listOptions api.ListOptions) error {
action := core.NewDeleteCollectionAction(scheduledjobsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &batch.ScheduledJobList{})
return err
}
func (c *FakeScheduledJobs) Get(name string) (result *batch.ScheduledJob, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(scheduledjobsResource, c.ns, name), &batch.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.ScheduledJob), err
}
func (c *FakeScheduledJobs) List(opts api.ListOptions) (result *batch.ScheduledJobList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(scheduledjobsResource, c.ns, opts), &batch.ScheduledJobList{})
if obj == nil {
return nil, err
}
label, _, _ := core.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &batch.ScheduledJobList{}
for _, item := range obj.(*batch.ScheduledJobList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested scheduledJobs.
func (c *FakeScheduledJobs) Watch(opts api.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(scheduledjobsResource, c.ns, opts))
}
// 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) {
obj, err := c.Fake.
Invokes(core.NewPatchSubresourceAction(scheduledjobsResource, c.ns, name, data, subresources...), &batch.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*batch.ScheduledJob), err
}

View File

@ -18,4 +18,4 @@ package internalversion
type JobExpansion interface{}
type ScheduledJobExpansion interface{}
type CronJobExpansion interface{}

View File

@ -14,10 +14,10 @@ go_library(
name = "go_default_library",
srcs = [
"batch_client.go",
"cronjob.go",
"doc.go",
"generated_expansion.go",
"job.go",
"scheduledjob.go",
],
tags = ["automanaged"],
deps = [

View File

@ -28,7 +28,7 @@ import (
type BatchV2alpha1Interface interface {
RESTClient() restclient.Interface
JobsGetter
ScheduledJobsGetter
CronJobsGetter
}
// 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 {
return newJobs(c, namespace)
}
func (c *BatchV2alpha1Client) ScheduledJobs(namespace string) ScheduledJobInterface {
return newScheduledJobs(c, namespace)
func (c *BatchV2alpha1Client) CronJobs(namespace string) CronJobInterface {
return newCronJobs(c, namespace)
}
// NewForConfig creates a new BatchV2alpha1Client for the given config.

View File

@ -0,0 +1,167 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v2alpha1
import (
api "k8s.io/kubernetes/pkg/api"
v1 "k8s.io/kubernetes/pkg/api/v1"
v2alpha1 "k8s.io/kubernetes/pkg/apis/batch/v2alpha1"
restclient "k8s.io/kubernetes/pkg/client/restclient"
watch "k8s.io/kubernetes/pkg/watch"
)
// CronJobsGetter has a method to return a CronJobInterface.
// A group's client should implement this interface.
type CronJobsGetter interface {
CronJobs(namespace string) CronJobInterface
}
// CronJobInterface has methods to work with CronJob resources.
type CronJobInterface interface {
Create(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
Update(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
UpdateStatus(*v2alpha1.CronJob) (*v2alpha1.CronJob, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string) (*v2alpha1.CronJob, error)
List(opts v1.ListOptions) (*v2alpha1.CronJobList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error)
CronJobExpansion
}
// cronJobs implements CronJobInterface
type cronJobs struct {
client restclient.Interface
ns string
}
// newCronJobs returns a CronJobs
func newCronJobs(c *BatchV2alpha1Client, namespace string) *cronJobs {
return &cronJobs{
client: c.RESTClient(),
ns: namespace,
}
}
// 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 *cronJobs) Create(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
result = &v2alpha1.CronJob{}
err = c.client.Post().
Namespace(c.ns).
Resource("cronjobs").
Body(cronJob).
Do().
Into(result)
return
}
// 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 *cronJobs) Update(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
result = &v2alpha1.CronJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("cronjobs").
Name(cronJob.Name).
Body(cronJob).
Do().
Into(result)
return
}
func (c *cronJobs) UpdateStatus(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
result = &v2alpha1.CronJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("cronjobs").
Name(cronJob.Name).
SubResource("status").
Body(cronJob).
Do().
Into(result)
return
}
// Delete takes name of the cronJob and deletes it. Returns an error if one occurs.
func (c *cronJobs) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("cronjobs").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *cronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("cronjobs").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// Get takes name of the cronJob, and returns the corresponding cronJob object, and an error if there is any.
func (c *cronJobs) Get(name string) (result *v2alpha1.CronJob, err error) {
result = &v2alpha1.CronJob{}
err = c.client.Get().
Namespace(c.ns).
Resource("cronjobs").
Name(name).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of CronJobs that match those selectors.
func (c *cronJobs) List(opts v1.ListOptions) (result *v2alpha1.CronJobList, err error) {
result = &v2alpha1.CronJobList{}
err = c.client.Get().
Namespace(c.ns).
Resource("cronjobs").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested cronJobs.
func (c *cronJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("cronjobs").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched cronJob.
func (c *cronJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error) {
result = &v2alpha1.CronJob{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("cronjobs").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -15,8 +15,8 @@ go_library(
srcs = [
"doc.go",
"fake_batch_client.go",
"fake_cronjob.go",
"fake_job.go",
"fake_scheduledjob.go",
],
tags = ["automanaged"],
deps = [

View File

@ -30,8 +30,8 @@ func (c *FakeBatchV2alpha1) Jobs(namespace string) v2alpha1.JobInterface {
return &FakeJobs{c, namespace}
}
func (c *FakeBatchV2alpha1) ScheduledJobs(namespace string) v2alpha1.ScheduledJobInterface {
return &FakeScheduledJobs{c, namespace}
func (c *FakeBatchV2alpha1) CronJobs(namespace string) v2alpha1.CronJobInterface {
return &FakeCronJobs{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate

View File

@ -0,0 +1,128 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1"
v2alpha1 "k8s.io/kubernetes/pkg/apis/batch/v2alpha1"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
watch "k8s.io/kubernetes/pkg/watch"
)
// FakeCronJobs implements CronJobInterface
type FakeCronJobs struct {
Fake *FakeBatchV2alpha1
ns string
}
var cronjobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}
func (c *FakeCronJobs) Create(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(cronjobsResource, c.ns, cronJob), &v2alpha1.CronJob{})
if obj == nil {
return nil, err
}
return obj.(*v2alpha1.CronJob), err
}
func (c *FakeCronJobs) Update(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(cronjobsResource, c.ns, cronJob), &v2alpha1.CronJob{})
if obj == nil {
return nil, err
}
return obj.(*v2alpha1.CronJob), err
}
func (c *FakeCronJobs) UpdateStatus(cronJob *v2alpha1.CronJob) (*v2alpha1.CronJob, error) {
obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(cronjobsResource, "status", c.ns, cronJob), &v2alpha1.CronJob{})
if obj == nil {
return nil, err
}
return obj.(*v2alpha1.CronJob), err
}
func (c *FakeCronJobs) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(cronjobsResource, c.ns, name), &v2alpha1.CronJob{})
return err
}
func (c *FakeCronJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := core.NewDeleteCollectionAction(cronjobsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v2alpha1.CronJobList{})
return err
}
func (c *FakeCronJobs) Get(name string) (result *v2alpha1.CronJob, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(cronjobsResource, c.ns, name), &v2alpha1.CronJob{})
if obj == nil {
return nil, err
}
return obj.(*v2alpha1.CronJob), err
}
func (c *FakeCronJobs) List(opts v1.ListOptions) (result *v2alpha1.CronJobList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(cronjobsResource, c.ns, opts), &v2alpha1.CronJobList{})
if obj == nil {
return nil, err
}
label, _, _ := core.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v2alpha1.CronJobList{}
for _, item := range obj.(*v2alpha1.CronJobList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested cronJobs.
func (c *FakeCronJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(cronjobsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched cronJob.
func (c *FakeCronJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.CronJob, err error) {
obj, err := c.Fake.
Invokes(core.NewPatchSubresourceAction(cronjobsResource, c.ns, name, data, subresources...), &v2alpha1.CronJob{})
if obj == nil {
return nil, err
}
return obj.(*v2alpha1.CronJob), err
}

View File

@ -1,128 +0,0 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package fake
import (
api "k8s.io/kubernetes/pkg/api"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1"
v2alpha1 "k8s.io/kubernetes/pkg/apis/batch/v2alpha1"
core "k8s.io/kubernetes/pkg/client/testing/core"
labels "k8s.io/kubernetes/pkg/labels"
watch "k8s.io/kubernetes/pkg/watch"
)
// FakeScheduledJobs implements ScheduledJobInterface
type FakeScheduledJobs struct {
Fake *FakeBatchV2alpha1
ns string
}
var scheduledjobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "scheduledjobs"}
func (c *FakeScheduledJobs) Create(scheduledJob *v2alpha1.ScheduledJob) (result *v2alpha1.ScheduledJob, err error) {
obj, err := c.Fake.
Invokes(core.NewCreateAction(scheduledjobsResource, c.ns, scheduledJob), &v2alpha1.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*v2alpha1.ScheduledJob), err
}
func (c *FakeScheduledJobs) Update(scheduledJob *v2alpha1.ScheduledJob) (result *v2alpha1.ScheduledJob, err error) {
obj, err := c.Fake.
Invokes(core.NewUpdateAction(scheduledjobsResource, c.ns, scheduledJob), &v2alpha1.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*v2alpha1.ScheduledJob), err
}
func (c *FakeScheduledJobs) UpdateStatus(scheduledJob *v2alpha1.ScheduledJob) (*v2alpha1.ScheduledJob, error) {
obj, err := c.Fake.
Invokes(core.NewUpdateSubresourceAction(scheduledjobsResource, "status", c.ns, scheduledJob), &v2alpha1.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*v2alpha1.ScheduledJob), err
}
func (c *FakeScheduledJobs) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(core.NewDeleteAction(scheduledjobsResource, c.ns, name), &v2alpha1.ScheduledJob{})
return err
}
func (c *FakeScheduledJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := core.NewDeleteCollectionAction(scheduledjobsResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v2alpha1.ScheduledJobList{})
return err
}
func (c *FakeScheduledJobs) Get(name string) (result *v2alpha1.ScheduledJob, err error) {
obj, err := c.Fake.
Invokes(core.NewGetAction(scheduledjobsResource, c.ns, name), &v2alpha1.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*v2alpha1.ScheduledJob), err
}
func (c *FakeScheduledJobs) List(opts v1.ListOptions) (result *v2alpha1.ScheduledJobList, err error) {
obj, err := c.Fake.
Invokes(core.NewListAction(scheduledjobsResource, c.ns, opts), &v2alpha1.ScheduledJobList{})
if obj == nil {
return nil, err
}
label, _, _ := core.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v2alpha1.ScheduledJobList{}
for _, item := range obj.(*v2alpha1.ScheduledJobList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested scheduledJobs.
func (c *FakeScheduledJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(core.NewWatchAction(scheduledjobsResource, c.ns, opts))
}
// Patch applies the patch and returns the patched scheduledJob.
func (c *FakeScheduledJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.ScheduledJob, err error) {
obj, err := c.Fake.
Invokes(core.NewPatchSubresourceAction(scheduledjobsResource, c.ns, name, data, subresources...), &v2alpha1.ScheduledJob{})
if obj == nil {
return nil, err
}
return obj.(*v2alpha1.ScheduledJob), err
}

View File

@ -18,4 +18,4 @@ package v2alpha1
type JobExpansion interface{}
type ScheduledJobExpansion interface{}
type CronJobExpansion interface{}

View File

@ -1,167 +0,0 @@
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v2alpha1
import (
api "k8s.io/kubernetes/pkg/api"
v1 "k8s.io/kubernetes/pkg/api/v1"
v2alpha1 "k8s.io/kubernetes/pkg/apis/batch/v2alpha1"
restclient "k8s.io/kubernetes/pkg/client/restclient"
watch "k8s.io/kubernetes/pkg/watch"
)
// ScheduledJobsGetter has a method to return a ScheduledJobInterface.
// A group's client should implement this interface.
type ScheduledJobsGetter interface {
ScheduledJobs(namespace string) ScheduledJobInterface
}
// ScheduledJobInterface has methods to work with ScheduledJob resources.
type ScheduledJobInterface interface {
Create(*v2alpha1.ScheduledJob) (*v2alpha1.ScheduledJob, error)
Update(*v2alpha1.ScheduledJob) (*v2alpha1.ScheduledJob, error)
UpdateStatus(*v2alpha1.ScheduledJob) (*v2alpha1.ScheduledJob, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string) (*v2alpha1.ScheduledJob, error)
List(opts v1.ListOptions) (*v2alpha1.ScheduledJobList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.ScheduledJob, err error)
ScheduledJobExpansion
}
// scheduledJobs implements ScheduledJobInterface
type scheduledJobs struct {
client restclient.Interface
ns string
}
// newScheduledJobs returns a ScheduledJobs
func newScheduledJobs(c *BatchV2alpha1Client, namespace string) *scheduledJobs {
return &scheduledJobs{
client: c.RESTClient(),
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.
func (c *scheduledJobs) Create(scheduledJob *v2alpha1.ScheduledJob) (result *v2alpha1.ScheduledJob, err error) {
result = &v2alpha1.ScheduledJob{}
err = c.client.Post().
Namespace(c.ns).
Resource("scheduledjobs").
Body(scheduledJob).
Do().
Into(result)
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.
func (c *scheduledJobs) Update(scheduledJob *v2alpha1.ScheduledJob) (result *v2alpha1.ScheduledJob, err error) {
result = &v2alpha1.ScheduledJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("scheduledjobs").
Name(scheduledJob.Name).
Body(scheduledJob).
Do().
Into(result)
return
}
func (c *scheduledJobs) UpdateStatus(scheduledJob *v2alpha1.ScheduledJob) (result *v2alpha1.ScheduledJob, err error) {
result = &v2alpha1.ScheduledJob{}
err = c.client.Put().
Namespace(c.ns).
Resource("scheduledjobs").
Name(scheduledJob.Name).
SubResource("status").
Body(scheduledJob).
Do().
Into(result)
return
}
// Delete takes name of the scheduledJob and deletes it. Returns an error if one occurs.
func (c *scheduledJobs) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("scheduledjobs").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *scheduledJobs) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("scheduledjobs").
VersionedParams(&listOptions, api.ParameterCodec).
Body(options).
Do().
Error()
}
// 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 *v2alpha1.ScheduledJob, err error) {
result = &v2alpha1.ScheduledJob{}
err = c.client.Get().
Namespace(c.ns).
Resource("scheduledjobs").
Name(name).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of ScheduledJobs that match those selectors.
func (c *scheduledJobs) List(opts v1.ListOptions) (result *v2alpha1.ScheduledJobList, err error) {
result = &v2alpha1.ScheduledJobList{}
err = c.client.Get().
Namespace(c.ns).
Resource("scheduledjobs").
VersionedParams(&opts, api.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested scheduledJobs.
func (c *scheduledJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.client.Get().
Prefix("watch").
Namespace(c.ns).
Resource("scheduledjobs").
VersionedParams(&opts, api.ParameterCodec).
Watch()
}
// Patch applies the patch and returns the patched scheduledJob.
func (c *scheduledJobs) Patch(name string, pt api.PatchType, data []byte, subresources ...string) (result *v2alpha1.ScheduledJob, err error) {
result = &v2alpha1.ScheduledJob{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("scheduledjobs").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -13,10 +13,10 @@ load(
go_library(
name = "go_default_library",
srcs = [
"cronjob.go",
"expansion_generated.go",
"job.go",
"job_expansion.go",
"scheduledjob.go",
],
tags = ["automanaged"],
deps = [

View File

@ -25,70 +25,70 @@ import (
"k8s.io/kubernetes/pkg/labels"
)
// ScheduledJobLister helps list ScheduledJobs.
type ScheduledJobLister interface {
// List lists all ScheduledJobs in the indexer.
List(selector labels.Selector) (ret []*batch.ScheduledJob, err error)
// ScheduledJobs returns an object that can list and get ScheduledJobs.
ScheduledJobs(namespace string) ScheduledJobNamespaceLister
ScheduledJobListerExpansion
// CronJobLister helps list CronJobs.
type CronJobLister interface {
// List lists all CronJobs in the indexer.
List(selector labels.Selector) (ret []*batch.CronJob, err error)
// CronJobs returns an object that can list and get CronJobs.
CronJobs(namespace string) CronJobNamespaceLister
CronJobListerExpansion
}
// scheduledJobLister implements the ScheduledJobLister interface.
type scheduledJobLister struct {
// cronJobLister implements the CronJobLister interface.
type cronJobLister struct {
indexer cache.Indexer
}
// NewScheduledJobLister returns a new ScheduledJobLister.
func NewScheduledJobLister(indexer cache.Indexer) ScheduledJobLister {
return &scheduledJobLister{indexer: indexer}
// NewCronJobLister returns a new CronJobLister.
func NewCronJobLister(indexer cache.Indexer) CronJobLister {
return &cronJobLister{indexer: indexer}
}
// List lists all ScheduledJobs in the indexer.
func (s *scheduledJobLister) List(selector labels.Selector) (ret []*batch.ScheduledJob, err error) {
// List lists all CronJobs in the indexer.
func (s *cronJobLister) List(selector labels.Selector) (ret []*batch.CronJob, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*batch.ScheduledJob))
ret = append(ret, m.(*batch.CronJob))
})
return ret, err
}
// ScheduledJobs returns an object that can list and get ScheduledJobs.
func (s *scheduledJobLister) ScheduledJobs(namespace string) ScheduledJobNamespaceLister {
return scheduledJobNamespaceLister{indexer: s.indexer, namespace: namespace}
// CronJobs returns an object that can list and get CronJobs.
func (s *cronJobLister) CronJobs(namespace string) CronJobNamespaceLister {
return cronJobNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ScheduledJobNamespaceLister helps list and get ScheduledJobs.
type ScheduledJobNamespaceLister interface {
// List lists all ScheduledJobs in the indexer for a given namespace.
List(selector labels.Selector) (ret []*batch.ScheduledJob, err error)
// Get retrieves the ScheduledJob from the indexer for a given namespace and name.
Get(name string) (*batch.ScheduledJob, error)
ScheduledJobNamespaceListerExpansion
// CronJobNamespaceLister helps list and get CronJobs.
type CronJobNamespaceLister interface {
// List lists all CronJobs in the indexer for a given namespace.
List(selector labels.Selector) (ret []*batch.CronJob, err error)
// Get retrieves the CronJob from the indexer for a given namespace and name.
Get(name string) (*batch.CronJob, error)
CronJobNamespaceListerExpansion
}
// scheduledJobNamespaceLister implements the ScheduledJobNamespaceLister
// cronJobNamespaceLister implements the CronJobNamespaceLister
// interface.
type scheduledJobNamespaceLister struct {
type cronJobNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ScheduledJobs in the indexer for a given namespace.
func (s scheduledJobNamespaceLister) List(selector labels.Selector) (ret []*batch.ScheduledJob, err error) {
// List lists all CronJobs in the indexer for a given namespace.
func (s cronJobNamespaceLister) List(selector labels.Selector) (ret []*batch.CronJob, err error) {
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
}
// Get retrieves the ScheduledJob from the indexer for a given namespace and name.
func (s scheduledJobNamespaceLister) Get(name string) (*batch.ScheduledJob, error) {
// Get retrieves the CronJob from the indexer for a given namespace and name.
func (s cronJobNamespaceLister) Get(name string) (*batch.CronJob, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
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
}

View File

@ -18,10 +18,10 @@ limitations under the License.
package internalversion
// ScheduledJobListerExpansion allows custom methods to be added to
// ScheduledJobLister.
type ScheduledJobListerExpansion interface{}
// CronJobListerExpansion allows custom methods to be added to
// CronJobLister.
type CronJobListerExpansion interface{}
// ScheduledJobNamespaceListerExpansion allows custom methods to be added to
// ScheduledJobNamespaeLister.
type ScheduledJobNamespaceListerExpansion interface{}
// CronJobNamespaceListerExpansion allows custom methods to be added to
// CronJobNamespaeLister.
type CronJobNamespaceListerExpansion interface{}

View File

@ -13,9 +13,9 @@ load(
go_library(
name = "go_default_library",
srcs = [
"cronjob.go",
"expansion_generated.go",
"job.go",
"scheduledjob.go",
],
tags = ["automanaged"],
deps = [

View File

@ -26,70 +26,70 @@ import (
"k8s.io/kubernetes/pkg/labels"
)
// ScheduledJobLister helps list ScheduledJobs.
type ScheduledJobLister interface {
// List lists all ScheduledJobs in the indexer.
List(selector labels.Selector) (ret []*v2alpha1.ScheduledJob, err error)
// ScheduledJobs returns an object that can list and get ScheduledJobs.
ScheduledJobs(namespace string) ScheduledJobNamespaceLister
ScheduledJobListerExpansion
// CronJobLister helps list CronJobs.
type CronJobLister interface {
// List lists all CronJobs in the indexer.
List(selector labels.Selector) (ret []*v2alpha1.CronJob, err error)
// CronJobs returns an object that can list and get CronJobs.
CronJobs(namespace string) CronJobNamespaceLister
CronJobListerExpansion
}
// scheduledJobLister implements the ScheduledJobLister interface.
type scheduledJobLister struct {
// cronJobLister implements the CronJobLister interface.
type cronJobLister struct {
indexer cache.Indexer
}
// NewScheduledJobLister returns a new ScheduledJobLister.
func NewScheduledJobLister(indexer cache.Indexer) ScheduledJobLister {
return &scheduledJobLister{indexer: indexer}
// NewCronJobLister returns a new CronJobLister.
func NewCronJobLister(indexer cache.Indexer) CronJobLister {
return &cronJobLister{indexer: indexer}
}
// List lists all ScheduledJobs in the indexer.
func (s *scheduledJobLister) List(selector labels.Selector) (ret []*v2alpha1.ScheduledJob, err error) {
// List lists all CronJobs in the indexer.
func (s *cronJobLister) List(selector labels.Selector) (ret []*v2alpha1.CronJob, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v2alpha1.ScheduledJob))
ret = append(ret, m.(*v2alpha1.CronJob))
})
return ret, err
}
// ScheduledJobs returns an object that can list and get ScheduledJobs.
func (s *scheduledJobLister) ScheduledJobs(namespace string) ScheduledJobNamespaceLister {
return scheduledJobNamespaceLister{indexer: s.indexer, namespace: namespace}
// CronJobs returns an object that can list and get CronJobs.
func (s *cronJobLister) CronJobs(namespace string) CronJobNamespaceLister {
return cronJobNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// ScheduledJobNamespaceLister helps list and get ScheduledJobs.
type ScheduledJobNamespaceLister interface {
// List lists all ScheduledJobs in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v2alpha1.ScheduledJob, err error)
// Get retrieves the ScheduledJob from the indexer for a given namespace and name.
Get(name string) (*v2alpha1.ScheduledJob, error)
ScheduledJobNamespaceListerExpansion
// CronJobNamespaceLister helps list and get CronJobs.
type CronJobNamespaceLister interface {
// List lists all CronJobs in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v2alpha1.CronJob, err error)
// Get retrieves the CronJob from the indexer for a given namespace and name.
Get(name string) (*v2alpha1.CronJob, error)
CronJobNamespaceListerExpansion
}
// scheduledJobNamespaceLister implements the ScheduledJobNamespaceLister
// cronJobNamespaceLister implements the CronJobNamespaceLister
// interface.
type scheduledJobNamespaceLister struct {
type cronJobNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all ScheduledJobs in the indexer for a given namespace.
func (s scheduledJobNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.ScheduledJob, err error) {
// List lists all CronJobs in the indexer for a given namespace.
func (s cronJobNamespaceLister) List(selector labels.Selector) (ret []*v2alpha1.CronJob, err error) {
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
}
// Get retrieves the ScheduledJob from the indexer for a given namespace and name.
func (s scheduledJobNamespaceLister) Get(name string) (*v2alpha1.ScheduledJob, error) {
// Get retrieves the CronJob from the indexer for a given namespace and name.
func (s cronJobNamespaceLister) Get(name string) (*v2alpha1.CronJob, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
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
}

View File

@ -26,10 +26,10 @@ type JobListerExpansion interface{}
// JobNamespaeLister.
type JobNamespaceListerExpansion interface{}
// ScheduledJobListerExpansion allows custom methods to be added to
// ScheduledJobLister.
type ScheduledJobListerExpansion interface{}
// CronJobListerExpansion allows custom methods to be added to
// CronJobLister.
type CronJobListerExpansion interface{}
// ScheduledJobNamespaceListerExpansion allows custom methods to be added to
// ScheduledJobNamespaeLister.
type ScheduledJobNamespaceListerExpansion interface{}
// CronJobNamespaceListerExpansion allows custom methods to be added to
// CronJobNamespaeLister.
type CronJobNamespaceListerExpansion interface{}

View File

@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
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
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
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
UndeltaStore.)
@ -49,9 +49,9 @@ import (
"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
jobControl jobControlInterface
sjControl sjControlInterface
@ -59,51 +59,51 @@ type ScheduledJobController struct {
recorder record.EventRecorder
}
func NewScheduledJobController(kubeClient clientset.Interface) *ScheduledJobController {
func NewCronJobController(kubeClient clientset.Interface) *CronJobController {
eventBroadcaster := record.NewBroadcaster()
eventBroadcaster.StartLogging(glog.Infof)
// TODO: remove the wrapper when every clients have moved to use the clientset.
eventBroadcaster.StartRecordingToSink(&unversionedcore.EventSinkImpl{Interface: kubeClient.Core().Events("")})
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,
jobControl: realJobControl{KubeClient: kubeClient},
sjControl: &realSJControl{KubeClient: kubeClient},
podControl: &realPodControl{KubeClient: kubeClient},
recorder: eventBroadcaster.NewRecorder(api.EventSource{Component: "scheduledjob-controller"}),
recorder: eventBroadcaster.NewRecorder(api.EventSource{Component: "cronjob-controller"}),
}
return jm
}
func NewScheduledJobControllerFromClient(kubeClient clientset.Interface) *ScheduledJobController {
jm := NewScheduledJobController(kubeClient)
func NewCronJobControllerFromClient(kubeClient clientset.Interface) *CronJobController {
jm := NewCronJobController(kubeClient)
return jm
}
// 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()
glog.Infof("Starting ScheduledJob Manager")
glog.Infof("Starting CronJob Manager")
// Check things every 10 second.
go wait.Until(jm.SyncAll, 10*time.Second, stopCh)
<-stopCh
glog.Infof("Shutting down ScheduledJob Manager")
glog.Infof("Shutting down CronJob Manager")
}
// SyncAll lists all the ScheduledJobs and Jobs and reconciles them.
func (jm *ScheduledJobController) SyncAll() {
sjl, err := jm.kubeClient.Batch().ScheduledJobs(api.NamespaceAll).List(api.ListOptions{})
// SyncAll lists all the CronJobs and Jobs and reconciles them.
func (jm *CronJobController) SyncAll() {
sjl, err := jm.kubeClient.Batch().CronJobs(api.NamespaceAll).List(api.ListOptions{})
if err != nil {
glog.Errorf("Error listing scheduledjobs: %v", err)
glog.Errorf("Error listing cronjobs: %v", err)
return
}
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{})
if err != nil {
@ -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".
// The current time is passed in 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)
for i := range js {

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package scheduledjob
package cronjob
import (
"testing"
@ -72,17 +72,17 @@ func justAfterThePriorHour() time.Time {
return T1
}
// returns a scheduledJob with some fields filled in.
func scheduledJob() batch.ScheduledJob {
return batch.ScheduledJob{
// returns a cronJob with some fields filled in.
func cronJob() batch.CronJob {
return batch.CronJob{
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: "snazzycats",
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()},
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -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},
}
for name, tc := range testCases {
sj := scheduledJob()
sj := cronJob()
sj.Spec.ConcurrencyPolicy = tc.concurrencyPolicy
sj.Spec.Suspend = &tc.suspend
sj.Spec.Schedule = tc.schedule
@ -338,7 +338,7 @@ func TestSyncOne_Status(t *testing.T) {
for name, tc := range testCases {
// Setup the test
sj := scheduledJob()
sj := cronJob()
sj.Spec.ConcurrencyPolicy = tc.concurrencyPolicy
sj.Spec.Suspend = &tc.suspend
sj.Spec.Schedule = tc.schedule

View File

@ -14,5 +14,5 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
// Package scheduledjob contains the controller for ScheduledJob objects.
package scheduledjob
// Package cronjob contains the controller for CronJob objects.
package cronjob

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package scheduledjob
package cronjob
import (
"fmt"
@ -27,10 +27,10 @@ import (
"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.
type sjControlInterface interface {
UpdateStatus(sj *batch.ScheduledJob) (*batch.ScheduledJob, error)
UpdateStatus(sj *batch.CronJob) (*batch.CronJob, error)
}
// realSJControl is the default implementation of sjControlInterface.
@ -40,18 +40,18 @@ type realSJControl struct {
var _ sjControlInterface = &realSJControl{}
func (c *realSJControl) UpdateStatus(sj *batch.ScheduledJob) (*batch.ScheduledJob, error) {
return c.KubeClient.Batch().ScheduledJobs(sj.Namespace).UpdateStatus(sj)
func (c *realSJControl) UpdateStatus(sj *batch.CronJob) (*batch.CronJob, error) {
return c.KubeClient.Batch().CronJobs(sj.Namespace).UpdateStatus(sj)
}
// fakeSJControl is the default implementation of sjControlInterface.
type fakeSJControl struct {
Updates []batch.ScheduledJob
Updates []batch.CronJob
}
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)
return sj, nil
}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package scheduledjob
package cronjob
import (
"encoding/json"
@ -33,9 +33,9 @@ import (
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 {
if j.UID == uid {
return true
@ -44,7 +44,7 @@ func inActiveList(sj batch.ScheduledJob, uid types.UID) bool {
return false
}
func deleteFromActiveList(sj *batch.ScheduledJob, uid types.UID) {
func deleteFromActiveList(sj *batch.CronJob, uid types.UID) {
if sj == nil {
return
}
@ -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)
return types.UID(""), false
}
if sr.Reference.Kind != "ScheduledJob" {
glog.V(4).Infof("Job with non-ScheduledJob parent, name %s namespace %s", j.Name, j.Namespace)
if sr.Reference.Kind != "CronJob" {
glog.V(4).Infof("Job with non-CronJob parent, name %s namespace %s", j.Name, j.Namespace)
return types.UID(""), false
}
// 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) {
// groupJobsByParent groups jobs into a map keyed by the job parent UID (e.g. scheduledJob).
// 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)
for _, job := range js {
parentUID, found := getParentUIDFromJob(job)
@ -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 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{}
sched, err := cron.ParseStandard(sj.Spec.Schedule)
if err != nil {
@ -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
// started a job, but have not noticed it yet (distributed systems can
// 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
}
@ -172,8 +172,8 @@ func getRecentUnmetScheduleTimes(sj batch.ScheduledJob, now time.Time) ([]time.T
// XXX unit test this
// getJobFromTemplate makes a Job from a ScheduledJob
func getJobFromTemplate(sj *batch.ScheduledJob, scheduledTime time.Time) (*batch.Job, error) {
// getJobFromTemplate makes a Job from a CronJob
func getJobFromTemplate(sj *batch.CronJob, scheduledTime time.Time) (*batch.Job, error) {
// TODO: consider adding the following labels:
// nominal-start-time=$RFC_3339_DATE_OF_INTENDED_START -- for user convenience
// scheduled-job-name=$SJ_NAME -- for user convenience

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package scheduledjob
package cronjob
import (
//"fmt"
@ -37,14 +37,14 @@ func TestGetJobFromTemplate(t *testing.T) {
var one int64 = 1
var no bool = false
sj := batch.ScheduledJob{
sj := batch.CronJob{
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: "snazzycats",
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: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -77,7 +77,7 @@ func TestGetJobFromTemplate(t *testing.T) {
if err != nil {
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")
}
if len(job.ObjectMeta.Labels) != 1 {
@ -90,7 +90,7 @@ func TestGetJobFromTemplate(t *testing.T) {
if !ok {
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) {
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) {
}
{
// 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")
@ -158,14 +158,14 @@ func TestGroupJobsByParent(t *testing.T) {
uid1 := types.UID("11111111-1111-1111-1111-111111111111")
uid2 := types.UID("22222222-2222-2222-2222-222222222222")
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"}}`}
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"}}`}
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"}}`}
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":"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":"CronJob","namespace":"y","name":"pi","uid":"33333333-3333-3333-3333-333333333333","apiVersion":"extensions","resourceVersion":"333333"}}`}
noCreatedBy := map[string]string{}
{
// Case 1: There are no jobs and scheduledJobs
sjs := []batch.ScheduledJob{}
sjs := []batch.CronJob{}
js := []batch.Job{}
jobsBySj := groupJobsByParent(sjs, js)
if len(jobsBySj) != 0 {
@ -175,7 +175,7 @@ func TestGroupJobsByParent(t *testing.T) {
{
// Case 2: there is one controller with no job.
sjs := []batch.ScheduledJob{
sjs := []batch.CronJob{
{ObjectMeta: api.ObjectMeta{Name: "e", Namespace: "x", UID: uid1}},
}
js := []batch.Job{}
@ -187,7 +187,7 @@ func TestGroupJobsByParent(t *testing.T) {
{
// 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}},
}
js := []batch.Job{
@ -219,7 +219,7 @@ func TestGroupJobsByParent(t *testing.T) {
{ObjectMeta: api.ObjectMeta{Name: "b", Namespace: "y", Annotations: createdBy3}},
{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: "f", Namespace: "x", UID: uid2}},
{ObjectMeta: api.ObjectMeta{Name: "g", Namespace: "y", UID: uid3}},
@ -269,13 +269,13 @@ func TestGetRecentUnmetScheduleTimes(t *testing.T) {
t.Errorf("test setup error: %v", err)
}
sj := batch.ScheduledJob{
sj := batch.CronJob{
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
UID: types.UID("1a2b3c"),
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: schedule,
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{},

View File

@ -862,6 +862,142 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
},
Dependencies: []string{},
},
"batch.CronJob": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronJob represents the configuration of a single cron job.",
Properties: map[string]spec.Schema{
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
Ref: spec.MustCreateRef("#/definitions/api.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Description: "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",
Ref: spec.MustCreateRef("#/definitions/batch.CronJobSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "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",
Ref: spec.MustCreateRef("#/definitions/batch.CronJobStatus"),
},
},
},
},
},
Dependencies: []string{
"api.ObjectMeta", "batch.CronJobSpec", "batch.CronJobStatus"},
},
"batch.CronJobList": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronJobList is a collection of cron jobs.",
Properties: map[string]spec.Schema{
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
Ref: spec.MustCreateRef("#/definitions/unversioned.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Description: "Items is the list of CronJob.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: spec.MustCreateRef("#/definitions/batch.CronJob"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"batch.CronJob", "unversioned.ListMeta"},
},
"batch.CronJobSpec": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronJobSpec describes how the job execution will look like and when it will actually run.",
Properties: map[string]spec.Schema{
"schedule": {
SchemaProps: spec.SchemaProps{
Description: "Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.",
Type: []string{"string"},
Format: "",
},
},
"startingDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
Description: "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.",
Type: []string{"integer"},
Format: "int64",
},
},
"concurrencyPolicy": {
SchemaProps: spec.SchemaProps{
Description: "ConcurrencyPolicy specifies how to treat concurrent executions of a Job.",
Type: []string{"string"},
Format: "",
},
},
"suspend": {
SchemaProps: spec.SchemaProps{
Description: "Suspend flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.",
Type: []string{"boolean"},
Format: "",
},
},
"jobTemplate": {
SchemaProps: spec.SchemaProps{
Description: "JobTemplate is the object that describes the job that will be created when executing a CronJob.",
Ref: spec.MustCreateRef("#/definitions/batch.JobTemplateSpec"),
},
},
},
Required: []string{"schedule", "jobTemplate"},
},
},
Dependencies: []string{
"batch.JobTemplateSpec"},
},
"batch.CronJobStatus": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronJobStatus represents the current state of a cron job.",
Properties: map[string]spec.Schema{
"active": {
SchemaProps: spec.SchemaProps{
Description: "Active holds pointers to currently running jobs.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: spec.MustCreateRef("#/definitions/api.ObjectReference"),
},
},
},
},
},
"lastScheduleTime": {
SchemaProps: spec.SchemaProps{
Description: "LastScheduleTime keeps information of when was the last time the job was successfully scheduled.",
Ref: spec.MustCreateRef("#/definitions/unversioned.Time"),
},
},
},
},
},
Dependencies: []string{
"api.ObjectReference", "unversioned.Time"},
},
"batch.Job": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
@ -1129,142 +1265,6 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
Dependencies: []string{
"api.ObjectMeta", "batch.JobSpec"},
},
"batch.ScheduledJob": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ScheduledJob represents the configuration of a single scheduled job.",
Properties: map[string]spec.Schema{
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
Ref: spec.MustCreateRef("#/definitions/api.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Description: "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",
Ref: spec.MustCreateRef("#/definitions/batch.ScheduledJobSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "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",
Ref: spec.MustCreateRef("#/definitions/batch.ScheduledJobStatus"),
},
},
},
},
},
Dependencies: []string{
"api.ObjectMeta", "batch.ScheduledJobSpec", "batch.ScheduledJobStatus"},
},
"batch.ScheduledJobList": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ScheduledJobList is a collection of scheduled jobs.",
Properties: map[string]spec.Schema{
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
Ref: spec.MustCreateRef("#/definitions/unversioned.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Description: "Items is the list of ScheduledJob.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: spec.MustCreateRef("#/definitions/batch.ScheduledJob"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"batch.ScheduledJob", "unversioned.ListMeta"},
},
"batch.ScheduledJobSpec": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ScheduledJobSpec describes how the job execution will look like and when it will actually run.",
Properties: map[string]spec.Schema{
"schedule": {
SchemaProps: spec.SchemaProps{
Description: "Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.",
Type: []string{"string"},
Format: "",
},
},
"startingDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
Description: "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.",
Type: []string{"integer"},
Format: "int64",
},
},
"concurrencyPolicy": {
SchemaProps: spec.SchemaProps{
Description: "ConcurrencyPolicy specifies how to treat concurrent executions of a Job.",
Type: []string{"string"},
Format: "",
},
},
"suspend": {
SchemaProps: spec.SchemaProps{
Description: "Suspend flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.",
Type: []string{"boolean"},
Format: "",
},
},
"jobTemplate": {
SchemaProps: spec.SchemaProps{
Description: "JobTemplate is the object that describes the job that will be created when executing a ScheduledJob.",
Ref: spec.MustCreateRef("#/definitions/batch.JobTemplateSpec"),
},
},
},
Required: []string{"schedule", "jobTemplate"},
},
},
Dependencies: []string{
"batch.JobTemplateSpec"},
},
"batch.ScheduledJobStatus": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ScheduledJobStatus represents the current state of a Job.",
Properties: map[string]spec.Schema{
"active": {
SchemaProps: spec.SchemaProps{
Description: "Active holds pointers to currently running jobs.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: spec.MustCreateRef("#/definitions/api.ObjectReference"),
},
},
},
},
},
"lastScheduleTime": {
SchemaProps: spec.SchemaProps{
Description: "LastScheduleTime keeps information of when was the last time the job was successfully scheduled.",
Ref: spec.MustCreateRef("#/definitions/unversioned.Time"),
},
},
},
},
},
Dependencies: []string{
"api.ObjectReference", "unversioned.Time"},
},
"certificates.CertificateSigningRequest": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
@ -18387,6 +18387,142 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
},
Dependencies: []string{},
},
"v2alpha1.CronJob": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronJob represents the configuration of a single cron job.",
Properties: map[string]spec.Schema{
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
Ref: spec.MustCreateRef("#/definitions/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Description: "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",
Ref: spec.MustCreateRef("#/definitions/v2alpha1.CronJobSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "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",
Ref: spec.MustCreateRef("#/definitions/v2alpha1.CronJobStatus"),
},
},
},
},
},
Dependencies: []string{
"v1.ObjectMeta", "v2alpha1.CronJobSpec", "v2alpha1.CronJobStatus"},
},
"v2alpha1.CronJobList": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronJobList is a collection of cron jobs.",
Properties: map[string]spec.Schema{
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
Ref: spec.MustCreateRef("#/definitions/unversioned.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Description: "Items is the list of CronJob.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: spec.MustCreateRef("#/definitions/v2alpha1.CronJob"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"unversioned.ListMeta", "v2alpha1.CronJob"},
},
"v2alpha1.CronJobSpec": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronJobSpec describes how the job execution will look like and when it will actually run.",
Properties: map[string]spec.Schema{
"schedule": {
SchemaProps: spec.SchemaProps{
Description: "Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.",
Type: []string{"string"},
Format: "",
},
},
"startingDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
Description: "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.",
Type: []string{"integer"},
Format: "int64",
},
},
"concurrencyPolicy": {
SchemaProps: spec.SchemaProps{
Description: "ConcurrencyPolicy specifies how to treat concurrent executions of a Job.",
Type: []string{"string"},
Format: "",
},
},
"suspend": {
SchemaProps: spec.SchemaProps{
Description: "Suspend flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.",
Type: []string{"boolean"},
Format: "",
},
},
"jobTemplate": {
SchemaProps: spec.SchemaProps{
Description: "JobTemplate is the object that describes the job that will be created when executing a CronJob.",
Ref: spec.MustCreateRef("#/definitions/v2alpha1.JobTemplateSpec"),
},
},
},
Required: []string{"schedule", "jobTemplate"},
},
},
Dependencies: []string{
"v2alpha1.JobTemplateSpec"},
},
"v2alpha1.CronJobStatus": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "CronJobStatus represents the current state of a cron job.",
Properties: map[string]spec.Schema{
"active": {
SchemaProps: spec.SchemaProps{
Description: "Active holds pointers to currently running jobs.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: spec.MustCreateRef("#/definitions/v1.ObjectReference"),
},
},
},
},
},
"lastScheduleTime": {
SchemaProps: spec.SchemaProps{
Description: "LastScheduleTime keeps information of when was the last time the job was successfully scheduled.",
Ref: spec.MustCreateRef("#/definitions/unversioned.Time"),
},
},
},
},
},
Dependencies: []string{
"unversioned.Time", "v1.ObjectReference"},
},
"v2alpha1.Job": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
@ -18654,142 +18790,6 @@ var OpenAPIDefinitions *common.OpenAPIDefinitions = &common.OpenAPIDefinitions{
Dependencies: []string{
"v1.ObjectMeta", "v2alpha1.JobSpec"},
},
"v2alpha1.ScheduledJob": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ScheduledJob represents the configuration of a single scheduled job.",
Properties: map[string]spec.Schema{
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
Ref: spec.MustCreateRef("#/definitions/v1.ObjectMeta"),
},
},
"spec": {
SchemaProps: spec.SchemaProps{
Description: "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",
Ref: spec.MustCreateRef("#/definitions/v2alpha1.ScheduledJobSpec"),
},
},
"status": {
SchemaProps: spec.SchemaProps{
Description: "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",
Ref: spec.MustCreateRef("#/definitions/v2alpha1.ScheduledJobStatus"),
},
},
},
},
},
Dependencies: []string{
"v1.ObjectMeta", "v2alpha1.ScheduledJobSpec", "v2alpha1.ScheduledJobStatus"},
},
"v2alpha1.ScheduledJobList": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ScheduledJobList is a collection of scheduled jobs.",
Properties: map[string]spec.Schema{
"metadata": {
SchemaProps: spec.SchemaProps{
Description: "Standard list metadata More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata",
Ref: spec.MustCreateRef("#/definitions/unversioned.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
Description: "Items is the list of ScheduledJob.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: spec.MustCreateRef("#/definitions/v2alpha1.ScheduledJob"),
},
},
},
},
},
},
Required: []string{"items"},
},
},
Dependencies: []string{
"unversioned.ListMeta", "v2alpha1.ScheduledJob"},
},
"v2alpha1.ScheduledJobSpec": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ScheduledJobSpec describes how the job execution will look like and when it will actually run.",
Properties: map[string]spec.Schema{
"schedule": {
SchemaProps: spec.SchemaProps{
Description: "Schedule contains the schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.",
Type: []string{"string"},
Format: "",
},
},
"startingDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
Description: "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.",
Type: []string{"integer"},
Format: "int64",
},
},
"concurrencyPolicy": {
SchemaProps: spec.SchemaProps{
Description: "ConcurrencyPolicy specifies how to treat concurrent executions of a Job.",
Type: []string{"string"},
Format: "",
},
},
"suspend": {
SchemaProps: spec.SchemaProps{
Description: "Suspend flag tells the controller to suspend subsequent executions, it does not apply to already started executions. Defaults to false.",
Type: []string{"boolean"},
Format: "",
},
},
"jobTemplate": {
SchemaProps: spec.SchemaProps{
Description: "JobTemplate is the object that describes the job that will be created when executing a ScheduledJob.",
Ref: spec.MustCreateRef("#/definitions/v2alpha1.JobTemplateSpec"),
},
},
},
Required: []string{"schedule", "jobTemplate"},
},
},
Dependencies: []string{
"v2alpha1.JobTemplateSpec"},
},
"v2alpha1.ScheduledJobStatus": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
Description: "ScheduledJobStatus represents the current state of a Job.",
Properties: map[string]spec.Schema{
"active": {
SchemaProps: spec.SchemaProps{
Description: "Active holds pointers to currently running jobs.",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Ref: spec.MustCreateRef("#/definitions/v1.ObjectReference"),
},
},
},
},
},
"lastScheduleTime": {
SchemaProps: spec.SchemaProps{
Description: "LastScheduleTime keeps information of when was the last time the job was successfully scheduled.",
Ref: spec.MustCreateRef("#/definitions/unversioned.Time"),
},
},
},
},
},
Dependencies: []string{
"unversioned.Time", "v1.ObjectReference"},
},
"version.Info": {
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{

View File

@ -81,7 +81,7 @@ var (
# 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)'
# 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)'`)
)
@ -197,7 +197,7 @@ func Run(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *cobr
generatorName := cmdutil.GetFlagString(cmd, "generator")
schedule := cmdutil.GetFlagString(cmd, "schedule")
if len(schedule) != 0 && len(generatorName) == 0 {
generatorName = "scheduledjob/v2alpha1"
generatorName = "cronjob/v2alpha1"
}
if len(generatorName) == 0 {
clientset, err := f.ClientSet()

View File

@ -198,7 +198,7 @@ const (
DeploymentBasicV1Beta1GeneratorName = "deployment-basic/v1beta1"
JobV1Beta1GeneratorName = "job/v1beta1"
JobV1GeneratorName = "job/v1"
ScheduledJobV2Alpha1GeneratorName = "scheduledjob/v2alpha1"
CronJobV2Alpha1GeneratorName = "cronjob/v2alpha1"
NamespaceV1GeneratorName = "namespace/v1"
ResourceQuotaV1GeneratorName = "resourcequotas/v1"
SecretV1GeneratorName = "secret/v1"
@ -235,12 +235,12 @@ func DefaultGenerators(cmdName string) map[string]kubectl.Generator {
}
case "run":
generator = map[string]kubectl.Generator{
RunV1GeneratorName: kubectl.BasicReplicationController{},
RunPodV1GeneratorName: kubectl.BasicPod{},
DeploymentV1Beta1GeneratorName: kubectl.DeploymentV1Beta1{},
JobV1Beta1GeneratorName: kubectl.JobV1Beta1{},
JobV1GeneratorName: kubectl.JobV1{},
ScheduledJobV2Alpha1GeneratorName: kubectl.ScheduledJobV2Alpha1{},
RunV1GeneratorName: kubectl.BasicReplicationController{},
RunPodV1GeneratorName: kubectl.BasicPod{},
DeploymentV1Beta1GeneratorName: kubectl.DeploymentV1Beta1{},
JobV1Beta1GeneratorName: kubectl.JobV1Beta1{},
JobV1GeneratorName: kubectl.JobV1{},
CronJobV2Alpha1GeneratorName: kubectl.CronJobV2Alpha1{},
}
case "autoscale":
generator = map[string]kubectl.Generator{

View File

@ -116,7 +116,7 @@ func describerMap(c clientset.Interface) map[unversioned.GroupKind]Describer {
extensions.Kind("Job"): &JobDescriber{c},
extensions.Kind("Ingress"): &IngressDescriber{c},
batch.Kind("Job"): &JobDescriber{c},
batch.Kind("ScheduledJob"): &ScheduledJobDescriber{c},
batch.Kind("CronJob"): &CronJobDescriber{c},
apps.Kind("StatefulSet"): &StatefulSetDescriber{c},
certificates.Kind("CertificateSigningRequest"): &CertificateSigningRequestDescriber{c},
storage.Kind("StorageClass"): &StorageClassDescriber{c},
@ -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.
type ScheduledJobDescriber struct {
// CronJobDescriber generates information about a scheduled job and the jobs it has created.
type CronJobDescriber struct {
clientset.Interface
}
func (d *ScheduledJobDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (string, error) {
scheduledJob, err := d.Batch().ScheduledJobs(namespace).Get(name)
func (d *CronJobDescriber) Describe(namespace, name string, describerSettings DescriberSettings) (string, error) {
scheduledJob, err := d.Batch().CronJobs(namespace).Get(name)
if err != nil {
return "", err
}
@ -1238,10 +1238,10 @@ func (d *ScheduledJobDescriber) Describe(namespace, name string, describerSettin
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 {
fmt.Fprintf(out, "Name:\t%s\n", scheduledJob.Name)
fmt.Fprintf(out, "Namespace:\t%s\n", scheduledJob.Namespace)

View File

@ -477,7 +477,7 @@ var (
replicationControllerColumns = []string{"NAME", "DESIRED", "CURRENT", "READY", "AGE"}
replicaSetColumns = []string{"NAME", "DESIRED", "CURRENT", "READY", "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"}
ingressColumns = []string{"NAME", "HOSTS", "ADDRESS", "PORTS", "AGE"}
statefulSetColumns = []string{"NAME", "DESIRED", "CURRENT", "AGE"}
@ -544,8 +544,8 @@ func (h *HumanReadablePrinter) addDefaultHandlers() {
h.Handler(daemonSetColumns, printDaemonSetList)
h.Handler(jobColumns, printJob)
h.Handler(jobColumns, printJobList)
h.Handler(scheduledJobColumns, printScheduledJob)
h.Handler(scheduledJobColumns, printScheduledJobList)
h.Handler(cronJobColumns, printCronJob)
h.Handler(cronJobColumns, printCronJobList)
h.Handler(serviceColumns, printService)
h.Handler(serviceColumns, printServiceList)
h.Handler(ingressColumns, printIngress)
@ -1028,9 +1028,9 @@ func printJobList(list *batch.JobList, w io.Writer, options PrintOptions) error
return nil
}
func printScheduledJob(scheduledJob *batch.ScheduledJob, w io.Writer, options PrintOptions) error {
name := scheduledJob.Name
namespace := scheduledJob.Namespace
func printCronJob(cronJob *batch.CronJob, w io.Writer, options PrintOptions) error {
name := cronJob.Name
namespace := cronJob.Namespace
if options.WithNamespace {
if _, err := fmt.Fprintf(w, "%s\t", namespace); err != nil {
@ -1039,14 +1039,14 @@ func printScheduledJob(scheduledJob *batch.ScheduledJob, w io.Writer, options Pr
}
lastScheduleTime := "<none>"
if scheduledJob.Status.LastScheduleTime != nil {
lastScheduleTime = scheduledJob.Status.LastScheduleTime.Time.Format(time.RFC1123Z)
if cronJob.Status.LastScheduleTime != nil {
lastScheduleTime = cronJob.Status.LastScheduleTime.Time.Format(time.RFC1123Z)
}
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%d\t%s\n",
name,
scheduledJob.Spec.Schedule,
printBoolPtr(scheduledJob.Spec.Suspend),
len(scheduledJob.Status.Active),
cronJob.Spec.Schedule,
printBoolPtr(cronJob.Spec.Suspend),
len(cronJob.Status.Active),
lastScheduleTime,
); err != nil {
return err
@ -1055,9 +1055,9 @@ func printScheduledJob(scheduledJob *batch.ScheduledJob, w io.Writer, options Pr
return nil
}
func printScheduledJobList(list *batch.ScheduledJobList, w io.Writer, options PrintOptions) error {
for _, scheduledJob := range list.Items {
if err := printScheduledJob(&scheduledJob, w, options); err != nil {
func printCronJobList(list *batch.CronJobList, w io.Writer, options PrintOptions) error {
for _, cronJob := range list.Items {
if err := printCronJob(&cronJob, w, options); err != nil {
return err
}
}

View File

@ -401,9 +401,9 @@ func (JobV1) Generate(genericParams map[string]interface{}) (runtime.Object, err
return &job, nil
}
type ScheduledJobV2Alpha1 struct{}
type CronJobV2Alpha1 struct{}
func (ScheduledJobV2Alpha1) ParamNames() []GeneratorParam {
func (CronJobV2Alpha1) ParamNames() []GeneratorParam {
return []GeneratorParam{
{"labels", false},
{"default-name", false},
@ -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)
if err != nil {
return nil, err
@ -477,12 +477,12 @@ func (ScheduledJobV2Alpha1) Generate(genericParams map[string]interface{}) (runt
}
podSpec.RestartPolicy = restartPolicy
scheduledJob := batchv2alpha1.ScheduledJob{
cronJob := batchv2alpha1.CronJob{
ObjectMeta: v1.ObjectMeta{
Name: name,
Labels: labels,
},
Spec: batchv2alpha1.ScheduledJobSpec{
Spec: batchv2alpha1.CronJobSpec{
Schedule: params["schedule"],
ConcurrencyPolicy: batchv2alpha1.AllowConcurrent,
JobTemplate: batchv2alpha1.JobTemplateSpec{
@ -498,7 +498,7 @@ func (ScheduledJobV2Alpha1) Generate(genericParams map[string]interface{}) (runt
},
}
return &scheduledJob, nil
return &cronJob, nil
}
type BasicReplicationController struct{}

View File

@ -14,6 +14,6 @@ See the License for the specific language governing permissions and
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.
package scheduledjob // import "k8s.io/kubernetes/pkg/registry/batch/scheduledjob"
package cronjob // import "k8s.io/kubernetes/pkg/registry/batch/cronjob"

View File

@ -18,7 +18,7 @@ go_library(
"//pkg/api:go_default_library",
"//pkg/api/rest: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/generic:go_default_library",
"//pkg/registry/generic/registry:go_default_library",

View File

@ -20,7 +20,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/rest"
"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/generic"
"k8s.io/kubernetes/pkg/registry/generic/registry"
@ -33,23 +33,23 @@ type REST struct {
*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) {
prefix := "/" + opts.ResourcePrefix
newListFunc := func() runtime.Object { return &batch.ScheduledJobList{} }
newListFunc := func() runtime.Object { return &batch.CronJobList{} }
storageInterface, dFunc := opts.Decorator(
opts.StorageConfig,
cachesize.GetWatchCacheSizeByResource(cachesize.ScheduledJobs),
&batch.ScheduledJob{},
cachesize.GetWatchCacheSizeByResource(cachesize.CronJobs),
&batch.CronJob{},
prefix,
scheduledjob.Strategy,
cronjob.Strategy,
newListFunc,
storage.NoTriggerPublisher,
)
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: newListFunc,
@ -65,27 +65,27 @@ func NewREST(opts generic.RESTOptions) (*REST, *StatusREST) {
},
// Retrieve the name field of a scheduled job
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
PredicateFunc: scheduledjob.MatchScheduledJob,
QualifiedResource: batch.Resource("scheduledjobs"),
PredicateFunc: cronjob.MatchCronJob,
QualifiedResource: batch.Resource("cronjobs"),
EnableGarbageCollection: opts.EnableGarbageCollection,
DeleteCollectionWorkers: opts.DeleteCollectionWorkers,
// Used to validate scheduled job creation
CreateStrategy: scheduledjob.Strategy,
CreateStrategy: cronjob.Strategy,
// Used to validate scheduled job updates
UpdateStrategy: scheduledjob.Strategy,
DeleteStrategy: scheduledjob.Strategy,
UpdateStrategy: cronjob.Strategy,
DeleteStrategy: cronjob.Strategy,
Storage: storageInterface,
DestroyFunc: dFunc,
}
statusStore := *store
statusStore.UpdateStrategy = scheduledjob.StatusStrategy
statusStore.UpdateStrategy = cronjob.StatusStrategy
return &REST{store}, &StatusREST{store: &statusStore}
}
@ -96,7 +96,7 @@ type StatusREST struct {
}
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.

View File

@ -38,13 +38,13 @@ func newStorage(t *testing.T) (*REST, *StatusREST, *etcdtesting.EtcdTestServer)
return storage, statusStorage, server
}
func validNewScheduledJob() *batch.ScheduledJob {
return &batch.ScheduledJob{
func validNewCronJob() *batch.CronJob {
return &batch.CronJob{
ObjectMeta: api.ObjectMeta{
Name: "foo",
Namespace: api.NamespaceDefault,
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -72,14 +72,14 @@ func TestCreate(t *testing.T) {
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
validScheduledJob := validNewScheduledJob()
validScheduledJob.ObjectMeta = api.ObjectMeta{}
validCronJob := validNewCronJob()
validCronJob.ObjectMeta = api.ObjectMeta{}
test.TestCreate(
// valid
validScheduledJob,
validCronJob,
// invalid (empty spec)
&batch.ScheduledJob{
Spec: batch.ScheduledJobSpec{},
&batch.CronJob{
Spec: batch.CronJobSpec{},
},
)
}
@ -97,16 +97,16 @@ func TestUpdate(t *testing.T) {
schedule := "1 1 1 1 ?"
test.TestUpdate(
// valid
validNewScheduledJob(),
validNewCronJob(),
// updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*batch.ScheduledJob)
object := obj.(*batch.CronJob)
object.Spec.Schedule = schedule
return object
},
// invalid updateFunc
func(obj runtime.Object) runtime.Object {
object := obj.(*batch.ScheduledJob)
object := obj.(*batch.CronJob)
object.Spec.Schedule = "* * *"
return object
},
@ -123,7 +123,7 @@ func TestDelete(t *testing.T) {
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
test.TestDelete(validNewScheduledJob())
test.TestDelete(validNewCronJob())
}
func TestGet(t *testing.T) {
@ -136,7 +136,7 @@ func TestGet(t *testing.T) {
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
test.TestGet(validNewScheduledJob())
test.TestGet(validNewCronJob())
}
func TestList(t *testing.T) {
@ -149,7 +149,7 @@ func TestList(t *testing.T) {
defer server.Terminate(t)
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
test.TestList(validNewScheduledJob())
test.TestList(validNewCronJob())
}
func TestWatch(t *testing.T) {
@ -163,7 +163,7 @@ func TestWatch(t *testing.T) {
defer storage.Store.DestroyFunc()
test := registrytest.New(t, storage.Store)
test.TestWatch(
validNewScheduledJob(),
validNewCronJob(),
// matching labels
[]labels.Set{},
// not matching labels

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package scheduledjob
package cronjob
import (
"fmt"
@ -36,7 +36,7 @@ type scheduledJobStrategy struct {
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}
// NamespaceScoped returns true because all scheduled jobs need to be within a namespace.
@ -46,21 +46,21 @@ func (scheduledJobStrategy) NamespaceScoped() bool {
// PrepareForCreate clears the status of a scheduled job before creation.
func (scheduledJobStrategy) PrepareForCreate(ctx api.Context, obj runtime.Object) {
scheduledJob := obj.(*batch.ScheduledJob)
scheduledJob.Status = batch.ScheduledJobStatus{}
scheduledJob := obj.(*batch.CronJob)
scheduledJob.Status = batch.CronJobStatus{}
}
// 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) {
newScheduledJob := obj.(*batch.ScheduledJob)
oldScheduledJob := old.(*batch.ScheduledJob)
newScheduledJob.Status = oldScheduledJob.Status
newCronJob := obj.(*batch.CronJob)
oldCronJob := old.(*batch.CronJob)
newCronJob.Status = oldCronJob.Status
}
// Validate validates a new scheduled job.
func (scheduledJobStrategy) Validate(ctx api.Context, obj runtime.Object) field.ErrorList {
scheduledJob := obj.(*batch.ScheduledJob)
return validation.ValidateScheduledJob(scheduledJob)
scheduledJob := obj.(*batch.CronJob)
return validation.ValidateCronJob(scheduledJob)
}
// Canonicalize normalizes the object after validation.
@ -78,7 +78,7 @@ func (scheduledJobStrategy) AllowCreateOnUpdate() bool {
// ValidateUpdate is the default update validation for an end user.
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 {
@ -88,8 +88,8 @@ type scheduledJobStatusStrategy struct {
var StatusStrategy = scheduledJobStatusStrategy{Strategy}
func (scheduledJobStatusStrategy) PrepareForUpdate(ctx api.Context, obj, old runtime.Object) {
newJob := obj.(*batch.ScheduledJob)
oldJob := old.(*batch.ScheduledJob)
newJob := obj.(*batch.CronJob)
oldJob := old.(*batch.CronJob)
newJob.Spec = oldJob.Spec
}
@ -97,24 +97,24 @@ func (scheduledJobStatusStrategy) ValidateUpdate(ctx api.Context, obj, old runti
return field.ErrorList{}
}
// ScheduledJobToSelectableFields returns a field set that represents the object for matching purposes.
func ScheduledJobToSelectableFields(scheduledJob *batch.ScheduledJob) fields.Set {
// CronJobToSelectableFields returns a field set that represents the object for matching purposes.
func CronJobToSelectableFields(scheduledJob *batch.CronJob) fields.Set {
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
// 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{
Label: label,
Field: field,
GetAttrs: func(obj runtime.Object) (labels.Set, fields.Set, error) {
scheduledJob, ok := obj.(*batch.ScheduledJob)
scheduledJob, ok := obj.(*batch.CronJob)
if !ok {
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
},
}
}

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package scheduledjob
package cronjob
import (
"testing"
@ -31,13 +31,13 @@ func newBool(a bool) *bool {
return r
}
func TestScheduledJobStrategy(t *testing.T) {
func TestCronJobStrategy(t *testing.T) {
ctx := api.NewDefaultContext()
if !Strategy.NamespaceScoped() {
t.Errorf("ScheduledJob must be namespace scoped")
t.Errorf("CronJob must be namespace scoped")
}
if Strategy.AllowCreateOnUpdate() {
t.Errorf("ScheduledJob should not allow create on update")
t.Errorf("CronJob should not allow create on update")
}
validPodTemplateSpec := api.PodTemplateSpec{
@ -47,12 +47,12 @@ func TestScheduledJobStrategy(t *testing.T) {
Containers: []api.Container{{Name: "abc", Image: "image", ImagePullPolicy: "IfNotPresent"}},
},
}
scheduledJob := &batch.ScheduledJob{
scheduledJob := &batch.CronJob{
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "* * * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -65,41 +65,41 @@ func TestScheduledJobStrategy(t *testing.T) {
Strategy.PrepareForCreate(ctx, scheduledJob)
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)
if len(errs) != 0 {
t.Errorf("Unexpected error validating %v", errs)
}
now := unversioned.Now()
updatedScheduledJob := &batch.ScheduledJob{
updatedCronJob := &batch.CronJob{
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "4"},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "5 5 5 * ?",
},
Status: batch.ScheduledJobStatus{
Status: batch.CronJobStatus{
LastScheduleTime: &now,
},
}
// ensure we do not change status
Strategy.PrepareForUpdate(ctx, updatedScheduledJob, scheduledJob)
if updatedScheduledJob.Status.Active != nil {
Strategy.PrepareForUpdate(ctx, updatedCronJob, scheduledJob)
if updatedCronJob.Status.Active != nil {
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 {
t.Errorf("Expected a validation error")
}
}
func TestScheduledJobStatusStrategy(t *testing.T) {
func TestCronJobStatusStrategy(t *testing.T) {
ctx := api.NewDefaultContext()
if !StatusStrategy.NamespaceScoped() {
t.Errorf("ScheduledJob must be namespace scoped")
t.Errorf("CronJob must be namespace scoped")
}
if StatusStrategy.AllowCreateOnUpdate() {
t.Errorf("ScheduledJob should not allow create on update")
t.Errorf("CronJob should not allow create on update")
}
validPodTemplateSpec := api.PodTemplateSpec{
Spec: api.PodSpec{
@ -109,13 +109,13 @@ func TestScheduledJobStatusStrategy(t *testing.T) {
},
}
oldSchedule := "* * * * ?"
oldScheduledJob := &batch.ScheduledJob{
oldCronJob := &batch.CronJob{
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
ResourceVersion: "10",
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: oldSchedule,
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -126,13 +126,13 @@ func TestScheduledJobStatusStrategy(t *testing.T) {
},
}
now := unversioned.Now()
newScheduledJob := &batch.ScheduledJob{
newCronJob := &batch.CronJob{
ObjectMeta: api.ObjectMeta{
Name: "myscheduledjob",
Name: "mycronjob",
Namespace: api.NamespaceDefault,
ResourceVersion: "9",
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: "5 5 * * ?",
ConcurrencyPolicy: batch.AllowConcurrent,
JobTemplate: batch.JobTemplateSpec{
@ -141,23 +141,23 @@ func TestScheduledJobStatusStrategy(t *testing.T) {
},
},
},
Status: batch.ScheduledJobStatus{
Status: batch.CronJobStatus{
LastScheduleTime: &now,
},
}
StatusStrategy.PrepareForUpdate(ctx, newScheduledJob, oldScheduledJob)
if newScheduledJob.Status.LastScheduleTime == nil {
t.Errorf("ScheduledJob status updates must allow changes to scheduledJob status")
StatusStrategy.PrepareForUpdate(ctx, newCronJob, oldCronJob)
if newCronJob.Status.LastScheduleTime == nil {
t.Errorf("CronJob status updates must allow changes to scheduledJob status")
}
if newScheduledJob.Spec.Schedule != oldSchedule {
t.Errorf("ScheduledJob status updates must now allow changes to scheduledJob spec")
if newCronJob.Spec.Schedule != oldSchedule {
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 {
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")
}
}
@ -166,8 +166,8 @@ func TestScheduledJobStatusStrategy(t *testing.T) {
func TestSelectableFieldLabelConversions(t *testing.T) {
apitesting.TestSelectableFieldLabelConversionsOfKind(t,
"batch/v2alpha1",
"ScheduledJob",
ScheduledJobToSelectableFields(&batch.ScheduledJob{}),
"CronJob",
CronJobToSelectableFields(&batch.CronJob{}),
nil,
)
}

View File

@ -16,11 +16,12 @@ go_library(
tags = ["automanaged"],
deps = [
"//pkg/api/rest:go_default_library",
"//pkg/api/unversioned:go_default_library",
"//pkg/apis/batch:go_default_library",
"//pkg/apis/batch/v1:go_default_library",
"//pkg/apis/batch/v2alpha1: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/scheduledjob/etcd:go_default_library",
],
)

View File

@ -22,8 +22,8 @@ import (
batchapiv1 "k8s.io/kubernetes/pkg/apis/batch/v1"
batchapiv2alpha1 "k8s.io/kubernetes/pkg/apis/batch/v2alpha1"
"k8s.io/kubernetes/pkg/genericapiserver"
cronjobetcd "k8s.io/kubernetes/pkg/registry/batch/cronjob/etcd"
jobetcd "k8s.io/kubernetes/pkg/registry/batch/job/etcd"
scheduledjobetcd "k8s.io/kubernetes/pkg/registry/batch/scheduledjob/etcd"
)
type RESTStorageProvider struct{}
@ -66,10 +66,10 @@ func (p RESTStorageProvider) v2alpha1Storage(apiResourceConfigSource genericapis
storage["jobs"] = jobsStorage
storage["jobs/status"] = jobsStatusStorage
}
if apiResourceConfigSource.ResourceEnabled(version.WithResource("scheduledjobs")) {
scheduledJobsStorage, scheduledJobsStatusStorage := scheduledjobetcd.NewREST(restOptionsGetter(batch.Resource("scheduledjobs")))
storage["scheduledjobs"] = scheduledJobsStorage
storage["scheduledjobs/status"] = scheduledJobsStatusStorage
if apiResourceConfigSource.ResourceEnabled(version.WithResource("cronjobs")) {
cronJobsStorage, cronJobsStatusStorage := cronjobetcd.NewREST(restOptionsGetter(batch.Resource("cronjobs")))
storage["cronjobs"] = cronJobsStorage
storage["cronjobs/status"] = cronJobsStatusStorage
}
return storage
}

View File

@ -52,7 +52,7 @@ const (
PodTemplates Resource = "podtemplates"
Replicasets Resource = "replicasets"
ResourceQuotas Resource = "resourcequotas"
ScheduledJobs Resource = "scheduledjobs"
CronJobs Resource = "cronjobs"
Roles Resource = "roles"
RoleBindings Resource = "rolebindings"
Secrets Resource = "secrets"

View File

@ -86,7 +86,7 @@ func ClusterRoles() []rbac.ClusterRole {
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",
"replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(),
@ -116,7 +116,7 @@ func ClusterRoles() []rbac.ClusterRole {
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",
"replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(),
@ -139,7 +139,7 @@ func ClusterRoles() []rbac.ClusterRole {
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",
"replicationcontrollers/scale", "replicasets", "replicasets/scale", "deployments", "deployments/scale").RuleOrDie(),

View File

@ -22,6 +22,7 @@ go_library(
"cluster_logging_utils.go",
"cluster_size_autoscaling.go",
"cluster_upgrade.go",
"cronjob.go",
"daemon_restart.go",
"daemon_set.go",
"dashboard.go",
@ -91,7 +92,6 @@ go_library(
"resize_nodes.go",
"resource_quota.go",
"restart.go",
"scheduledjob.go",
"scheduler_predicates.go",
"security_context.go",
"service.go",

View File

@ -33,31 +33,31 @@ import (
)
const (
// How long to wait for a scheduledjob
scheduledJobTimeout = 5 * time.Minute
// How long to wait for a cronjob
cronJobTimeout = 5 * time.Minute
)
var (
ScheduledJobGroupVersionResource = unversioned.GroupVersionResource{Group: batch.GroupName, Version: "v2alpha1", Resource: "scheduledjobs"}
BatchV2Alpha1GroupVersion = unversioned.GroupVersion{Group: batch.GroupName, Version: "v2alpha1"}
CronJobGroupVersionResource = unversioned.GroupVersionResource{Group: batch.GroupName, Version: "v2alpha1", Resource: "cronjobs"}
BatchV2Alpha1GroupVersion = unversioned.GroupVersion{Group: batch.GroupName, Version: "v2alpha1"}
)
var _ = framework.KubeDescribe("ScheduledJob", func() {
f := framework.NewDefaultGroupVersionFramework("scheduledjob", BatchV2Alpha1GroupVersion)
var _ = framework.KubeDescribe("CronJob", func() {
f := framework.NewDefaultGroupVersionFramework("cronjob", BatchV2Alpha1GroupVersion)
BeforeEach(func() {
framework.SkipIfMissingResource(f.ClientPool, ScheduledJobGroupVersionResource, f.Namespace.Name)
framework.SkipIfMissingResource(f.ClientPool, CronJobGroupVersionResource, f.Namespace.Name)
})
// multiple jobs running at once
It("should schedule multiple jobs concurrently", func() {
By("Creating a scheduledjob")
scheduledJob := newTestScheduledJob("concurrent", "*/1 * * * ?", batch.AllowConcurrent, true)
scheduledJob, err := createScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob)
By("Creating a cronjob")
cronJob := newTestCronJob("concurrent", "*/1 * * * ?", batch.AllowConcurrent, true)
cronJob, err := createCronJob(f.ClientSet, f.Namespace.Name, cronJob)
Expect(err).NotTo(HaveOccurred())
By("Ensuring more than one job is running at a time")
err = waitForActiveJobs(f.ClientSet, f.Namespace.Name, scheduledJob.Name, 2)
err = waitForActiveJobs(f.ClientSet, f.Namespace.Name, cronJob.Name, 2)
Expect(err).NotTo(HaveOccurred())
By("Ensuring at least two running jobs exists by listing jobs explicitly")
@ -66,21 +66,21 @@ var _ = framework.KubeDescribe("ScheduledJob", func() {
activeJobs := filterActiveJobs(jobs)
Expect(len(activeJobs) >= 2).To(BeTrue())
By("Removing scheduledjob")
err = deleteScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob.Name)
By("Removing cronjob")
err = deleteCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name)
Expect(err).NotTo(HaveOccurred())
})
// suspended should not schedule jobs
It("should not schedule jobs when suspended [Slow]", func() {
By("Creating a suspended scheduledjob")
scheduledJob := newTestScheduledJob("suspended", "*/1 * * * ?", batch.AllowConcurrent, true)
scheduledJob.Spec.Suspend = newBool(true)
scheduledJob, err := createScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob)
By("Creating a suspended cronjob")
cronJob := newTestCronJob("suspended", "*/1 * * * ?", batch.AllowConcurrent, true)
cronJob.Spec.Suspend = newBool(true)
cronJob, err := createCronJob(f.ClientSet, f.Namespace.Name, cronJob)
Expect(err).NotTo(HaveOccurred())
By("Ensuring no jobs are scheduled")
err = waitForNoJobs(f.ClientSet, f.Namespace.Name, scheduledJob.Name)
err = waitForNoJobs(f.ClientSet, f.Namespace.Name, cronJob.Name)
Expect(err).To(HaveOccurred())
By("Ensuring no job exists by listing jobs explicitly")
@ -88,26 +88,26 @@ var _ = framework.KubeDescribe("ScheduledJob", func() {
Expect(err).NotTo(HaveOccurred())
Expect(jobs.Items).To(HaveLen(0))
By("Removing scheduledjob")
err = deleteScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob.Name)
By("Removing cronjob")
err = deleteCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name)
Expect(err).NotTo(HaveOccurred())
})
// only single active job is allowed for ForbidConcurrent
It("should not schedule new jobs when ForbidConcurrent [Slow]", func() {
By("Creating a ForbidConcurrent scheduledjob")
scheduledJob := newTestScheduledJob("forbid", "*/1 * * * ?", batch.ForbidConcurrent, true)
scheduledJob, err := createScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob)
By("Creating a ForbidConcurrent cronjob")
cronJob := newTestCronJob("forbid", "*/1 * * * ?", batch.ForbidConcurrent, true)
cronJob, err := createCronJob(f.ClientSet, f.Namespace.Name, cronJob)
Expect(err).NotTo(HaveOccurred())
By("Ensuring a job is scheduled")
err = waitForActiveJobs(f.ClientSet, f.Namespace.Name, scheduledJob.Name, 1)
err = waitForActiveJobs(f.ClientSet, f.Namespace.Name, cronJob.Name, 1)
Expect(err).NotTo(HaveOccurred())
By("Ensuring exactly one is scheduled")
scheduledJob, err = getScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob.Name)
cronJob, err = getCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name)
Expect(err).NotTo(HaveOccurred())
Expect(scheduledJob.Status.Active).Should(HaveLen(1))
Expect(cronJob.Status.Active).Should(HaveLen(1))
By("Ensuring exaclty one running job exists by listing jobs explicitly")
jobs, err := f.ClientSet.Batch().Jobs(f.Namespace.Name).List(api.ListOptions{})
@ -116,29 +116,29 @@ var _ = framework.KubeDescribe("ScheduledJob", func() {
Expect(activeJobs).To(HaveLen(1))
By("Ensuring no more jobs are scheduled")
err = waitForActiveJobs(f.ClientSet, f.Namespace.Name, scheduledJob.Name, 2)
err = waitForActiveJobs(f.ClientSet, f.Namespace.Name, cronJob.Name, 2)
Expect(err).To(HaveOccurred())
By("Removing scheduledjob")
err = deleteScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob.Name)
By("Removing cronjob")
err = deleteCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name)
Expect(err).NotTo(HaveOccurred())
})
// only single active job is allowed for ReplaceConcurrent
It("should replace jobs when ReplaceConcurrent", func() {
By("Creating a ReplaceConcurrent scheduledjob")
scheduledJob := newTestScheduledJob("replace", "*/1 * * * ?", batch.ReplaceConcurrent, true)
scheduledJob, err := createScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob)
By("Creating a ReplaceConcurrent cronjob")
cronJob := newTestCronJob("replace", "*/1 * * * ?", batch.ReplaceConcurrent, true)
cronJob, err := createCronJob(f.ClientSet, f.Namespace.Name, cronJob)
Expect(err).NotTo(HaveOccurred())
By("Ensuring a job is scheduled")
err = waitForActiveJobs(f.ClientSet, f.Namespace.Name, scheduledJob.Name, 1)
err = waitForActiveJobs(f.ClientSet, f.Namespace.Name, cronJob.Name, 1)
Expect(err).NotTo(HaveOccurred())
By("Ensuring exactly one is scheduled")
scheduledJob, err = getScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob.Name)
cronJob, err = getCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name)
Expect(err).NotTo(HaveOccurred())
Expect(scheduledJob.Status.Active).Should(HaveLen(1))
Expect(cronJob.Status.Active).Should(HaveLen(1))
By("Ensuring exaclty one running job exists by listing jobs explicitly")
jobs, err := f.ClientSet.Batch().Jobs(f.Namespace.Name).List(api.ListOptions{})
@ -150,16 +150,16 @@ var _ = framework.KubeDescribe("ScheduledJob", func() {
err = waitForJobReplaced(f.ClientSet, f.Namespace.Name, jobs.Items[0].Name)
Expect(err).NotTo(HaveOccurred())
By("Removing scheduledjob")
err = deleteScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob.Name)
By("Removing cronjob")
err = deleteCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name)
Expect(err).NotTo(HaveOccurred())
})
// shouldn't give us unexpected warnings
It("should not emit unexpected warnings", func() {
By("Creating a scheduledjob")
scheduledJob := newTestScheduledJob("concurrent", "*/1 * * * ?", batch.AllowConcurrent, false)
scheduledJob, err := createScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob)
By("Creating a cronjob")
cronJob := newTestCronJob("concurrent", "*/1 * * * ?", batch.AllowConcurrent, false)
cronJob, err := createCronJob(f.ClientSet, f.Namespace.Name, cronJob)
Expect(err).NotTo(HaveOccurred())
By("Ensuring at least two jobs and at least one finished job exists by listing jobs explicitly")
@ -169,24 +169,24 @@ var _ = framework.KubeDescribe("ScheduledJob", func() {
Expect(err).NotTo(HaveOccurred())
By("Ensuring no unexpected event has happened")
err = checkNoUnexpectedEvents(f.ClientSet, f.Namespace.Name, scheduledJob.Name)
err = checkNoUnexpectedEvents(f.ClientSet, f.Namespace.Name, cronJob.Name)
Expect(err).NotTo(HaveOccurred())
By("Removing scheduledjob")
err = deleteScheduledJob(f.ClientSet, f.Namespace.Name, scheduledJob.Name)
By("Removing cronjob")
err = deleteCronJob(f.ClientSet, f.Namespace.Name, cronJob.Name)
Expect(err).NotTo(HaveOccurred())
})
})
// newTestScheduledJob returns a scheduledjob which does one of several testing behaviors.
func newTestScheduledJob(name, schedule string, concurrencyPolicy batch.ConcurrencyPolicy, sleep bool) *batch.ScheduledJob {
// newTestCronJob returns a cronjob which does one of several testing behaviors.
func newTestCronJob(name, schedule string, concurrencyPolicy batch.ConcurrencyPolicy, sleep bool) *batch.CronJob {
parallelism := int32(1)
completions := int32(1)
sj := &batch.ScheduledJob{
sj := &batch.CronJob{
ObjectMeta: api.ObjectMeta{
Name: name,
},
Spec: batch.ScheduledJobSpec{
Spec: batch.CronJobSpec{
Schedule: schedule,
ConcurrencyPolicy: concurrencyPolicy,
JobTemplate: batch.JobTemplateSpec{
@ -228,22 +228,22 @@ func newTestScheduledJob(name, schedule string, concurrencyPolicy batch.Concurre
return sj
}
func createScheduledJob(c clientset.Interface, ns string, scheduledJob *batch.ScheduledJob) (*batch.ScheduledJob, error) {
return c.Batch().ScheduledJobs(ns).Create(scheduledJob)
func createCronJob(c clientset.Interface, ns string, cronJob *batch.CronJob) (*batch.CronJob, error) {
return c.Batch().CronJobs(ns).Create(cronJob)
}
func getScheduledJob(c clientset.Interface, ns, name string) (*batch.ScheduledJob, error) {
return c.Batch().ScheduledJobs(ns).Get(name)
func getCronJob(c clientset.Interface, ns, name string) (*batch.CronJob, error) {
return c.Batch().CronJobs(ns).Get(name)
}
func deleteScheduledJob(c clientset.Interface, ns, name string) error {
return c.Batch().ScheduledJobs(ns).Delete(name, nil)
func deleteCronJob(c clientset.Interface, ns, name string) error {
return c.Batch().CronJobs(ns).Delete(name, nil)
}
// Wait for at least given amount of active jobs.
func waitForActiveJobs(c clientset.Interface, ns, scheduledJobName string, active int) error {
return wait.Poll(framework.Poll, scheduledJobTimeout, func() (bool, error) {
curr, err := c.Batch().ScheduledJobs(ns).Get(scheduledJobName)
func waitForActiveJobs(c clientset.Interface, ns, cronJobName string, active int) error {
return wait.Poll(framework.Poll, cronJobTimeout, func() (bool, error) {
curr, err := c.Batch().CronJobs(ns).Get(cronJobName)
if err != nil {
return false, err
}
@ -253,8 +253,8 @@ func waitForActiveJobs(c clientset.Interface, ns, scheduledJobName string, activ
// Wait for no jobs to appear.
func waitForNoJobs(c clientset.Interface, ns, jobName string) error {
return wait.Poll(framework.Poll, scheduledJobTimeout, func() (bool, error) {
curr, err := c.Batch().ScheduledJobs(ns).Get(jobName)
return wait.Poll(framework.Poll, cronJobTimeout, func() (bool, error) {
curr, err := c.Batch().CronJobs(ns).Get(jobName)
if err != nil {
return false, err
}
@ -265,7 +265,7 @@ func waitForNoJobs(c clientset.Interface, ns, jobName string) error {
// Wait for a job to be replaced with a new one.
func waitForJobReplaced(c clientset.Interface, ns, previousJobName string) error {
return wait.Poll(framework.Poll, scheduledJobTimeout, func() (bool, error) {
return wait.Poll(framework.Poll, cronJobTimeout, func() (bool, error) {
jobs, err := c.Batch().Jobs(ns).List(api.ListOptions{})
if err != nil {
return false, err
@ -282,7 +282,7 @@ func waitForJobReplaced(c clientset.Interface, ns, previousJobName string) error
// waitForJobsAtLeast waits for at least a number of jobs to appear.
func waitForJobsAtLeast(c clientset.Interface, ns string, atLeast int) error {
return wait.Poll(framework.Poll, scheduledJobTimeout, func() (bool, error) {
return wait.Poll(framework.Poll, cronJobTimeout, func() (bool, error) {
jobs, err := c.Batch().Jobs(ns).List(api.ListOptions{})
if err != nil {
return false, err
@ -293,7 +293,7 @@ func waitForJobsAtLeast(c clientset.Interface, ns string, atLeast int) error {
// waitForAnyFinishedJob waits for any completed job to appear.
func waitForAnyFinishedJob(c clientset.Interface, ns string) error {
return wait.Poll(framework.Poll, scheduledJobTimeout, func() (bool, error) {
return wait.Poll(framework.Poll, cronJobTimeout, func() (bool, error) {
jobs, err := c.Batch().Jobs(ns).List(api.ListOptions{})
if err != nil {
return false, err
@ -309,10 +309,10 @@ func waitForAnyFinishedJob(c clientset.Interface, ns string) error {
// checkNoUnexpectedEvents checks unexpected events didn't happen.
// Currently only "UnexpectedJob" is checked.
func checkNoUnexpectedEvents(c clientset.Interface, ns, scheduledJobName string) error {
sj, err := c.Batch().ScheduledJobs(ns).Get(scheduledJobName)
func checkNoUnexpectedEvents(c clientset.Interface, ns, cronJobName string) error {
sj, err := c.Batch().CronJobs(ns).Get(cronJobName)
if err != nil {
return fmt.Errorf("error in getting scheduledjob %s/%s: %v", ns, scheduledJobName, err)
return fmt.Errorf("error in getting cronjob %s/%s: %v", ns, cronJobName, err)
}
events, err := c.Core().Events(ns).Search(sj)
if err != nil {

View File

@ -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)
completions := int32(1)
return &v2alpha1.ScheduledJob{
return &v2alpha1.CronJob{
ObjectMeta: v1.ObjectMeta{
Name: name,
Labels: map[string]string{
"time": value,
},
},
Spec: v2alpha1.ScheduledJobSpec{
Spec: v2alpha1.CronJobSpec{
Schedule: "*/1 * * * ?",
ConcurrencyPolicy: v2alpha1.AllowConcurrent,
JobTemplate: v2alpha1.JobTemplateSpec{
@ -238,7 +238,7 @@ func newTestingScheduledJob(name string, value string) *v2alpha1.ScheduledJob {
var _ = framework.KubeDescribe("Generated release_1_5 clientset", func() {
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
groupList, err := f.ClientSet_1_5.Discovery().ServerGroups()
ExpectNoError(err)
@ -256,59 +256,59 @@ var _ = framework.KubeDescribe("Generated release_1_5 clientset", func() {
framework.Logf("%s is not enabled, test skipped", v2alpha1.SchemeGroupVersion)
return
}
scheduleJobClient := f.ClientSet_1_5.BatchV2alpha1().ScheduledJobs(f.Namespace.Name)
By("constructing the scheduledJob")
name := "scheduledjob" + string(uuid.NewUUID())
cronJobClient := f.ClientSet_1_5.BatchV2alpha1().CronJobs(f.Namespace.Name)
By("constructing the cronJob")
name := "cronjob" + string(uuid.NewUUID())
value := strconv.Itoa(time.Now().Nanosecond())
scheduledJob := newTestingScheduledJob(name, value)
cronJob := newTestingCronJob(name, value)
By("setting up watch")
selector := labels.SelectorFromSet(labels.Set(map[string]string{"time": value})).String()
options := v1.ListOptions{LabelSelector: selector}
scheduleJobs, err := scheduleJobClient.List(options)
cronJobs, err := cronJobClient.List(options)
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{
LabelSelector: selector,
ResourceVersion: scheduleJobs.ListMeta.ResourceVersion,
ResourceVersion: cronJobs.ListMeta.ResourceVersion,
}
w, err := scheduleJobClient.Watch(options)
w, err := cronJobClient.Watch(options)
if err != nil {
framework.Failf("Failed to set up watch: %v", err)
}
By("creating the scheduledJob")
scheduledJob, err = scheduleJobClient.Create(scheduledJob)
By("creating the cronJob")
cronJob, err = cronJobClient.Create(cronJob)
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{
LabelSelector: selector,
ResourceVersion: scheduledJob.ResourceVersion,
ResourceVersion: cronJob.ResourceVersion,
}
scheduleJobs, err = scheduleJobClient.List(options)
cronJobs, err = cronJobClient.List(options)
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)
By("deleting the scheduledJob")
if err := scheduleJobClient.Delete(scheduledJob.Name, nil); err != nil {
framework.Failf("Failed to delete scheduledJob: %v", err)
By("deleting the cronJob")
if err := cronJobClient.Delete(cronJob.Name, nil); err != nil {
framework.Failf("Failed to delete cronJob: %v", err)
}
options = v1.ListOptions{LabelSelector: selector}
scheduleJobs, err = scheduleJobClient.List(options)
cronJobs, err = cronJobClient.List(options)
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))
})
})

View File

@ -183,39 +183,39 @@ var _ = framework.KubeDescribe("Kubectl alpha client", func() {
// 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 sjName string
var cjName string
BeforeEach(func() {
nsFlag = fmt.Sprintf("--namespace=%v", ns)
sjName = "e2e-test-echo-scheduledjob"
cjName = "e2e-test-echo-cronjob"
})
AfterEach(func() {
framework.RunKubectlOrDie("delete", "scheduledjobs", sjName, nsFlag)
framework.RunKubectlOrDie("delete", "cronjobs", cjName, nsFlag)
})
It("should create a ScheduledJob", func() {
framework.SkipIfMissingResource(f.ClientPool, ScheduledJobGroupVersionResource, f.Namespace.Name)
It("should create a CronJob", func() {
framework.SkipIfMissingResource(f.ClientPool, CronJobGroupVersionResource, f.Namespace.Name)
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)
By("verifying the ScheduledJob " + sjName + " was created")
sj, err := c.Batch().ScheduledJobs(ns).Get(sjName)
By("verifying the CronJob " + cjName + " was created")
sj, err := c.Batch().CronJobs(ns).Get(cjName)
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 {
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
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 {
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")
}
})
})

View File

@ -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/resourcequota,ghodss,1
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/serviceaccount,liggitt,0
k8s.io/kubernetes/pkg/controller/volume/attachdetach,luxas,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/batch/job,kargakis,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/scheduledjob/etcd,mtaufen,1
k8s.io/kubernetes/pkg/registry/batch/cronjob,nikhiljindal,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/core/componentstatus,krousey,1
k8s.io/kubernetes/pkg/registry/core/configmap,janetkuo,1

1 name owner auto-assigned
586 k8s.io/kubernetes/pkg/controller/replication fgrzadkowski 0
587 k8s.io/kubernetes/pkg/controller/resourcequota ghodss 1
588 k8s.io/kubernetes/pkg/controller/route gmarek 0
589 k8s.io/kubernetes/pkg/controller/scheduledjob k8s.io/kubernetes/pkg/controller/cronjob soltysh 1
590 k8s.io/kubernetes/pkg/controller/service asalkeld 0
591 k8s.io/kubernetes/pkg/controller/serviceaccount liggitt 0
592 k8s.io/kubernetes/pkg/controller/volume/attachdetach luxas 1
674 k8s.io/kubernetes/pkg/registry/autoscaling/horizontalpodautoscaler/etcd justinsb 1
675 k8s.io/kubernetes/pkg/registry/batch/job kargakis 1
676 k8s.io/kubernetes/pkg/registry/batch/job/etcd Q-Lee 1
677 k8s.io/kubernetes/pkg/registry/batch/scheduledjob k8s.io/kubernetes/pkg/registry/batch/cronjob nikhiljindal 1
678 k8s.io/kubernetes/pkg/registry/batch/scheduledjob/etcd k8s.io/kubernetes/pkg/registry/batch/cronjob/etcd mtaufen 1
679 k8s.io/kubernetes/pkg/registry/certificates/certificates smarterclayton 1
680 k8s.io/kubernetes/pkg/registry/core/componentstatus krousey 1
681 k8s.io/kubernetes/pkg/registry/core/configmap janetkuo 1