From ba2b70b41793eb2dbdd5856b658051f52767da9b Mon Sep 17 00:00:00 2001 From: Niladri Halder Date: Mon, 6 Jan 2025 17:43:41 +0000 Subject: [PATCH] fix(upgrade): remove etcd.initialClusterState from helm values Fixes https://github.com/openebs/mayastor/issues/1735 This removes the helm value for the key etcd.initialClusterState for all versions greater than or equal to 2.0.0-rc.0 and less than 2.7.3. Signed-off-by: Niladri Halder --- k8s/upgrade/src/common/constants.rs | 3 +++ k8s/upgrade/src/helm/values.rs | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/k8s/upgrade/src/common/constants.rs b/k8s/upgrade/src/common/constants.rs index 5327f0efe..096ae0900 100644 --- a/k8s/upgrade/src/common/constants.rs +++ b/k8s/upgrade/src/common/constants.rs @@ -57,3 +57,6 @@ pub(crate) const TWO_DOT_SIX: &str = "2.6.0"; /// Version value for 2.7.2 release. pub(crate) const TWO_DOT_SEVEN_DOT_TWO: &str = "2.7.2"; + +/// Version value for 2.7.2 release. +pub(crate) const TWO_DOT_SEVEN_DOT_THREE: &str = "2.7.3"; diff --git a/k8s/upgrade/src/helm/values.rs b/k8s/upgrade/src/helm/values.rs index 2b0cf4de2..e97024998 100644 --- a/k8s/upgrade/src/helm/values.rs +++ b/k8s/upgrade/src/helm/values.rs @@ -2,7 +2,7 @@ use crate::{ common::{ constants::{ KUBE_API_PAGE_SIZE, TWO_DOT_FIVE, TWO_DOT_FOUR, TWO_DOT_ONE, TWO_DOT_O_RC_ONE, - TWO_DOT_SEVEN_DOT_TWO, TWO_DOT_SIX, TWO_DOT_THREE, + TWO_DOT_SEVEN_DOT_THREE, TWO_DOT_SEVEN_DOT_TWO, TWO_DOT_SIX, TWO_DOT_THREE, }, error::{ DeserializePromtailExtraConfig, ListCrds, Result, SemverParse, @@ -383,6 +383,17 @@ where )?; } + // Special-case values for 2.7.3. + let two_dot_seven_dot_three = Version::parse(TWO_DOT_SEVEN_DOT_THREE).context(SemverParse { + version_string: TWO_DOT_SEVEN_DOT_THREE.to_string(), + })?; + if source_version.ge(&two_dot_o_rc_zero) && source_version.lt(&two_dot_seven_dot_three) { + yq.delete_object( + YamlKey::try_from(".etcd.initialClusterState")?, + upgrade_values_file.path(), + )?; + } + // Default options. // Image tag is set because the high_priority file is the user's source options file. // The target's image tag needs to be set for PRODUCT upgrade.