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

fix: Don't default roleGroup replicas to zero when not specified #402

Merged
merged 3 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ All notable changes to this project will be documented in this file.
- Let secret-operator handle certificate conversion ([#392]).
- `operator-rs` `0.44.0` -> `0.52.0` ([#381], [#394], [#404]).

### Fixed

- Don't default roleGroup replicas to zero when not specified ([#402]).

[#378]: https://github.com/stackabletech/hdfs-operator/pull/378
[#381]: https://github.com/stackabletech/hdfs-operator/pull/381
[#384]: https://github.com/stackabletech/hdfs-operator/pull/384
[#392]: https://github.com/stackabletech/hdfs-operator/pull/392
[#394]: https://github.com/stackabletech/hdfs-operator/pull/394
[#402]: https://github.com/stackabletech/hdfs-operator/pull/402
[#404]: https://github.com/stackabletech/hdfs-operator/pull/404

## [23.7.0] - 2023-07-14
Expand Down
14 changes: 4 additions & 10 deletions rust/crd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,23 +377,17 @@ impl HdfsRole {
}

/// Return replicas for a certain rolegroup.
pub fn role_group_replicas(&self, hdfs: &HdfsCluster, role_group: &str) -> i32 {
pub fn role_group_replicas(&self, hdfs: &HdfsCluster, role_group: &str) -> Option<u16> {
match self {
HdfsRole::NameNode => hdfs
.namenode_rolegroup(role_group)
.and_then(|rg| rg.replicas)
.unwrap_or_default()
.into(),
.and_then(|rg| rg.replicas),
HdfsRole::DataNode => hdfs
.datanode_rolegroup(role_group)
.and_then(|rg| rg.replicas)
.unwrap_or_default()
.into(),
.and_then(|rg| rg.replicas),
HdfsRole::JournalNode => hdfs
.journalnode_rolegroup(role_group)
.and_then(|rg| rg.replicas)
.unwrap_or_default()
.into(),
.and_then(|rg| rg.replicas),
}
}

Expand Down
4 changes: 3 additions & 1 deletion rust/operator/src/hdfs_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,9 @@ fn rolegroup_statefulset(
.build(),
spec: Some(StatefulSetSpec {
pod_management_policy: Some("OrderedReady".to_string()),
replicas: Some(role.role_group_replicas(hdfs, &rolegroup_ref.role_group)),
replicas: role
.role_group_replicas(hdfs, &rolegroup_ref.role_group)
.map(i32::from),
selector: LabelSelector {
match_labels: Some(role_group_selector_labels(
hdfs,
Expand Down
Loading