-
-
Notifications
You must be signed in to change notification settings - Fork 16
feat!: Add working conversion webhook with cert rotation #1066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 14 commits
0ef29ab
ed58563
3be083e
fd4d94b
b3c17b3
bdbcee0
b4c22b0
31b128b
b84cf05
0390680
2e1d085
3f8e744
6f0040c
941ee6b
0c52f5f
2ec9b73
a8a2381
9089385
4671a41
a3b3cc1
f8683e4
457dbf3
a39ee47
6210262
dcb22bd
f1fee5d
caddffb
7450d85
ac29c0e
51321f0
082a59d
c032633
8dedf5a
9da5588
758202f
29b0c6c
8b83131
e9e182e
fe1749d
3894d3b
0936315
99f1dfe
daac003
0e1a160
8dc1235
f87c468
d8765d8
0c490c2
4e4cc70
0dd99ed
5e41bf1
320e821
221bc36
37818fd
c925bd0
8c13fd4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,7 +163,7 @@ pub enum Command<Run: Args = ProductOperatorRun> { | |
/// Can be embedded into an extended argument set: | ||
/// | ||
/// ```rust | ||
/// # use stackable_operator::cli::{Command, ProductOperatorRun, ProductConfigPath}; | ||
/// # use stackable_operator::cli::{Command, OperatorEnvironmentOpts, ProductOperatorRun, ProductConfigPath}; | ||
/// use clap::Parser; | ||
/// use stackable_operator::namespace::WatchNamespace; | ||
/// use stackable_telemetry::tracing::TelemetryOptions; | ||
|
@@ -176,14 +176,31 @@ pub enum Command<Run: Args = ProductOperatorRun> { | |
/// common: ProductOperatorRun, | ||
/// } | ||
/// | ||
/// let opts = Command::<Run>::parse_from(["foobar-operator", "run", "--name", "foo", "--product-config", "bar", "--watch-namespace", "foobar"]); | ||
/// let opts = Command::<Run>::parse_from([ | ||
/// "foobar-operator", | ||
/// "run", | ||
/// "--name", | ||
/// "foo", | ||
/// "--product-config", | ||
/// "bar", | ||
/// "--watch-namespace", | ||
/// "foobar", | ||
/// "--operator-namespace", | ||
/// "stackable-operators", | ||
/// "--operator-service-name", | ||
/// "foo-operator", | ||
/// ]); | ||
/// assert_eq!(opts, Command::Run(Run { | ||
/// name: "foo".to_string(), | ||
/// common: ProductOperatorRun { | ||
/// product_config: ProductConfigPath::from("bar".as_ref()), | ||
/// watch_namespace: WatchNamespace::One("foobar".to_string()), | ||
/// telemetry_arguments: TelemetryOptions::default(), | ||
/// cluster_info_opts: Default::default(), | ||
/// operator_environment: OperatorEnvironmentOpts { | ||
/// operator_namespace: "stackable-operators".to_string(), | ||
/// operator_service_name: "foo-operator".to_string(), | ||
/// }, | ||
/// }, | ||
/// })); | ||
/// ``` | ||
|
@@ -216,6 +233,9 @@ pub struct ProductOperatorRun { | |
#[arg(long, env, default_value = "")] | ||
pub watch_namespace: WatchNamespace, | ||
|
||
#[command(flatten)] | ||
pub operator_environment: OperatorEnvironmentOpts, | ||
Techassi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
#[command(flatten)] | ||
pub telemetry_arguments: TelemetryOptions, | ||
Techassi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
@@ -278,6 +298,18 @@ impl ProductConfigPath { | |
} | ||
} | ||
|
||
#[derive(clap::Parser, Debug, PartialEq, Eq)] | ||
pub struct OperatorEnvironmentOpts { | ||
/// The namespace the operator is running in, usually `stackable-operators`. | ||
Techassi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#[arg(long, env)] | ||
pub operator_namespace: String, | ||
|
||
/// The name of the service the operator is reachable at, usually | ||
/// something like `<product>-operator`. | ||
#[arg(long, env)] | ||
pub operator_service_name: String, | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use std::{env, fs::File}; | ||
|
@@ -292,6 +324,8 @@ mod tests { | |
const DEPLOY_FILE_PATH: &str = "deploy_config_spec_properties.yaml"; | ||
const DEFAULT_FILE_PATH: &str = "default_file_path_properties.yaml"; | ||
const WATCH_NAMESPACE: &str = "WATCH_NAMESPACE"; | ||
const OPERATOR_NAMESPACE: &str = "OPERATOR_NAMESPACE"; | ||
const OPERATOR_SERVICE_NAME: &str = "OPERATOR_SERVICE_NAME"; | ||
|
||
#[test] | ||
fn verify_cli() { | ||
|
@@ -388,6 +422,10 @@ mod tests { | |
"bar", | ||
"--watch-namespace", | ||
"foo", | ||
"--operator-namespace", | ||
"stackable-operators", | ||
"--operator-service-name", | ||
"foo-operator", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: I still feel like all these CLI unit tests are pretty much useless and should be removed to speed up the testing runs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think they have a noticeable effect on the test runtime. Compare to the really slow doc tests, those take 1000x longer (not joking ^^) |
||
]); | ||
assert_eq!( | ||
opts, | ||
|
@@ -396,23 +434,42 @@ mod tests { | |
watch_namespace: WatchNamespace::One("foo".to_string()), | ||
cluster_info_opts: Default::default(), | ||
telemetry_arguments: Default::default(), | ||
operator_environment: OperatorEnvironmentOpts { | ||
operator_namespace: "stackable-operators".to_string(), | ||
operator_service_name: "foo-operator".to_string(), | ||
} | ||
} | ||
); | ||
|
||
// no cli / no env | ||
let opts = ProductOperatorRun::parse_from(["run", "--product-config", "bar"]); | ||
let opts = ProductOperatorRun::parse_from([ | ||
"run", | ||
"--product-config", | ||
"bar", | ||
"--operator-namespace", | ||
"stackable-operators", | ||
"--operator-service-name", | ||
"foo-operator", | ||
]); | ||
assert_eq!( | ||
opts, | ||
ProductOperatorRun { | ||
product_config: ProductConfigPath::from("bar".as_ref()), | ||
watch_namespace: WatchNamespace::All, | ||
cluster_info_opts: Default::default(), | ||
telemetry_arguments: Default::default(), | ||
operator_environment: OperatorEnvironmentOpts { | ||
operator_namespace: "stackable-operators".to_string(), | ||
operator_service_name: "foo-operator".to_string(), | ||
} | ||
} | ||
); | ||
|
||
// env with namespace | ||
unsafe { env::set_var(WATCH_NAMESPACE, "foo") }; | ||
unsafe { env::set_var(OPERATOR_SERVICE_NAME, "foo-operator") }; | ||
Techassi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
unsafe { env::set_var(OPERATOR_NAMESPACE, "stackable-operators") }; | ||
|
||
let opts = ProductOperatorRun::parse_from(["run", "--product-config", "bar"]); | ||
assert_eq!( | ||
opts, | ||
|
@@ -421,6 +478,10 @@ mod tests { | |
watch_namespace: WatchNamespace::One("foo".to_string()), | ||
cluster_info_opts: Default::default(), | ||
telemetry_arguments: Default::default(), | ||
operator_environment: OperatorEnvironmentOpts { | ||
operator_namespace: "stackable-operators".to_string(), | ||
operator_service_name: "foo-operator".to_string(), | ||
} | ||
} | ||
); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file. | |
|
||
## [Unreleased] | ||
|
||
### Added | ||
Techassi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
- BREAKING: Re-write the `ConversionWebhookServer`. | ||
It can now do CRD conversions, handle multiple CRDs and takes care of reconciling the CRDs ([#1066]). | ||
Techassi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- BREAKING: The `TlsServer` can now handle certificate rotation. | ||
To achieve this, a new `CertificateResolver` was added. | ||
Also, `TlsServer::new` now returns an additional `mpsc::Receiver<Certificate>`, so that the caller | ||
can get notified about certificate rotations happening ([#1066]). | ||
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: (Addition to the comment above) This would be the perfect trigger for the operator (the caller of this function) to reconcile the CRDs. |
||
|
||
### Fixed | ||
|
||
- Don't pull in the `aws-lc-rs` crate, as this currently fails to build in `make run-dev` ([#1043]). | ||
|
@@ -15,13 +24,16 @@ All notable changes to this project will be documented in this file. | |
deployed to Kubernetes (e.g. conversion or mutating - which this crate targets) need to be | ||
accessible by it, which is not the case when only using loopback. | ||
Also, the constant `DEFAULT_SOCKET_ADDR` has been renamed to `DEFAULT_SOCKET_ADDRESS` ([#1045]). | ||
- BREAKING: The `TlsServer` now requires you to pass SAN (subject alternative name) DNS entries, | ||
so the caller will trust the issued certificate ([#1066]). | ||
|
||
[#1043]: https://github.com/stackabletech/operator-rs/pull/1043 | ||
[#1045]: https://github.com/stackabletech/operator-rs/pull/1045 | ||
[#1066]: https://github.com/stackabletech/operator-rs/pull/1066 | ||
|
||
## [0.3.1] - 2024-07-10 | ||
|
||
## Changed | ||
### Changed | ||
|
||
- Remove instrumentation of long running functions, add more granular instrumentation of futures. Adjust span and event levels ([#811]). | ||
- Bump rust-toolchain to 1.79.0 ([#822]). | ||
|
Uh oh!
There was an error while loading. Please reload this page.