Skip to content
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

feat!: Add jvmArgumentOverrides as well as common code #931

Merged
merged 26 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ce932f0
WIP: First draft of ProductSpecificCommonConfig
sbernauer Dec 6, 2024
3462c9e
v2: Allow deletion of operator generated arguments
sbernauer Dec 6, 2024
a7ae846
refactor!: Make field private
sbernauer Dec 9, 2024
5ee9d11
WIP: Try out add, remove and removeRegex
sbernauer Dec 20, 2024
cc1bad8
refactor
sbernauer Dec 20, 2024
cc62afb
WIP
sbernauer Dec 20, 2024
97bde94
refactor!: Use Vec instead of BTreeSet
sbernauer Dec 23, 2024
e716f7a
Merge branch 'main' into feat/jvm-arguments
sbernauer Dec 27, 2024
08759f1
Remove missleading function
sbernauer Jan 2, 2025
8472dbf
Link to docs
sbernauer Jan 2, 2025
5c0b3b8
Revert "Remove missleading function"
sbernauer Jan 2, 2025
9a9a99c
Rename merged_product_specific_common_configs -> get_product_specific…
sbernauer Jan 2, 2025
b79bc64
changelog
sbernauer Jan 8, 2025
670dfb4
typo
sbernauer Jan 8, 2025
c26e533
Improve changelog
sbernauer Jan 8, 2025
c6cae70
Add some CRD docs
sbernauer Jan 8, 2025
3ebcc82
Improve rustdoc
sbernauer Jan 8, 2025
de5d580
Add some rustdoc
sbernauer Jan 8, 2025
8aa04b5
Merge remote-tracking branch 'origin/main' into feat/jvm-arguments
sbernauer Jan 14, 2025
57f8f4e
changelog
sbernauer Jan 14, 2025
66d4ec9
refactor!: Dont use Merge, implement try_merge instead
sbernauer Jan 14, 2025
c816bab
clippy
sbernauer Jan 14, 2025
e3151e3
Use serde_yaml for entire_role
sbernauer Jan 15, 2025
ddb503a
simplyfy merge_java_common_config_keep_order test
maltesander Jan 15, 2025
5769f5c
Update crates/stackable-operator/src/role_utils.rs
maltesander Jan 15, 2025
9a967fa
Merge remote-tracking branch 'origin/main' into feat/jvm-arguments
sbernauer Jan 16, 2025
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
9 changes: 6 additions & 3 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ All notable changes to this project will be documented in this file.
- BREAKING: Aggregate emitted Kubernetes events on the CustomResources thanks to the new
[kube feature](https://github.com/kube-rs/controller-rs/pull/116). Instead of reporting the same
event multiple times it now uses `EventSeries` to aggregate these events to single entry with an
age like `3s (x11 over 53s)` ([#867]):
age like `3s (x11 over 53s)` ([#938]):
- The `report_controller_error` function now needs to be async.
- It now takes `Recorder` as a parameter instead of a `Client`.
- The `Recorder` instance needs to be available across all `reconcile` invocations, to ensure
aggregation works correctly.
- The operator needs permission to `patch` events (previously only `create` was needed).
- Add `ProductSpecificCommonConfig`, so that product operators can have custom fields within `commonConfig`.
Also add a `JavaCommonConfig`, which can be used by JVM-based tools to offer `jvmArgumentOverrides` with this mechanism ([#931])

### Changed

- BREAKING: Bump Rust dependencies to enable Kubernetes 1.32 (via `kube` 0.98.0 and `k8s-openapi`
0.23.0) ([#867]).
- BREAKING: Bump Rust dependencies to enable Kubernetes 1.32 (via `kube` 0.98.0 and `k8s-openapi` 0.23.0) ([#938]).
- BREAKING: Append a dot to the default cluster domain to make it a FQDN and allow FQDNs when validating a `DomainName` ([#939]).

[#931]: https://github.com/stackabletech/operator-rs/pull/931
[#938]: https://github.com/stackabletech/operator-rs/pull/938
[#939]: https://github.com/stackabletech/operator-rs/pull/939

## [0.83.0] - 2024-12-03
Expand Down
34 changes: 22 additions & 12 deletions crates/stackable-operator/src/product_config_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,21 @@ pub fn config_for_role_and_group<'a>(
/// - `resource` - Not used directly. It's passed on to the `Configuration::compute_*` calls.
/// - `roles` - A map keyed by role names. The value is a tuple of a vector of `PropertyNameKind`
/// like (Cli, Env or Files) and [`crate::role_utils::Role`] with a boxed [`Configuration`].
pub fn transform_all_roles_to_config<T, U>(
#[allow(clippy::type_complexity)]
pub fn transform_all_roles_to_config<T, U, ProductSpecificCommonConfig>(
resource: &T::Configurable,
roles: HashMap<String, (Vec<PropertyNameKind>, Role<T, U>)>,
roles: HashMap<
String,
(
Vec<PropertyNameKind>,
Role<T, U, ProductSpecificCommonConfig>,
),
>,
) -> Result<RoleConfigByPropertyKind>
where
T: Configuration,
U: Default + JsonSchema + Serialize,
ProductSpecificCommonConfig: Default + JsonSchema + Serialize,
{
let mut result = HashMap::new();

Expand Down Expand Up @@ -359,15 +367,16 @@ fn process_validation_result(
/// - `role_name` - The name of the role.
/// - `role` - The role for which to transform the configuration parameters.
/// - `property_kinds` - Used as "buckets" to partition the configuration properties by.
fn transform_role_to_config<T, U>(
fn transform_role_to_config<T, U, ProductSpecificCommonConfig>(
resource: &T::Configurable,
role_name: &str,
role: &Role<T, U>,
role: &Role<T, U, ProductSpecificCommonConfig>,
property_kinds: &[PropertyNameKind],
) -> Result<RoleGroupConfigByPropertyKind>
where
T: Configuration,
U: Default + JsonSchema + Serialize,
ProductSpecificCommonConfig: Default + JsonSchema + Serialize,
{
let mut result = HashMap::new();

Expand Down Expand Up @@ -422,10 +431,10 @@ where
/// - `role_name` - Not used directly but passed on to the `Configuration::compute_*` calls.
/// - `config` - The configuration properties to partition.
/// - `property_kinds` - The "buckets" used to partition the configuration properties.
fn parse_role_config<T>(
fn parse_role_config<T, ProductSpecificCommonConfig>(
resource: &<T as Configuration>::Configurable,
role_name: &str,
config: &CommonConfiguration<T>,
config: &CommonConfiguration<T, ProductSpecificCommonConfig>,
property_kinds: &[PropertyNameKind],
) -> Result<HashMap<PropertyNameKind, BTreeMap<String, Option<String>>>>
where
Expand All @@ -452,8 +461,8 @@ where
Ok(result)
}

fn parse_role_overrides<T>(
config: &CommonConfiguration<T>,
fn parse_role_overrides<T, ProductSpecificCommonConfig>(
config: &CommonConfiguration<T, ProductSpecificCommonConfig>,
property_kinds: &[PropertyNameKind],
) -> Result<HashMap<PropertyNameKind, BTreeMap<String, Option<String>>>>
where
Expand Down Expand Up @@ -489,8 +498,8 @@ where
Ok(result)
}

fn parse_file_overrides<T>(
config: &CommonConfiguration<T>,
fn parse_file_overrides<T, ProductSpecificCommonConfig>(
config: &CommonConfiguration<T, ProductSpecificCommonConfig>,
file: &str,
) -> Result<BTreeMap<String, Option<String>>>
where
Expand Down Expand Up @@ -522,7 +531,7 @@ mod tests {
}

use super::*;
use crate::role_utils::{Role, RoleGroup};
use crate::role_utils::{GenericProductSpecificCommonConfig, Role, RoleGroup};
use k8s_openapi::api::core::v1::PodTemplateSpec;
use rstest::*;
use std::collections::HashMap;
Expand Down Expand Up @@ -610,13 +619,14 @@ mod tests {
config_overrides: Option<HashMap<String, HashMap<String, String>>>,
env_overrides: Option<HashMap<String, String>>,
cli_overrides: Option<BTreeMap<String, String>>,
) -> CommonConfiguration<Box<TestConfig>> {
) -> CommonConfiguration<Box<TestConfig>, GenericProductSpecificCommonConfig> {
CommonConfiguration {
config: test_config.unwrap_or_default(),
config_overrides: config_overrides.unwrap_or_default(),
env_overrides: env_overrides.unwrap_or_default(),
cli_overrides: cli_overrides.unwrap_or_default(),
pod_overrides: PodTemplateSpec::default(),
product_specific_common_config: GenericProductSpecificCommonConfig::default(),
}
}

Expand Down
Loading
Loading