Skip to content

Commit f03ee35

Browse files
committed
Increase orchestrator controller worker to 10
1 parent c0ac4b6 commit f03ee35

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
3737
* Add `InitContainers` and `Containers` in `.Spec.PodSpec` to allow the user specifying custom containers.
3838
* Add `MetricsExporterResources` and `MySQLOperatorSidecarResrouces` in `.Spec.PodSpec` to allow
3939
the user specifying resources for thos sidecars containers.
40+
* Add command line flag to configure number of workers for orchestrator controller.
4041
### Changed
4142
* [#422](https://github.com/presslabs/mysql-operator/pull/422) adds the `SidecarServerPort` to the
4243
`MasterService` and introduces one new service, HealthyReplicasService, so that we can try to
@@ -64,6 +65,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6465
[`extra_max_connections`](https://www.percona.com/doc/percona-server/5.7/performance/threadpool.html#extra_max_connections)
6566
is larger than the default `1`. If MySQL server runs out of available connections, using `extra_port`
6667
allows the exporter to continue collecting MySQL metrics.
68+
* Change the default number of workers for orchestrator controller from 1 to 10.
6769
### Removed
6870
### Fixed
6971
* Update and fix e2e tests

pkg/controller/orchestrator/orchestrator_controller.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
9090
clusters := &sync.Map{}
9191

9292
// Create a new controller
93-
c, err := controller.New(controllerName, mgr, controller.Options{Reconciler: r})
93+
c, err := controller.New(controllerName, mgr, controller.Options{
94+
Reconciler: r,
95+
MaxConcurrentReconciles: int(options.GetOptions().OrchestratorConcurrentReconciles),
96+
})
9497
if err != nil {
9598
return err
9699
}

pkg/controller/orchestrator/orchestrator_reconcile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ func (ou *orcUpdater) updateClusterReadyStatus() {
171171
if master {
172172
hasMaster = true
173173
} else if !replicating {
174+
// TODO: check for replicating to be not Unknown here
174175
ou.cluster.UpdateStatusCondition(api.ClusterConditionReady, core.ConditionFalse, "NotReplicating",
175176
fmt.Sprintf("Node %s is part of topology and not replicating", hostname))
176177
return
@@ -513,7 +514,6 @@ func (ou *orcUpdater) markReadOnlyNodesInOrc(insts InstancesSet, master *orc.Ins
513514
if master == nil {
514515
// master is not found
515516
// set cluster read only
516-
ou.log.Info("setting cluster in read-only")
517517
for _, inst := range insts {
518518
if err = ou.setReadOnlyNode(inst); err != nil {
519519
ou.log.Error(err, "failed to set read only", "instance", instToLog(&inst))

pkg/options/options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ type Options struct {
6969
// MySQLVersionImageOverride define a map between MySQL version and image.
7070
// This overrides the default versions and has priority.
7171
MySQLVersionImageOverride map[string]string
72+
73+
// OrchestratorConcurrentReconciles sets the orchestrator controller workers
74+
OrchestratorConcurrentReconciles int32
7275
}
7376

7477
type pullpolicy corev1.PullPolicy
@@ -141,6 +144,9 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
141144

142145
fs.StringToStringVar(&o.MySQLVersionImageOverride, "mysql-versions-to-image", map[string]string{},
143146
"A map to override default image for different mysql versions. Example: 5.7.23=mysql:5.7,5.7.24=mysql:5.7")
147+
148+
fs.Int32Var(&o.OrchestratorConcurrentReconciles, "orchestrator-concurrent-reconciles", 10,
149+
"Set the number of workers for orchestrator reconciler.")
144150
}
145151

146152
var instance *Options

0 commit comments

Comments
 (0)