From 70b8df6742848f819592a96bcc2638c794c9167b Mon Sep 17 00:00:00 2001 From: Maciej Szulik Date: Tue, 7 Mar 2017 11:17:04 +0100 Subject: [PATCH 1/3] Add default information to CronJobSpec --- pkg/apis/batch/types.go | 1 + pkg/apis/batch/v2alpha1/defaults_test.go | 2 +- pkg/apis/batch/v2alpha1/types.go | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/apis/batch/types.go b/pkg/apis/batch/types.go index 2113dca18a6..d26ecf8e7a4 100644 --- a/pkg/apis/batch/types.go +++ b/pkg/apis/batch/types.go @@ -233,6 +233,7 @@ type CronJobSpec struct { StartingDeadlineSeconds *int64 // ConcurrencyPolicy specifies how to treat concurrent executions of a Job. + // Defaults to Allow. // +optional ConcurrencyPolicy ConcurrencyPolicy diff --git a/pkg/apis/batch/v2alpha1/defaults_test.go b/pkg/apis/batch/v2alpha1/defaults_test.go index c300a72f146..1dda456d435 100644 --- a/pkg/apis/batch/v2alpha1/defaults_test.go +++ b/pkg/apis/batch/v2alpha1/defaults_test.go @@ -41,7 +41,7 @@ func TestSetDefaultCronJob(t *testing.T) { }, }, }, - "nothing should be defaulted": { + "set fields should not be defaulted": { original: &CronJob{ Spec: CronJobSpec{ ConcurrencyPolicy: ForbidConcurrent, diff --git a/pkg/apis/batch/v2alpha1/types.go b/pkg/apis/batch/v2alpha1/types.go index 3c1fdf22a3b..e22e32f2232 100644 --- a/pkg/apis/batch/v2alpha1/types.go +++ b/pkg/apis/batch/v2alpha1/types.go @@ -94,6 +94,7 @@ type CronJobSpec struct { StartingDeadlineSeconds *int64 `json:"startingDeadlineSeconds,omitempty" protobuf:"varint,2,opt,name=startingDeadlineSeconds"` // ConcurrencyPolicy specifies how to treat concurrent executions of a Job. + // Defaults to Allow. // +optional ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty" protobuf:"bytes,3,opt,name=concurrencyPolicy,casttype=ConcurrencyPolicy"` From 6e9658ab5557c87b3d0da0f8f9a6617014e62c8a Mon Sep 17 00:00:00 2001 From: Maciej Szulik Date: Tue, 7 Mar 2017 11:30:05 +0100 Subject: [PATCH 2/3] Generated changes for defaults updates --- api/openapi-spec/swagger.json | 2 +- api/swagger-spec/batch_v2alpha1.json | 2 +- docs/api-reference/batch/v2alpha1/definitions.html | 4 ++-- pkg/apis/batch/v2alpha1/generated.proto | 1 + pkg/apis/batch/v2alpha1/types_swagger_doc_generated.go | 2 +- pkg/generated/openapi/zz_generated.openapi.go | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index ddc33b0824c..eb0525fa938 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -43326,7 +43326,7 @@ ], "properties": { "concurrencyPolicy": { - "description": "ConcurrencyPolicy specifies how to treat concurrent executions of a Job.", + "description": "ConcurrencyPolicy specifies how to treat concurrent executions of a Job. Defaults to Allow.", "type": "string" }, "failedJobsHistoryLimit": { diff --git a/api/swagger-spec/batch_v2alpha1.json b/api/swagger-spec/batch_v2alpha1.json index 5c0ef198b94..22b693c4bd5 100644 --- a/api/swagger-spec/batch_v2alpha1.json +++ b/api/swagger-spec/batch_v2alpha1.json @@ -2186,7 +2186,7 @@ }, "concurrencyPolicy": { "type": "string", - "description": "ConcurrencyPolicy specifies how to treat concurrent executions of a Job." + "description": "ConcurrencyPolicy specifies how to treat concurrent executions of a Job. Defaults to Allow." }, "suspend": { "type": "boolean", diff --git a/docs/api-reference/batch/v2alpha1/definitions.html b/docs/api-reference/batch/v2alpha1/definitions.html index 3a9a2d59ce8..525eeb8bd30 100755 --- a/docs/api-reference/batch/v2alpha1/definitions.html +++ b/docs/api-reference/batch/v2alpha1/definitions.html @@ -3720,7 +3720,7 @@ Populated by the system when a graceful deletion is requested. Read-only. More i

concurrencyPolicy

-

ConcurrencyPolicy specifies how to treat concurrent executions of a Job.

+

ConcurrencyPolicy specifies how to treat concurrent executions of a Job. Defaults to Allow.

false

string

@@ -5629,7 +5629,7 @@ Examples:
diff --git a/pkg/apis/batch/v2alpha1/generated.proto b/pkg/apis/batch/v2alpha1/generated.proto index 4f51d6161ac..605dafe3875 100644 --- a/pkg/apis/batch/v2alpha1/generated.proto +++ b/pkg/apis/batch/v2alpha1/generated.proto @@ -72,6 +72,7 @@ message CronJobSpec { optional int64 startingDeadlineSeconds = 2; // ConcurrencyPolicy specifies how to treat concurrent executions of a Job. + // Defaults to Allow. // +optional optional string concurrencyPolicy = 3; diff --git a/pkg/apis/batch/v2alpha1/types_swagger_doc_generated.go b/pkg/apis/batch/v2alpha1/types_swagger_doc_generated.go index c0b53b8e029..dc4ff64c8e2 100644 --- a/pkg/apis/batch/v2alpha1/types_swagger_doc_generated.go +++ b/pkg/apis/batch/v2alpha1/types_swagger_doc_generated.go @@ -52,7 +52,7 @@ 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.", + "concurrencyPolicy": "ConcurrencyPolicy specifies how to treat concurrent executions of a Job. Defaults to Allow.", "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 CronJob.", "successfulJobsHistoryLimit": "The number of successful finished jobs to retain. This is a pointer to distinguish between explicit zero and not specified.", diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index fa4624bbf68..c72088f58b1 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -12399,7 +12399,7 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope }, "concurrencyPolicy": { SchemaProps: spec.SchemaProps{ - Description: "ConcurrencyPolicy specifies how to treat concurrent executions of a Job.", + Description: "ConcurrencyPolicy specifies how to treat concurrent executions of a Job. Defaults to Allow.", Type: []string{"string"}, Format: "", }, From ce013adfbba0df510e082e645daad971a069c9e5 Mon Sep 17 00:00:00 2001 From: Maciej Szulik Date: Tue, 7 Mar 2017 11:36:57 +0100 Subject: [PATCH 3/3] Staging client changes for defaults updates --- staging/src/k8s.io/client-go/pkg/apis/batch/types.go | 1 + .../k8s.io/client-go/pkg/apis/batch/v2alpha1/generated.proto | 1 + staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/types.go | 1 + .../pkg/apis/batch/v2alpha1/types_swagger_doc_generated.go | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/staging/src/k8s.io/client-go/pkg/apis/batch/types.go b/staging/src/k8s.io/client-go/pkg/apis/batch/types.go index 7a2ad011feb..f47ea67049b 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/batch/types.go +++ b/staging/src/k8s.io/client-go/pkg/apis/batch/types.go @@ -233,6 +233,7 @@ type CronJobSpec struct { StartingDeadlineSeconds *int64 // ConcurrencyPolicy specifies how to treat concurrent executions of a Job. + // Defaults to Allow. // +optional ConcurrencyPolicy ConcurrencyPolicy diff --git a/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/generated.proto b/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/generated.proto index 4f51d6161ac..605dafe3875 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/generated.proto +++ b/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/generated.proto @@ -72,6 +72,7 @@ message CronJobSpec { optional int64 startingDeadlineSeconds = 2; // ConcurrencyPolicy specifies how to treat concurrent executions of a Job. + // Defaults to Allow. // +optional optional string concurrencyPolicy = 3; diff --git a/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/types.go b/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/types.go index 67f1c95e40a..1dfd4eee080 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/types.go +++ b/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/types.go @@ -94,6 +94,7 @@ type CronJobSpec struct { StartingDeadlineSeconds *int64 `json:"startingDeadlineSeconds,omitempty" protobuf:"varint,2,opt,name=startingDeadlineSeconds"` // ConcurrencyPolicy specifies how to treat concurrent executions of a Job. + // Defaults to Allow. // +optional ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty" protobuf:"bytes,3,opt,name=concurrencyPolicy,casttype=ConcurrencyPolicy"` diff --git a/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/types_swagger_doc_generated.go b/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/types_swagger_doc_generated.go index c0b53b8e029..dc4ff64c8e2 100644 --- a/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/client-go/pkg/apis/batch/v2alpha1/types_swagger_doc_generated.go @@ -52,7 +52,7 @@ 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.", + "concurrencyPolicy": "ConcurrencyPolicy specifies how to treat concurrent executions of a Job. Defaults to Allow.", "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 CronJob.", "successfulJobsHistoryLimit": "The number of successful finished jobs to retain. This is a pointer to distinguish between explicit zero and not specified.",