Skip to content

Commit cca1dc8

Browse files
authored
fix: Don't default roleGroup replicas to zero when not specified (#402)
* fix: Don't default roleGroup replicas to zero when not specified * changelog
1 parent 51fb158 commit cca1dc8

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ All notable changes to this project will be documented in this file.
1616
- Let secret-operator handle certificate conversion ([#392]).
1717
- `operator-rs` `0.44.0` -> `0.52.0` ([#381], [#394], [#404]).
1818

19+
### Fixed
20+
21+
- Don't default roleGroup replicas to zero when not specified ([#402]).
22+
1923
[#378]: https://github.com/stackabletech/hdfs-operator/pull/378
2024
[#381]: https://github.com/stackabletech/hdfs-operator/pull/381
2125
[#384]: https://github.com/stackabletech/hdfs-operator/pull/384
2226
[#392]: https://github.com/stackabletech/hdfs-operator/pull/392
2327
[#394]: https://github.com/stackabletech/hdfs-operator/pull/394
28+
[#402]: https://github.com/stackabletech/hdfs-operator/pull/402
2429
[#404]: https://github.com/stackabletech/hdfs-operator/pull/404
2530

2631
## [23.7.0] - 2023-07-14

rust/crd/src/lib.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -377,23 +377,17 @@ impl HdfsRole {
377377
}
378378

379379
/// Return replicas for a certain rolegroup.
380-
pub fn role_group_replicas(&self, hdfs: &HdfsCluster, role_group: &str) -> i32 {
380+
pub fn role_group_replicas(&self, hdfs: &HdfsCluster, role_group: &str) -> Option<u16> {
381381
match self {
382382
HdfsRole::NameNode => hdfs
383383
.namenode_rolegroup(role_group)
384-
.and_then(|rg| rg.replicas)
385-
.unwrap_or_default()
386-
.into(),
384+
.and_then(|rg| rg.replicas),
387385
HdfsRole::DataNode => hdfs
388386
.datanode_rolegroup(role_group)
389-
.and_then(|rg| rg.replicas)
390-
.unwrap_or_default()
391-
.into(),
387+
.and_then(|rg| rg.replicas),
392388
HdfsRole::JournalNode => hdfs
393389
.journalnode_rolegroup(role_group)
394-
.and_then(|rg| rg.replicas)
395-
.unwrap_or_default()
396-
.into(),
390+
.and_then(|rg| rg.replicas),
397391
}
398392
}
399393

rust/operator/src/hdfs_controller.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,9 @@ fn rolegroup_statefulset(
694694
.build(),
695695
spec: Some(StatefulSetSpec {
696696
pod_management_policy: Some("OrderedReady".to_string()),
697-
replicas: Some(role.role_group_replicas(hdfs, &rolegroup_ref.role_group)),
697+
replicas: role
698+
.role_group_replicas(hdfs, &rolegroup_ref.role_group)
699+
.map(i32::from),
698700
selector: LabelSelector {
699701
match_labels: Some(role_group_selector_labels(
700702
hdfs,

0 commit comments

Comments
 (0)