Skip to content

Commit eb48ad8

Browse files
committed
fix: make config overrides non optional
1 parent 6b45069 commit eb48ad8

3 files changed

Lines changed: 72 additions & 58 deletions

File tree

extra/crds.yaml

Lines changed: 60 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -412,21 +412,24 @@ spec:
412412
properties:
413413
jvm.config:
414414
additionalProperties:
415+
nullable: true
415416
type: string
417+
default: {}
416418
description: Overrides for the `jvm.config` file.
417-
nullable: true
418419
type: object
419420
runtime.properties:
420421
additionalProperties:
422+
nullable: true
421423
type: string
424+
default: {}
422425
description: Overrides for the `runtime.properties` file.
423-
nullable: true
424426
type: object
425427
security.properties:
426428
additionalProperties:
429+
nullable: true
427430
type: string
431+
default: {}
428432
description: Overrides for the `security.properties` file.
429-
nullable: true
430433
type: object
431434
type: object
432435
envOverrides:
@@ -903,21 +906,24 @@ spec:
903906
properties:
904907
jvm.config:
905908
additionalProperties:
909+
nullable: true
906910
type: string
911+
default: {}
907912
description: Overrides for the `jvm.config` file.
908-
nullable: true
909913
type: object
910914
runtime.properties:
911915
additionalProperties:
916+
nullable: true
912917
type: string
918+
default: {}
913919
description: Overrides for the `runtime.properties` file.
914-
nullable: true
915920
type: object
916921
security.properties:
917922
additionalProperties:
923+
nullable: true
918924
type: string
925+
default: {}
919926
description: Overrides for the `security.properties` file.
920-
nullable: true
921927
type: object
922928
type: object
923929
envOverrides:
@@ -2011,21 +2017,24 @@ spec:
20112017
properties:
20122018
jvm.config:
20132019
additionalProperties:
2020+
nullable: true
20142021
type: string
2022+
default: {}
20152023
description: Overrides for the `jvm.config` file.
2016-
nullable: true
20172024
type: object
20182025
runtime.properties:
20192026
additionalProperties:
2027+
nullable: true
20202028
type: string
2029+
default: {}
20212030
description: Overrides for the `runtime.properties` file.
2022-
nullable: true
20232031
type: object
20242032
security.properties:
20252033
additionalProperties:
2034+
nullable: true
20262035
type: string
2036+
default: {}
20272037
description: Overrides for the `security.properties` file.
2028-
nullable: true
20292038
type: object
20302039
type: object
20312040
envOverrides:
@@ -2502,21 +2511,24 @@ spec:
25022511
properties:
25032512
jvm.config:
25042513
additionalProperties:
2514+
nullable: true
25052515
type: string
2516+
default: {}
25062517
description: Overrides for the `jvm.config` file.
2507-
nullable: true
25082518
type: object
25092519
runtime.properties:
25102520
additionalProperties:
2521+
nullable: true
25112522
type: string
2523+
default: {}
25122524
description: Overrides for the `runtime.properties` file.
2513-
nullable: true
25142525
type: object
25152526
security.properties:
25162527
additionalProperties:
2528+
nullable: true
25172529
type: string
2530+
default: {}
25182531
description: Overrides for the `security.properties` file.
2519-
nullable: true
25202532
type: object
25212533
type: object
25222534
envOverrides:
@@ -3012,21 +3024,24 @@ spec:
30123024
properties:
30133025
jvm.config:
30143026
additionalProperties:
3027+
nullable: true
30153028
type: string
3029+
default: {}
30163030
description: Overrides for the `jvm.config` file.
3017-
nullable: true
30183031
type: object
30193032
runtime.properties:
30203033
additionalProperties:
3034+
nullable: true
30213035
type: string
3036+
default: {}
30223037
description: Overrides for the `runtime.properties` file.
3023-
nullable: true
30243038
type: object
30253039
security.properties:
30263040
additionalProperties:
3041+
nullable: true
30273042
type: string
3043+
default: {}
30283044
description: Overrides for the `security.properties` file.
3029-
nullable: true
30303045
type: object
30313046
type: object
30323047
envOverrides:
@@ -3543,21 +3558,24 @@ spec:
35433558
properties:
35443559
jvm.config:
35453560
additionalProperties:
3561+
nullable: true
35463562
type: string
3563+
default: {}
35473564
description: Overrides for the `jvm.config` file.
3548-
nullable: true
35493565
type: object
35503566
runtime.properties:
35513567
additionalProperties:
3568+
nullable: true
35523569
type: string
3570+
default: {}
35533571
description: Overrides for the `runtime.properties` file.
3554-
nullable: true
35553572
type: object
35563573
security.properties:
35573574
additionalProperties:
3575+
nullable: true
35583576
type: string
3577+
default: {}
35593578
description: Overrides for the `security.properties` file.
3560-
nullable: true
35613579
type: object
35623580
type: object
35633581
envOverrides:
@@ -4072,21 +4090,24 @@ spec:
40724090
properties:
40734091
jvm.config:
40744092
additionalProperties:
4093+
nullable: true
40754094
type: string
4095+
default: {}
40764096
description: Overrides for the `jvm.config` file.
4077-
nullable: true
40784097
type: object
40794098
runtime.properties:
40804099
additionalProperties:
4100+
nullable: true
40814101
type: string
4102+
default: {}
40824103
description: Overrides for the `runtime.properties` file.
4083-
nullable: true
40844104
type: object
40854105
security.properties:
40864106
additionalProperties:
4107+
nullable: true
40874108
type: string
4109+
default: {}
40884110
description: Overrides for the `security.properties` file.
4089-
nullable: true
40904111
type: object
40914112
type: object
40924113
envOverrides:
@@ -4559,21 +4580,24 @@ spec:
45594580
properties:
45604581
jvm.config:
45614582
additionalProperties:
4583+
nullable: true
45624584
type: string
4585+
default: {}
45634586
description: Overrides for the `jvm.config` file.
4564-
nullable: true
45654587
type: object
45664588
runtime.properties:
45674589
additionalProperties:
4590+
nullable: true
45684591
type: string
4592+
default: {}
45694593
description: Overrides for the `runtime.properties` file.
4570-
nullable: true
45714594
type: object
45724595
security.properties:
45734596
additionalProperties:
4597+
nullable: true
45744598
type: string
4599+
default: {}
45754600
description: Overrides for the `security.properties` file.
4576-
nullable: true
45774601
type: object
45784602
type: object
45794603
envOverrides:
@@ -5039,21 +5063,24 @@ spec:
50395063
properties:
50405064
jvm.config:
50415065
additionalProperties:
5066+
nullable: true
50425067
type: string
5068+
default: {}
50435069
description: Overrides for the `jvm.config` file.
5044-
nullable: true
50455070
type: object
50465071
runtime.properties:
50475072
additionalProperties:
5073+
nullable: true
50485074
type: string
5075+
default: {}
50495076
description: Overrides for the `runtime.properties` file.
5050-
nullable: true
50515077
type: object
50525078
security.properties:
50535079
additionalProperties:
5080+
nullable: true
50545081
type: string
5082+
default: {}
50555083
description: Overrides for the `security.properties` file.
5056-
nullable: true
50575084
type: object
50585085
type: object
50595086
envOverrides:
@@ -5530,21 +5557,24 @@ spec:
55305557
properties:
55315558
jvm.config:
55325559
additionalProperties:
5560+
nullable: true
55335561
type: string
5562+
default: {}
55345563
description: Overrides for the `jvm.config` file.
5535-
nullable: true
55365564
type: object
55375565
runtime.properties:
55385566
additionalProperties:
5567+
nullable: true
55395568
type: string
5569+
default: {}
55405570
description: Overrides for the `runtime.properties` file.
5541-
nullable: true
55425571
type: object
55435572
security.properties:
55445573
additionalProperties:
5574+
nullable: true
55455575
type: string
5576+
default: {}
55465577
description: Overrides for the `security.properties` file.
5547-
nullable: true
55485578
type: object
55495579
type: object
55505580
envOverrides:

rust/operator-binary/src/controller/validate.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,12 @@ fn key_value_overrides(
8888
overrides: &DruidConfigOverrides,
8989
file: ConfigFileName,
9090
) -> BTreeMap<String, Option<String>> {
91-
let kv = match file {
92-
ConfigFileName::RuntimeProperties => overrides.runtime_properties.as_ref(),
93-
ConfigFileName::SecurityProperties => overrides.security_properties.as_ref(),
91+
match file {
92+
ConfigFileName::RuntimeProperties => overrides.runtime_properties.overrides.clone(),
93+
ConfigFileName::SecurityProperties => overrides.security_properties.overrides.clone(),
9494
// log4j2.properties is rendered by the logging framework and accepts no key/value overrides.
95-
ConfigFileName::Log4j2Properties => None,
96-
};
97-
kv.map(
98-
stackable_operator::config_overrides::KeyValueConfigOverrides::as_product_config_overrides,
99-
)
100-
.unwrap_or_default()
95+
ConfigFileName::Log4j2Properties => BTreeMap::new(),
96+
}
10197
}
10298

10399
/// Builds the precomputed per-file config for a single rolegroup. Pure assembly: combines the

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

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use stackable_operator::{
1717
fragment::{self, Fragment, FromFragment, ValidationError},
1818
merge::Merge,
1919
},
20-
config_overrides::KeyValueConfigOverrides,
2120
crd::{
2221
authentication::{core, oidc},
2322
s3,
@@ -36,6 +35,7 @@ use stackable_operator::{
3635
shared::time::Duration,
3736
status::condition::{ClusterCondition, HasStatusCondition},
3837
utils::{COMMON_BASH_TRAP_FUNCTIONS, crds::raw_object_list_schema},
38+
v2::config_overrides::KeyValueConfigOverrides,
3939
versioned::versioned,
4040
};
4141
use strum::{Display, EnumDiscriminants, EnumIter, EnumString, IntoStaticStr};
@@ -116,30 +116,18 @@ const DEFAULT_HISTORICAL_SECRET_LIFETIME: Duration = Duration::from_days_uncheck
116116
pub struct DruidConfigOverrides {
117117
/// Overrides for the `runtime.properties` file.
118118
// File name defined in [`crate::controller::build::properties::ConfigFileName`]
119-
#[serde(
120-
default,
121-
rename = "runtime.properties",
122-
skip_serializing_if = "Option::is_none"
123-
)]
124-
pub runtime_properties: Option<KeyValueConfigOverrides>,
119+
#[serde(default, rename = "runtime.properties")]
120+
pub runtime_properties: KeyValueConfigOverrides,
125121

126122
/// Overrides for the `jvm.config` file.
127123
// File name defined in [`crate::controller::build::properties::ConfigFileName`]
128-
#[serde(
129-
default,
130-
rename = "jvm.config",
131-
skip_serializing_if = "Option::is_none"
132-
)]
133-
pub jvm_config: Option<KeyValueConfigOverrides>,
124+
#[serde(default, rename = "jvm.config")]
125+
pub jvm_config: KeyValueConfigOverrides,
134126

135127
/// Overrides for the `security.properties` file.
136128
// File name defined in [`crate::controller::build::properties::ConfigFileName`]
137-
#[serde(
138-
default,
139-
rename = "security.properties",
140-
skip_serializing_if = "Option::is_none"
141-
)]
142-
pub security_properties: Option<KeyValueConfigOverrides>,
129+
#[serde(default, rename = "security.properties")]
130+
pub security_properties: KeyValueConfigOverrides,
143131
}
144132

145133
#[derive(Snafu, Debug, EnumDiscriminants)]

0 commit comments

Comments
 (0)