Skip to content

Commit 2113e1c

Browse files
Merging and validation of the configuration refactored (#223)
# Description Merging and validation of the configuration refactored
1 parent 9d90d22 commit 2113e1c

38 files changed

+502
-441
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ All notable changes to this project will be documented in this file.
1313

1414
- Revert openshift settings ([#207])
1515
- BUGFIX: assign service account to history pods ([#207])
16+
- Merging and validation of the configuration refactored ([#223])
17+
- `operator-rs` `0.36.0``0.38.0` ([#223])
1618

1719
[#207]: https://github.com/stackabletech/spark-k8s-operator/pull/207
1820
[#217]: https://github.com/stackabletech/spark-k8s-operator/pull/217
21+
[#223]: https://github.com/stackabletech/spark-k8s-operator/pull/223
1922

2023
## [23.1.0] - 2023-01-23
2124

Cargo.lock

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

deploy/helm/spark-k8s-operator/crds/crds.yaml

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,13 @@ spec:
8787
nullable: true
8888
properties:
8989
affinity:
90-
nullable: true
90+
default:
91+
podAffinity: null
92+
podAntiAffinity: null
93+
nodeAffinity: null
94+
nodeSelector: null
9195
properties:
92-
node_affinity:
96+
nodeAffinity:
9397
description: Node affinity is a group of node affinity scheduling rules.
9498
nullable: true
9599
properties:
@@ -217,10 +221,10 @@ spec:
217221
- nodeSelectorTerms
218222
type: object
219223
type: object
220-
node_selector:
224+
nodeSelector:
221225
nullable: true
222226
type: object
223-
pod_affinity:
227+
podAffinity:
224228
description: Pod affinity is a group of inter pod affinity scheduling rules.
225229
nullable: true
226230
properties:
@@ -390,7 +394,7 @@ spec:
390394
type: object
391395
type: array
392396
type: object
393-
pod_anti_affinity:
397+
podAntiAffinity:
394398
description: Pod anti affinity is a group of inter pod anti affinity scheduling rules.
395399
nullable: true
396400
properties:
@@ -562,7 +566,14 @@ spec:
562566
type: object
563567
type: object
564568
resources:
565-
nullable: true
569+
default:
570+
memory:
571+
limit: null
572+
runtimeLimits: {}
573+
cpu:
574+
min: null
575+
max: null
576+
storage: {}
566577
properties:
567578
cpu:
568579
default:
@@ -704,9 +715,13 @@ spec:
704715
nullable: true
705716
properties:
706717
affinity:
707-
nullable: true
718+
default:
719+
podAffinity: null
720+
podAntiAffinity: null
721+
nodeAffinity: null
722+
nodeSelector: null
708723
properties:
709-
node_affinity:
724+
nodeAffinity:
710725
description: Node affinity is a group of node affinity scheduling rules.
711726
nullable: true
712727
properties:
@@ -834,10 +849,10 @@ spec:
834849
- nodeSelectorTerms
835850
type: object
836851
type: object
837-
node_selector:
852+
nodeSelector:
838853
nullable: true
839854
type: object
840-
pod_affinity:
855+
podAffinity:
841856
description: Pod affinity is a group of inter pod affinity scheduling rules.
842857
nullable: true
843858
properties:
@@ -1007,7 +1022,7 @@ spec:
10071022
type: object
10081023
type: array
10091024
type: object
1010-
pod_anti_affinity:
1025+
podAntiAffinity:
10111026
description: Pod anti affinity is a group of inter pod anti affinity scheduling rules.
10121027
nullable: true
10131028
properties:
@@ -1189,7 +1204,14 @@ spec:
11891204
nullable: true
11901205
type: object
11911206
resources:
1192-
nullable: true
1207+
default:
1208+
memory:
1209+
limit: null
1210+
runtimeLimits: {}
1211+
cpu:
1212+
min: null
1213+
max: null
1214+
storage: {}
11931215
properties:
11941216
cpu:
11951217
default:
@@ -1253,7 +1275,14 @@ spec:
12531275
nullable: true
12541276
properties:
12551277
resources:
1256-
nullable: true
1278+
default:
1279+
memory:
1280+
limit: null
1281+
runtimeLimits: {}
1282+
cpu:
1283+
min: null
1284+
max: null
1285+
storage: {}
12571286
properties:
12581287
cpu:
12591288
default:

rust/crd/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ version = "0.0.0-dev"
99
publish = false
1010

1111
[dependencies]
12-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag="0.36.0" }
12+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag="0.38.0" }
1313

1414
semver = "1.0"
1515
serde = "1.0"

rust/crd/src/history.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
use crate::affinity::history_affinity;
2-
use crate::constants::*;
3-
use stackable_operator::commons::affinity::StackableAffinity;
4-
use stackable_operator::commons::product_image_selection::{ProductImage, ResolvedProductImage};
5-
use stackable_operator::commons::resources::{
6-
CpuLimitsFragment, MemoryLimitsFragment, NoRuntimeLimitsFragment,
7-
};
8-
use stackable_operator::commons::s3::S3BucketDef;
9-
use stackable_operator::config::fragment::ValidationError;
10-
use stackable_operator::k8s_openapi::apimachinery::pkg::api::resource::Quantity;
11-
use stackable_operator::kube::runtime::reflector::ObjectRef;
12-
use stackable_operator::kube::ResourceExt;
13-
use stackable_operator::product_config::types::PropertyNameKind;
14-
use stackable_operator::product_config::ProductConfigManager;
15-
use stackable_operator::product_config_utils::{
16-
transform_all_roles_to_config, validate_all_roles_and_groups_config, Configuration,
17-
ValidatedRoleConfigByPropertyKind,
18-
};
19-
use stackable_operator::role_utils::{Role, RoleGroupRef};
1+
use crate::{affinity::history_affinity, constants::*};
202

213
use std::collections::{BTreeMap, HashMap};
224

235
use serde::{Deserialize, Serialize};
246
use snafu::{ResultExt, Snafu};
257
use stackable_operator::{
26-
commons::resources::{NoRuntimeLimits, Resources, ResourcesFragment},
27-
config::{fragment, fragment::Fragment, merge::Merge},
28-
};
29-
use stackable_operator::{
8+
commons::{
9+
affinity::StackableAffinity,
10+
product_image_selection::{ProductImage, ResolvedProductImage},
11+
resources::{
12+
CpuLimitsFragment, MemoryLimitsFragment, NoRuntimeLimits, NoRuntimeLimitsFragment,
13+
Resources, ResourcesFragment,
14+
},
15+
s3::S3BucketDef,
16+
},
17+
config::{
18+
fragment,
19+
fragment::{Fragment, ValidationError},
20+
merge::Merge,
21+
},
22+
k8s_openapi::apimachinery::pkg::api::resource::Quantity,
3023
kube::CustomResource,
24+
kube::{runtime::reflector::ObjectRef, ResourceExt},
25+
product_config::{types::PropertyNameKind, ProductConfigManager},
26+
product_config_utils::{
27+
transform_all_roles_to_config, validate_all_roles_and_groups_config, Configuration,
28+
ValidatedRoleConfigByPropertyKind,
29+
},
30+
role_utils::{Role, RoleGroupRef},
3131
schemars::{self, JsonSchema},
3232
};
3333
use strum::Display;
@@ -91,7 +91,7 @@ impl SparkHistoryServer {
9191
conf_role.merge(&conf_defaults);
9292
conf_rolegroup.merge(&conf_role);
9393

94-
fragment::validate(conf_defaults).context(FragmentValidationFailureSnafu)
94+
fragment::validate(conf_rolegroup).context(FragmentValidationFailureSnafu)
9595
}
9696

9797
pub fn replicas(&self, rolegroup_ref: &RoleGroupRef<Self>) -> Option<i32> {

0 commit comments

Comments
 (0)