Skip to content

Commit

Permalink
configuration controller support to configurate MaxConcurrentReconciles
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei committed Mar 14, 2024
1 parent fb26daa commit 0cf08c8
Show file tree
Hide file tree
Showing 2 changed files with 57,631 additions and 0 deletions.
7 changes: 7 additions & 0 deletions controllers/apps/configuration/configuration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package configuration
import (
"context"
"fmt"
"math"
"strconv"
"time"

Expand All @@ -31,11 +32,14 @@ import (
"k8s.io/client-go/tools/record"
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/log"

appsv1alpha1 "github.com/apecloud/kubeblocks/apis/apps/v1alpha1"
"github.com/apecloud/kubeblocks/pkg/constant"
"github.com/apecloud/kubeblocks/pkg/controller/component"
intctrlutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
viper "github.com/apecloud/kubeblocks/pkg/viperx"
)

// ConfigurationReconciler reconciles a Configuration object
Expand Down Expand Up @@ -188,6 +192,9 @@ func (r *ConfigurationReconciler) runTasks(taskCtx TaskContext, tasks []Task) (e
func (r *ConfigurationReconciler) SetupWithManager(mgr ctrl.Manager) error {
return ctrl.NewControllerManagedBy(mgr).
For(&appsv1alpha1.Configuration{}).
WithOptions(controller.Options{
MaxConcurrentReconciles: int(math.Ceil(viper.GetFloat64(constant.CfgKBReconcileWorkers) / 2)),
}).
Owns(&corev1.ConfigMap{}).
Complete(r)
}
Expand Down
Loading

0 comments on commit 0cf08c8

Please sign in to comment.