mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-31 02:08:13 +00:00 
			
		
		
		
	Merge pull request #117138 from tosi3k/job-syncs
Add `--concurrent-job-syncs` flag to kube-controller-manager
This commit is contained in:
		| @@ -17,6 +17,8 @@ limitations under the License. | ||||
| package options | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
|  | ||||
| 	"github.com/spf13/pflag" | ||||
|  | ||||
| 	jobconfig "k8s.io/kubernetes/pkg/controller/job/config" | ||||
| @@ -32,6 +34,8 @@ func (o *JobControllerOptions) AddFlags(fs *pflag.FlagSet) { | ||||
| 	if o == nil { | ||||
| 		return | ||||
| 	} | ||||
|  | ||||
| 	fs.Int32Var(&o.ConcurrentJobSyncs, "concurrent-job-syncs", o.ConcurrentJobSyncs, "The number of job objects that are allowed to sync concurrently. Larger number = more responsive jobs, but more CPU (and network) load") | ||||
| } | ||||
|  | ||||
| // ApplyTo fills up JobController config with options. | ||||
| @@ -52,5 +56,8 @@ func (o *JobControllerOptions) Validate() []error { | ||||
| 	} | ||||
|  | ||||
| 	errs := []error{} | ||||
| 	if o.ConcurrentJobSyncs < 1 { | ||||
| 		errs = append(errs, fmt.Errorf("concurrent-job-syncs must be greater than 0, but got %d", o.ConcurrentJobSyncs)) | ||||
| 	} | ||||
| 	return errs | ||||
| } | ||||
|   | ||||
| @@ -94,6 +94,7 @@ var args = []string{ | ||||
| 	"--concurrent-service-endpoint-syncs=10", | ||||
| 	"--concurrent-gc-syncs=30", | ||||
| 	"--concurrent-namespace-syncs=20", | ||||
| 	"--concurrent-job-syncs=10", | ||||
| 	"--concurrent-replicaset-syncs=10", | ||||
| 	"--concurrent-resource-quota-syncs=10", | ||||
| 	"--concurrent-service-syncs=2", | ||||
| @@ -319,7 +320,7 @@ func TestAddFlags(t *testing.T) { | ||||
| 		}, | ||||
| 		JobController: &JobControllerOptions{ | ||||
| 			&jobconfig.JobControllerConfiguration{ | ||||
| 				ConcurrentJobSyncs: 5, | ||||
| 				ConcurrentJobSyncs: 10, | ||||
| 			}, | ||||
| 		}, | ||||
| 		CronJobController: &CronJobControllerOptions{ | ||||
| @@ -570,7 +571,7 @@ func TestApplyTo(t *testing.T) { | ||||
| 				HorizontalPodAutoscalerTolerance:                    0.1, | ||||
| 			}, | ||||
| 			JobController: jobconfig.JobControllerConfiguration{ | ||||
| 				ConcurrentJobSyncs: 5, | ||||
| 				ConcurrentJobSyncs: 10, | ||||
| 			}, | ||||
| 			CronJobController: cronjobconfig.CronJobControllerConfiguration{ | ||||
| 				ConcurrentCronJobSyncs: 5, | ||||
| @@ -1076,6 +1077,16 @@ func TestValidateControllersOptions(t *testing.T) { | ||||
| 				}, | ||||
| 			}).Validate, | ||||
| 		}, | ||||
| 		{ | ||||
| 			name:                   "JobControllerOptions ConcurrentJobSyncs equal 0", | ||||
| 			expectErrors:           true, | ||||
| 			expectedErrorSubString: "concurrent-job-syncs must be greater than 0", | ||||
| 			validate: (&JobControllerOptions{ | ||||
| 				&jobconfig.JobControllerConfiguration{ | ||||
| 					ConcurrentJobSyncs: 0, | ||||
| 				}, | ||||
| 			}).Validate, | ||||
| 		}, | ||||
| 		/* empty errs */ | ||||
| 		{ | ||||
| 			name:         "CronJobControllerOptions", | ||||
| @@ -1139,7 +1150,7 @@ func TestValidateControllersOptions(t *testing.T) { | ||||
| 			expectErrors: false, | ||||
| 			validate: (&JobControllerOptions{ | ||||
| 				&jobconfig.JobControllerConfiguration{ | ||||
| 					ConcurrentJobSyncs: 5, | ||||
| 					ConcurrentJobSyncs: 10, | ||||
| 				}, | ||||
| 			}).Validate, | ||||
| 		}, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot