Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Add MaxConcurrentReconciles to JobControllerConfiguration #205

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ k8s.io/component-base v0.25.0 h1:haVKlLkPCFZhkcqB6WCvpVxftrg6+FK5x1ZuaIDaQ5Y=
k8s.io/component-base v0.25.0/go.mod h1:F2Sumv9CnbBlqrpdf7rKZTmmd2meJq0HizeyY/yAFxk=
k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20200428234225-8167cfdcfc14/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
k8s.io/gengo v0.0.0-20211129171323-c02415ce4185 h1:TT1WdmqqXareKxZ/oNXEUSwKlLiHzPMyB0t8BaFeBYI=
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
Expand Down
12 changes: 11 additions & 1 deletion pkg/controller.v1/common/job_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ const (
type JobControllerConfiguration struct {
// GangScheduling choice: None, volcano and scheduler-plugins
GangScheduling GangScheduler

// MaxConcurrentReconciles is the maximum number of concurrent Reconciles which can be run.
// Defaults to 1.
MaxConcurrentReconciles int
}

func (c *JobControllerConfiguration) EnableGangScheduling() bool {
Expand Down Expand Up @@ -187,6 +191,7 @@ var GenNonGangSchedulerSetupFunc = func() GangSchedulingSetupFunc {
func NewJobController(
controllerImpl apiv1.ControllerInterface,
reconcilerSyncPeriod metav1.Duration,
maxConcurrentReconciles int,
kubeClientSet kubeclientset.Interface,
setupPodGroup GangSchedulingSetupFunc,
kubeInformerFactory kubeinformers.SharedInformerFactory,
Expand All @@ -208,9 +213,14 @@ func NewJobController(
Recorder: eventBroadcaster.NewRecorder(scheme.Scheme, corev1.EventSource{Component: controllerImpl.ControllerName()}),
}

jobControllerConfig := JobControllerConfiguration{
GangScheduling: GangSchedulerNone,
MaxConcurrentReconciles: maxConcurrentReconciles,
}

jc := JobController{
Controller: controllerImpl,
Config: JobControllerConfiguration{GangScheduling: GangSchedulerNone},
Config: jobControllerConfig,
PodControl: podControl,
ServiceControl: serviceControl,
KubeClientSet: kubeClientSet,
Expand Down