Skip to content

Commit 70a891c

Browse files
sbernauerNickLarsenNZTechassi
authored
feat(stackable-webhook)!: Add support for mutating webhooks (#1119)
* feat!: Add support for mutating webhooks * Add state to the mutating webhook * Improve docs * Add some docs * refactor: Rename traits and structs * Add some docs * More docs * Apply suggestions from code review Co-authored-by: Nick <[email protected]> * Update crates/stackable-webhook/src/lib.rs Co-authored-by: Nick <[email protected]> * formatiing * Rename operator to webhook * Tkae the WebhookServerOptions by reference * Remove leftover code * Update crates/stackable-webhook/src/servers/mutating_webhook.rs Co-authored-by: Nick <[email protected]> * Move tracing layer to after routes * Improve tracing * Rename servers mdodule to webhooks * Add some docs * Add some docs * changelog * changelog * Update crates/stackable-webhook/src/lib.rs Co-authored-by: Nick <[email protected]> * Update crates/stackable-webhook/src/lib.rs Co-authored-by: Nick <[email protected]> * fix doc tests * Improve shutdown message * Add validating webhook as well * refactor: Avoid Box * refactor: Move out into get_webhook_client_config * Revert "refactor: Avoid Box" This reverts commit bea8241. It actually caused lifetime problems in commons-operator * Remove unneeded loop * Move new Self{} into variable * Only clone the handler * calculated -> determined * Clarify only operator touch MWCs * Add Webhhok::ignore_certificate_rotation trait function * docs: Add some field level docs * Remove validating webhook for now It's too much copy/paste from mutating, we need to refactor at a later point * trace::debug route registration * Add some docs for conversion webhook * Remove unneeded #[allow(unreachable_code)] * Address review feedback in offline session * clippy * More tracing fields * Rename to create_webhook_client_config * docs docs docs * Move _resource down * Return early if no webhooks are registered * Fix kube dependency in Cargo.toml --------- Co-authored-by: Nick <[email protected]> Co-authored-by: Techassi <[email protected]>
1 parent ceb3d3c commit 70a891c

File tree

13 files changed

+757
-865
lines changed

13 files changed

+757
-865
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ repository = "https://github.com/stackabletech/operator-rs"
1111
[workspace.dependencies]
1212
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.8.0" }
1313

14-
arc-swap = "1.7"
14+
arc-swap = "1.7.0"
15+
async-trait = "0.1.89"
1516
axum = { version = "0.8.1", features = ["http2"] }
1617
chrono = { version = "0.4.38", default-features = false }
1718
clap = { version = "4.5.17", features = ["derive", "cargo", "env"] }
@@ -38,7 +39,7 @@ k8s-openapi = { version = "0.26.0", default-features = false, features = ["schem
3839
# We use rustls instead of openssl for easier portability, e.g. so that we can build stackablectl without the need to vendor (build from source) openssl
3940
# We use ring instead of aws-lc-rs, as this currently fails to build in "make run-dev"
4041
# We pin the kube version, as we use a patch for 2.0.1
41-
kube = { git = "https://github.com/stackabletech/kube-rs", branch = "2.0.1-fix-schema-hoisting", version = "=2.0.1", default-features = false, features = ["client", "jsonpatch", "runtime", "derive", "rustls-tls", "ring"] }
42+
kube = { git = "https://github.com/stackabletech/kube-rs", branch = "2.0.1-fix-schema-hoisting", version = "=2.0.1", default-features = false, features = ["client", "jsonpatch", "runtime", "derive", "admission", "rustls-tls", "ring"] }
4243
opentelemetry = "0.31.0"
4344
opentelemetry_sdk = { version = "0.31.0", features = ["rt-tokio"] }
4445
opentelemetry-appender-tracing = "0.31.0"

crates/stackable-webhook/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
### Added
8+
9+
- Add support for mutating webhooks ([#1119]).
10+
11+
### Changed
12+
13+
- BREAKING: Refactor the entire `WebhookServer` mechanism, so multiple webhooks can run in parallel.
14+
Put individual webhooks (currently `ConversionWebhook` and `MutatingWebhook`) behind the `Webhook` trait ([#1119]).
15+
16+
[#1119]: https://github.com/stackabletech/operator-rs/pull/1119
17+
718
## [0.7.1] - 2025-10-31
819

920
### Fixed

crates/stackable-webhook/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ stackable-shared = { path = "../stackable-shared" }
1212
stackable-telemetry = { path = "../stackable-telemetry" }
1313

1414
arc-swap.workspace = true
15+
async-trait.workspace = true
1516
axum.workspace = true
1617
futures-util.workspace = true
1718
hyper-util.workspace = true
@@ -21,6 +22,7 @@ kube.workspace = true
2122
opentelemetry.workspace = true
2223
opentelemetry-semantic-conventions.workspace = true
2324
rand.workspace = true
25+
serde.workspace = true
2426
serde_json.workspace = true
2527
snafu.workspace = true
2628
tokio-rustls.workspace = true

0 commit comments

Comments
 (0)