Skip to content

Commit a0ac4e9

Browse files
authored
Merge pull request #17 from MaterializeInc/configurable-concurrency
allow for configurable max reconciliation concurrency
2 parents 9adb2b3 + 7a56f3b commit a0ac4e9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [0.2.1] - 2024-02-29
4+
5+
### Changed
6+
* Allow for configurable max reconciliation concurrency.
7+
8+
39
## [0.2.0] - 2023-08-09
410

511
### Changed
@@ -19,4 +25,4 @@
1925

2026
### Added
2127

22-
* Initial release
28+
* Initial release

src/controller.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ where
6262
let controller = kube_runtime::controller::Controller::new(
6363
Api::<Ctx::Resource>::namespaced(client.clone(), namespace),
6464
wc,
65+
)
66+
.with_config(
67+
kube_runtime::Config::default()
68+
.concurrency(Ctx::MAX_CONCURRENT_RECILIATIONS.to_owned()),
6569
);
6670
Self {
6771
client,
@@ -91,6 +95,10 @@ where
9195
let controller = kube_runtime::controller::Controller::new(
9296
Api::<Ctx::Resource>::all(client.clone()),
9397
wc,
98+
)
99+
.with_config(
100+
kube_runtime::Config::default()
101+
.concurrency(Ctx::MAX_CONCURRENT_RECILIATIONS.to_owned()),
94102
);
95103
Self {
96104
client,
@@ -117,6 +125,10 @@ where
117125
let controller = kube_runtime::controller::Controller::new(
118126
Api::<Ctx::Resource>::all(client.clone()),
119127
wc,
128+
)
129+
.with_config(
130+
kube_runtime::Config::default()
131+
.concurrency(Ctx::MAX_CONCURRENT_RECILIATIONS.to_owned()),
120132
);
121133
Self {
122134
client,
@@ -209,6 +221,12 @@ pub trait Context {
209221
/// run against the same resource, unexpected behavior can occur.
210222
const FINALIZER_NAME: &'static str;
211223

224+
/// Max objects to reconcile concurrently.
225+
/// Set to 0 for unbound concurrency.
226+
/// Regardless of this attribute a given object
227+
/// will not be reconciled twice at the same time.
228+
const MAX_CONCURRENT_RECILIATIONS: &'static u16 = &0u16;
229+
212230
/// This method is called when a watched resource is created or updated.
213231
/// The [`Client`] used by the controller is passed in to allow making
214232
/// additional API requests, as is the resource which triggered this

0 commit comments

Comments
 (0)