Skip to content

Commit fc6cc0d

Browse files
committed
Use deployedProductVersion to decide upgrade mode (but do not automatically advance it)
1 parent a5e9547 commit fc6cc0d

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

rust/crd/src/lib.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,6 @@ pub struct HdfsClusterSpec {
130130
// no doc string - See ProductImage struct
131131
pub image: ProductImage,
132132

133-
#[serde(default)]
134-
pub upgrading: bool,
135-
136133
// no doc string - See ClusterOperation struct
137134
#[serde(default)]
138135
pub cluster_operation: ClusterOperation,
@@ -808,14 +805,12 @@ impl HdfsCluster {
808805
}
809806

810807
pub fn is_upgrading(&self) -> bool {
811-
// *Ideally* we'd detect this from the version mismatch, but we need manual intervention to confirm that the upgrade is done
812-
self.spec.upgrading
813-
// self.status
814-
// .as_ref()
815-
// .and_then(|status| status.deployed_product_version.as_deref())
816-
// .map_or(false, |deployed_version| {
817-
// deployed_version != self.spec.image.product_version()
818-
// })
808+
self.status
809+
.as_ref()
810+
.and_then(|status| status.deployed_product_version.as_deref())
811+
.map_or(false, |deployed_version| {
812+
deployed_version != self.spec.image.product_version()
813+
})
819814
}
820815

821816
pub fn authentication_config(&self) -> Option<&AuthenticationConfig> {

rust/operator-binary/src/hdfs_controller.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,21 @@ pub async fn reconcile_hdfs(hdfs: Arc<HdfsCluster>, ctx: Arc<Ctx>) -> HdfsOperat
492492
hdfs.as_ref(),
493493
&[&ss_cond_builder, &cluster_operation_cond_builder],
494494
),
495-
deployed_product_version: if deploy_done {
496-
Some(hdfs.spec.image.product_version().to_string())
497-
} else {
495+
// FIXME: We can't currently leave upgrade mode automatically, since we don't know when an upgrade is finalized
496+
deployed_product_version: Some(
498497
hdfs.status
499498
.as_ref()
500-
.and_then(|status| status.deployed_product_version.clone())
501-
},
499+
.and_then(|status| status.deployed_product_version.as_deref())
500+
.unwrap_or(hdfs.spec.image.product_version())
501+
.to_string(),
502+
),
503+
// deployed_product_version: if deploy_done {
504+
// Some(hdfs.spec.image.product_version().to_string())
505+
// } else {
506+
// hdfs.status
507+
// .as_ref()
508+
// .and_then(|status| status.deployed_product_version.clone())
509+
// },
502510
};
503511

504512
// During upgrades we do partial deployments, we don't want to garbage collect after those

0 commit comments

Comments
 (0)