Skip to content

Commit

Permalink
Fix number of reconcilers for Pod integration (kubernetes-sigs#1835)
Browse files Browse the repository at this point in the history
Change-Id: If8f430731a6967a361d0f5172ed408f57a0687bc
  • Loading branch information
alculquicondor authored and vsoch committed Apr 18, 2024
1 parent 19a0b7c commit 996181e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/components/manager/controller_manager_config.yaml
Expand Up @@ -13,7 +13,7 @@ leaderElection:
controller:
groupKindConcurrency:
Job.batch: 5
Pod.: 5
Pod: 5
Workload.kueue.x-k8s.io: 5
LocalQueue.kueue.x-k8s.io: 1
ClusterQueue.kueue.x-k8s.io: 1
Expand Down
6 changes: 6 additions & 0 deletions pkg/controller/jobs/pod/pod_controller.go
Expand Up @@ -43,6 +43,7 @@ import (
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/controller"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"

kueue "sigs.k8s.io/kueue/apis/kueue/v1beta1"
Expand Down Expand Up @@ -108,9 +109,14 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
}

func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
concurrency := mgr.GetControllerOptions().GroupKindConcurrency[gvk.GroupKind().String()]
ctrl.Log.V(3).Info("Setting up Pod reconciler", "concurrency", concurrency)
return ctrl.NewControllerManagedBy(mgr).
Watches(&corev1.Pod{}, &podEventHandler{cleanedUpPodsExpectations: r.expectationsStore}).Named("v1_pod").
Watches(&kueue.Workload{}, &workloadHandler{}).
WithOptions(controller.Options{
MaxConcurrentReconciles: concurrency,
}).
Complete(r)
}

Expand Down

0 comments on commit 996181e

Please sign in to comment.