1
0
Fork 0
mirror of https://github.com/external-secrets/external-secrets.git synced 2024-12-14 11:57:59 +00:00

feat: enable concurrent reconciling for push secret reconciler (#4124)

* feat: enable concurrent reconciling for push secret reconciler

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>

* add cluster secret store concurrent option as well

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>

---------

Signed-off-by: Gergely Brautigam <182850+Skarlso@users.noreply.github.com>
This commit is contained in:
Gergely Brautigam 2024-11-19 12:20:05 +01:00 committed by GitHub
parent 210b39715e
commit 3ffeeb55dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 6 deletions

View file

@ -189,7 +189,9 @@ var rootCmd = &cobra.Command{
Scheme: mgr.GetScheme(),
ControllerClass: controllerClass,
RequeueInterval: storeRequeueInterval,
}).SetupWithManager(mgr); err != nil {
}).SetupWithManager(mgr, controller.Options{
MaxConcurrentReconciles: concurrent,
}); err != nil {
setupLog.Error(err, errCreateController, "controller", "ClusterSecretStore")
os.Exit(1)
}
@ -218,7 +220,9 @@ var rootCmd = &cobra.Command{
ControllerClass: controllerClass,
RestConfig: mgr.GetConfig(),
RequeueInterval: time.Hour,
}).SetupWithManager(mgr); err != nil {
}).SetupWithManager(mgr, controller.Options{
MaxConcurrentReconciles: concurrent,
}); err != nil {
setupLog.Error(err, errCreateController, "controller", "PushSecret")
os.Exit(1)
}

View file

@ -32,6 +32,7 @@ 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/controller/controllerutil"
esapi "github.com/external-secrets/external-secrets/apis/externalsecrets/v1alpha1"
@ -69,10 +70,11 @@ type Reconciler struct {
ControllerClass string
}
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager, opts controller.Options) error {
r.recorder = mgr.GetEventRecorderFor("pushsecret")
return ctrl.NewControllerManagedBy(mgr).
WithOptions(opts).
For(&esapi.PushSecret{}).
Complete(r)
}

View file

@ -25,6 +25,7 @@ import (
"k8s.io/client-go/rest"
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/envtest"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
@ -96,7 +97,9 @@ var _ = BeforeSuite(func() {
Log: ctrl.Log.WithName("controllers").WithName("PushSecret"),
RestConfig: cfg,
RequeueInterval: time.Second,
}).SetupWithManager(k8sManager)
}).SetupWithManager(k8sManager, controller.Options{
MaxConcurrentReconciles: 1,
})
Expect(err).ToNot(HaveOccurred())
go func() {

View file

@ -24,6 +24,7 @@ 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"
esapi "github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1"
ctrlmetrics "github.com/external-secrets/external-secrets/pkg/controllers/metrics"
@ -66,10 +67,11 @@ func (r *ClusterStoreReconciler) Reconcile(ctx context.Context, req ctrl.Request
}
// SetupWithManager returns a new controller builder that will be started by the provided Manager.
func (r *ClusterStoreReconciler) SetupWithManager(mgr ctrl.Manager) error {
func (r *ClusterStoreReconciler) SetupWithManager(mgr ctrl.Manager, opts controller.Options) error {
r.recorder = mgr.GetEventRecorderFor("cluster-secret-store")
return ctrl.NewControllerManagedBy(mgr).
WithOptions(opts).
For(&esapi.ClusterSecretStore{}).
Complete(r)
}

View file

@ -93,7 +93,7 @@ var _ = BeforeSuite(func() {
Scheme: k8sManager.GetScheme(),
ControllerClass: defaultControllerClass,
Log: ctrl.Log.WithName("controllers").WithName("ClusterSecretStore"),
}).SetupWithManager(k8sManager)
}).SetupWithManager(k8sManager, controller.Options{})
Expect(err).ToNot(HaveOccurred())
go func() {