Skip to content
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
5 changes: 4 additions & 1 deletion cmd/operator/app/thread_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/predicate"

// ctrl "sigs.k8s.io/controller-runtime/pkg/controller"
ctrlController "sigs.k8s.io/controller-runtime/pkg/controller"

api "github.com/altinity/clickhouse-operator/pkg/apis/clickhouse-keeper.altinity.com/v1"
"github.com/altinity/clickhouse-operator/pkg/chop"
Expand Down Expand Up @@ -84,6 +84,9 @@ func initKeeper(ctx context.Context) error {
builder.WithPredicates(keeperPredicate()),
).
Owns(&apps.StatefulSet{}).
WithOptions(ctrlController.Options{
MaxConcurrentReconciles: chop.Config().Reconcile.Runtime.ReconcileCHKsThreadsNumber,
}).
Complete(
&controller.Controller{
Client: manager.GetClient(),
Expand Down
2 changes: 2 additions & 0 deletions config/config-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ reconcile:
runtime:
# Max number of concurrent CHI reconciles in progress
reconcileCHIsThreadsNumber: 1
# Max number of concurrent CHK reconciles in progress
reconcileCHKsThreadsNumber: 1

# The operator reconciles shards concurrently in each CHI with the following limitations:
# 1. Number of shards being reconciled (and thus having hosts down) in each CHI concurrently
Expand Down
2 changes: 2 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ reconcile:
runtime:
# Max number of concurrent CHI reconciles in progress
reconcileCHIsThreadsNumber: 10
# Max number of concurrent CHK reconciles in progress
reconcileCHKsThreadsNumber: 1

# The operator reconciles shards concurrently in each CHI with the following limitations:
# 1. Number of shards being reconciled (and thus having hosts down) in each CHI concurrently
Expand Down
2 changes: 2 additions & 0 deletions deploy/builder/templates-config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ reconcile:
runtime:
# Max number of concurrent CHI reconciles in progress
reconcileCHIsThreadsNumber: 10
# Max number of concurrent CHK reconciles in progress
reconcileCHKsThreadsNumber: 1

# The operator reconciles shards concurrently in each CHI with the following limitations:
# 1. Number of shards being reconciled (and thus having hosts down) in each CHI concurrently
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ spec:
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHIs in parallel, 10 by default"
reconcileCHKsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHKs in parallel, 1 by default"
reconcileShardsThreadsNumber:
type: integer
minimum: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@ spec:
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHIs in parallel, 10 by default"
reconcileCHKsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHKs in parallel, 1 by default"
reconcileShardsThreadsNumber:
type: integer
minimum: 1
Expand Down
3 changes: 3 additions & 0 deletions deploy/helm/clickhouse-operator/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@
"reconcileCHIsThreadsNumber": {
"type": "integer"
},
"reconcileCHKsThreadsNumber": {
"type": "integer"
},
"reconcileShardsMaxConcurrencyPercent": {
"type": "integer"
},
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/clickhouse-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ configs:
runtime:
# Max number of concurrent CHI reconciles in progress
reconcileCHIsThreadsNumber: 10
# Max number of concurrent CHK reconciles in progress
reconcileCHKsThreadsNumber: 1
# The operator reconciles shards concurrently in each CHI with the following limitations:
# 1. Number of shards being reconciled (and thus having hosts down) in each CHI concurrently
# can not be greater than 'reconcileShardsThreadsNumber'.
Expand Down
9 changes: 8 additions & 1 deletion deploy/operator/clickhouse-operator-install-ansible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4052,6 +4052,11 @@ spec:
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHIs in parallel, 10 by default"
reconcileCHKsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHKs in parallel, 1 by default"
reconcileShardsThreadsNumber:
type: integer
minimum: 1
Expand Down Expand Up @@ -6105,7 +6110,9 @@ data:
runtime:
# Max number of concurrent CHI reconciles in progress
reconcileCHIsThreadsNumber: 10

# Max number of concurrent CHK reconciles in progress
reconcileCHKsThreadsNumber: 1

# The operator reconciles shards concurrently in each CHI with the following limitations:
# 1. Number of shards being reconciled (and thus having hosts down) in each CHI concurrently
# can not be greater than 'reconcileShardsThreadsNumber'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4019,6 +4019,11 @@ spec:
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHIs in parallel, 10 by default"
reconcileCHKsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHKs in parallel, 1 by default"
reconcileShardsThreadsNumber:
type: integer
minimum: 1
Expand Down Expand Up @@ -6304,6 +6309,8 @@ data:
runtime:
# Max number of concurrent CHI reconciles in progress
reconcileCHIsThreadsNumber: 10
# Max number of concurrent CHK reconciles in progress
reconcileCHKsThreadsNumber: 1

# The operator reconciles shards concurrently in each CHI with the following limitations:
# 1. Number of shards being reconciled (and thus having hosts down) in each CHI concurrently
Expand Down
9 changes: 8 additions & 1 deletion deploy/operator/clickhouse-operator-install-bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4045,6 +4045,11 @@ spec:
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHIs in parallel, 10 by default"
reconcileCHKsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHKs in parallel, 1 by default"
reconcileShardsThreadsNumber:
type: integer
minimum: 1
Expand Down Expand Up @@ -6364,7 +6369,9 @@ data:
runtime:
# Max number of concurrent CHI reconciles in progress
reconcileCHIsThreadsNumber: 10

# Max number of concurrent CHK reconciles in progress
reconcileCHKsThreadsNumber: 1

# The operator reconciles shards concurrently in each CHI with the following limitations:
# 1. Number of shards being reconciled (and thus having hosts down) in each CHI concurrently
# can not be greater than 'reconcileShardsThreadsNumber'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4019,6 +4019,11 @@ spec:
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHIs in parallel, 10 by default"
reconcileCHKsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHKs in parallel, 1 by default"
reconcileShardsThreadsNumber:
type: integer
minimum: 1
Expand Down Expand Up @@ -6051,6 +6056,8 @@ data:
runtime:
# Max number of concurrent CHI reconciles in progress
reconcileCHIsThreadsNumber: 10
# Max number of concurrent CHK reconciles in progress
reconcileCHKsThreadsNumber: 1

# The operator reconciles shards concurrently in each CHI with the following limitations:
# 1. Number of shards being reconciled (and thus having hosts down) in each CHI concurrently
Expand Down
9 changes: 8 additions & 1 deletion deploy/operator/clickhouse-operator-install-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4045,6 +4045,11 @@ spec:
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHIs in parallel, 10 by default"
reconcileCHKsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHKs in parallel, 1 by default"
reconcileShardsThreadsNumber:
type: integer
minimum: 1
Expand Down Expand Up @@ -6098,7 +6103,9 @@ data:
runtime:
# Max number of concurrent CHI reconciles in progress
reconcileCHIsThreadsNumber: 10

# Max number of concurrent CHK reconciles in progress
reconcileCHKsThreadsNumber: 1

# The operator reconciles shards concurrently in each CHI with the following limitations:
# 1. Number of shards being reconciled (and thus having hosts down) in each CHI concurrently
# can not be greater than 'reconcileShardsThreadsNumber'.
Expand Down
9 changes: 8 additions & 1 deletion deploy/operator/clickhouse-operator-install-tf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4052,6 +4052,11 @@ spec:
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHIs in parallel, 10 by default"
reconcileCHKsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHKs in parallel, 1 by default"
reconcileShardsThreadsNumber:
type: integer
minimum: 1
Expand Down Expand Up @@ -6105,7 +6110,9 @@ data:
runtime:
# Max number of concurrent CHI reconciles in progress
reconcileCHIsThreadsNumber: 10

# Max number of concurrent CHK reconciles in progress
reconcileCHKsThreadsNumber: 1

# The operator reconciles shards concurrently in each CHI with the following limitations:
# 1. Number of shards being reconciled (and thus having hosts down) in each CHI concurrently
# can not be greater than 'reconcileShardsThreadsNumber'.
Expand Down
5 changes: 5 additions & 0 deletions deploy/operator/parts/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8589,6 +8589,11 @@ spec:
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHIs in parallel, 10 by default"
reconcileCHKsThreadsNumber:
type: integer
minimum: 1
maximum: 65535
description: "How many goroutines will be used to reconcile CHKs in parallel, 1 by default"
reconcileShardsThreadsNumber:
type: integer
minimum: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ const (
// Used in case no other specified in config
defaultReconcileCHIsThreadsNumber = 1

// defaultReconcileCHKsThreadsNumber specifies default number of CHK controller threads running concurrently.
// Used in case no other specified in config
defaultReconcileCHKsThreadsNumber = 1

// defaultReconcileShardsThreadsNumber specifies the default number of threads usable for concurrent shard reconciliation
// within a single cluster reconciliation. Defaults to 1, which means strictly sequential shard reconciliation.
defaultReconcileShardsThreadsNumber = 1
Expand Down Expand Up @@ -663,6 +667,7 @@ type OperatorConfigReconcileRecoveryCompletedScope struct {

type OperatorConfigReconcileRuntime struct {
ReconcileCHIsThreadsNumber int `json:"reconcileCHIsThreadsNumber" yaml:"reconcileCHIsThreadsNumber"`
ReconcileCHKsThreadsNumber int `json:"reconcileCHKsThreadsNumber" yaml:"reconcileCHKsThreadsNumber"`
ReconcileShardsThreadsNumber int `json:"reconcileShardsThreadsNumber" yaml:"reconcileShardsThreadsNumber"`
ReconcileShardsMaxConcurrencyPercent int `json:"reconcileShardsMaxConcurrencyPercent" yaml:"reconcileShardsMaxConcurrencyPercent"`

Expand Down Expand Up @@ -1399,6 +1404,9 @@ func (c *OperatorConfig) normalizeSectionReconcileRuntime() {
if c.Reconcile.Runtime.ReconcileCHIsThreadsNumber == 0 {
c.Reconcile.Runtime.ReconcileCHIsThreadsNumber = defaultReconcileCHIsThreadsNumber
}
if c.Reconcile.Runtime.ReconcileCHKsThreadsNumber == 0 {
c.Reconcile.Runtime.ReconcileCHKsThreadsNumber = defaultReconcileCHKsThreadsNumber
}
if c.Reconcile.Runtime.ReconcileShardsThreadsNumber == 0 {
c.Reconcile.Runtime.ReconcileShardsThreadsNumber = defaultReconcileShardsThreadsNumber
}
Expand Down