Skip to content

Commit fb55831

Browse files
chore: Improve code style
1 parent fd9d88a commit fb55831

6 files changed

Lines changed: 26 additions & 10 deletions

File tree

extra/crds.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,11 @@ spec:
18711871
nullable: true
18721872
type: string
18731873
default: {}
1874+
description: |-
1875+
Flat key-value overrides for `*.properties`, Hadoop XML, etc.
1876+
1877+
This is backwards-compatible with the existing flat key-value YAML format
1878+
used by `HashMap<String, String>`.
18741879
type: object
18751880
type: object
18761881
envOverrides:
@@ -2562,6 +2567,11 @@ spec:
25622567
nullable: true
25632568
type: string
25642569
default: {}
2570+
description: |-
2571+
Flat key-value overrides for `*.properties`, Hadoop XML, etc.
2572+
2573+
This is backwards-compatible with the existing flat key-value YAML format
2574+
used by `HashMap<String, String>`.
25652575
type: object
25662576
type: object
25672577
envOverrides:

rust/operator-binary/src/controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ impl ReconcilerError for Error {
147147
}
148148

149149
type OpenSearchRoleGroupConfig = RoleGroupConfig<
150-
GenericCommonConfig,
151150
ValidatedOpenSearchConfig,
151+
GenericCommonConfig,
152152
v1alpha1::OpenSearchConfigOverrides,
153153
>;
154154

rust/operator-binary/src/controller/build/role_group_builder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,8 @@ impl<'a> RoleGroupBuilder<'a> {
10731073
) -> Vec<Volume> {
10741074
let mut volume_source_builder = SecretOperatorVolumeSourceBuilder::new(
10751075
tls_internal_secret_class,
1076+
// OpenSearch requires both the public certificate and the private key to serve the
1077+
// transport layer via TLS.
10761078
SecretClassVolumeProvisionParts::PublicPrivate,
10771079
);
10781080

@@ -1110,6 +1112,8 @@ impl<'a> RoleGroupBuilder<'a> {
11101112
) -> Vec<Volume> {
11111113
let mut volume_source_builder = SecretOperatorVolumeSourceBuilder::new(
11121114
tls_server_secret_class,
1115+
// OpenSearch requires both the public certificate and the private key to serve the
1116+
// REST layer via TLS.
11131117
SecretClassVolumeProvisionParts::PublicPrivate,
11141118
);
11151119

rust/operator-binary/src/crd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ pub mod versioned {
488488
}
489489

490490
#[derive(Clone, Debug, Default, Deserialize, JsonSchema, Merge, PartialEq, Serialize)]
491-
#[serde(rename_all = "camelCase")]
492491
pub struct OpenSearchConfigOverrides {
492+
// File name defined in [`crate::controller::build::node_config::CONFIGURATION_FILE_OPENSEARCH_YML`]
493493
#[serde(default, rename = "opensearch.yml")]
494494
pub opensearch_yml: KeyValueConfigOverrides,
495495
}

rust/operator-binary/src/framework/config_overrides.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ use serde::{Deserialize, Serialize};
55
use stackable_operator::{config::merge::Merge, schemars};
66

77
// Mergeable variant of [`stackable_operator::config_overrides::KeyValueConfigOverrides`]
8+
/// Flat key-value overrides for `*.properties`, Hadoop XML, etc.
9+
///
10+
/// This is backwards-compatible with the existing flat key-value YAML format
11+
/// used by `HashMap<String, String>`.
812
#[derive(Clone, Debug, Default, Deserialize, Eq, JsonSchema, Merge, PartialEq, Serialize)]
913
pub struct KeyValueConfigOverrides {
1014
#[serde(flatten)]

rust/operator-binary/src/framework/role_utils.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl Merge for GenericCommonConfig {
3737
/// * `config` is flattened.
3838
/// * The [`HashMap`] in `env_overrides` is replaced with an [`EnvVarSet`].
3939
#[derive(Clone, Debug, PartialEq)]
40-
pub struct RoleGroupConfig<ProductSpecificCommonConfig, Config, ConfigOverrides> {
40+
pub struct RoleGroupConfig<Config, CommonConfig, ConfigOverrides> {
4141
pub replicas: u16,
4242
pub config: Config,
4343
pub config_overrides: ConfigOverrides,
@@ -46,12 +46,10 @@ pub struct RoleGroupConfig<ProductSpecificCommonConfig, Config, ConfigOverrides>
4646
pub pod_overrides: PodTemplateSpec,
4747
// allow(dead_code) is not necessary anymore when moved to operator-rs
4848
#[allow(dead_code)]
49-
pub product_specific_common_config: ProductSpecificCommonConfig,
49+
pub product_specific_common_config: CommonConfig,
5050
}
5151

52-
impl<ProductSpecificCommonConfig, Config, ConfigOverrides>
53-
RoleGroupConfig<ProductSpecificCommonConfig, Config, ConfigOverrides>
54-
{
52+
impl<Config, CommonConfig, ConfigOverrides> RoleGroupConfig<Config, CommonConfig, ConfigOverrides> {
5553
pub fn cli_overrides_to_vec(&self) -> Vec<String> {
5654
self.cli_overrides
5755
.clone()
@@ -62,13 +60,13 @@ impl<ProductSpecificCommonConfig, Config, ConfigOverrides>
6260
}
6361

6462
/// Merges and validates the [`RoleGroup`] with the given `role` and `default_config`
65-
pub fn with_validated_config<C, CommonConfig, Config, RoleConfig, ConfigOverrides>(
63+
pub fn with_validated_config<ValidatedConfig, CommonConfig, Config, RoleConfig, ConfigOverrides>(
6664
role_group: &RoleGroup<Config, CommonConfig, ConfigOverrides>,
6765
role: &Role<Config, ConfigOverrides, RoleConfig, CommonConfig>,
6866
default_config: &Config,
69-
) -> Result<RoleGroup<C, CommonConfig, ConfigOverrides>, fragment::ValidationError>
67+
) -> Result<RoleGroup<ValidatedConfig, CommonConfig, ConfigOverrides>, fragment::ValidationError>
7068
where
71-
C: FromFragment<Fragment = Config>,
69+
ValidatedConfig: FromFragment<Fragment = Config>,
7270
CommonConfig: Clone + Default + JsonSchema + Merge + Serialize,
7371
Config: Clone + Merge,
7472
RoleConfig: Default + JsonSchema + Serialize,

0 commit comments

Comments
 (0)