Skip to content

Commit

Permalink
Merge pull request #17 from MaterializeInc/configurable-concurrency
Browse files Browse the repository at this point in the history
allow for configurable max reconciliation concurrency
  • Loading branch information
jubrad authored Feb 29, 2024
2 parents 9adb2b3 + 7a56f3b commit a0ac4e9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [0.2.1] - 2024-02-29

### Changed
* Allow for configurable max reconciliation concurrency.


## [0.2.0] - 2023-08-09

### Changed
Expand All @@ -19,4 +25,4 @@

### Added

* Initial release
* Initial release
18 changes: 18 additions & 0 deletions src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ where
let controller = kube_runtime::controller::Controller::new(
Api::<Ctx::Resource>::namespaced(client.clone(), namespace),
wc,
)
.with_config(
kube_runtime::Config::default()
.concurrency(Ctx::MAX_CONCURRENT_RECILIATIONS.to_owned()),
);
Self {
client,
Expand Down Expand Up @@ -91,6 +95,10 @@ where
let controller = kube_runtime::controller::Controller::new(
Api::<Ctx::Resource>::all(client.clone()),
wc,
)
.with_config(
kube_runtime::Config::default()
.concurrency(Ctx::MAX_CONCURRENT_RECILIATIONS.to_owned()),
);
Self {
client,
Expand All @@ -117,6 +125,10 @@ where
let controller = kube_runtime::controller::Controller::new(
Api::<Ctx::Resource>::all(client.clone()),
wc,
)
.with_config(
kube_runtime::Config::default()
.concurrency(Ctx::MAX_CONCURRENT_RECILIATIONS.to_owned()),
);
Self {
client,
Expand Down Expand Up @@ -209,6 +221,12 @@ pub trait Context {
/// run against the same resource, unexpected behavior can occur.
const FINALIZER_NAME: &'static str;

/// Max objects to reconcile concurrently.
/// Set to 0 for unbound concurrency.
/// Regardless of this attribute a given object
/// will not be reconciled twice at the same time.
const MAX_CONCURRENT_RECILIATIONS: &'static u16 = &0u16;

/// This method is called when a watched resource is created or updated.
/// The [`Client`] used by the controller is passed in to allow making
/// additional API requests, as is the resource which triggered this
Expand Down

0 comments on commit a0ac4e9

Please sign in to comment.