diff --git a/k8s/upgrade-job/src/common/constants.rs b/k8s/upgrade-job/src/common/constants.rs index ee7489862..588b90eaf 100644 --- a/k8s/upgrade-job/src/common/constants.rs +++ b/k8s/upgrade-job/src/common/constants.rs @@ -27,5 +27,5 @@ pub(crate) const TO_UMBRELLA_SEMVER: &str = "3.7.0"; pub(crate) const UMBRELLA_CHART_UPGRADE_DOCS_URL: &str = "https://openebs.io/docs/user-guides/upgrade#mayastor-upgrade"; -/// This defines the range of helm chart versions for the 2.1 release of the Core helm chart. -pub(crate) const TWO_DOT_ONE: &str = ">=2.1.0-rc.0, <=2.1.0"; +/// This defines the range of helm chart versions for the 2.0 release of the Core helm chart. +pub(crate) const TWO_DOT_O: &str = ">=2.0.0-rc.0, <2.1.0"; diff --git a/k8s/upgrade-job/src/helm/upgrade.rs b/k8s/upgrade-job/src/helm/upgrade.rs index a6bbfa160..25b137872 100644 --- a/k8s/upgrade-job/src/helm/upgrade.rs +++ b/k8s/upgrade-job/src/helm/upgrade.rs @@ -105,15 +105,6 @@ impl HelmUpgradeBuilder { let chart_yaml_path = chart_dir.join("Chart.yaml"); let to_version: Version = upgrade::path::version_from_chart_yaml_file(chart_yaml_path)?; - // Basic validation. - // Rollbacks not supported. - ensure!( - to_version.ge(&from_version), - RollbackForbidden { - from_version: from_version.to_string(), - to_version: to_version.to_string() - } - ); // Check if already upgraded. let already_upgraded = to_version.eq(&from_version); @@ -148,6 +139,15 @@ impl HelmUpgradeBuilder { // Skip upgrade-path validation and allow all upgrades for the Core helm chart, if the // flag is set. if !self.skip_upgrade_path_validation { + // Rollbacks not supported. + ensure!( + to_version.ge(&from_version), + RollbackForbidden { + from_version: from_version.to_string(), + to_version: to_version.to_string() + } + ); + let upgrade_path_is_valid = upgrade::path::is_valid_for_core_chart(&from_version)?; ensure!(upgrade_path_is_valid, InvalidUpgradePath); } diff --git a/k8s/upgrade-job/src/helm/values.rs b/k8s/upgrade-job/src/helm/values.rs index 8f98ca534..ddfd21c8b 100644 --- a/k8s/upgrade-job/src/helm/values.rs +++ b/k8s/upgrade-job/src/helm/values.rs @@ -1,6 +1,6 @@ use crate::{ common::{ - constants::TWO_DOT_ONE, + constants::TWO_DOT_O, error::{ OpeningFile, Result, SemverParse, U8VectorToString, YamlParseFromFile, YamlParseFromSlice, @@ -41,10 +41,10 @@ pub(crate) fn generate_values_args( // use from installed-release's values, if present, else use defaults from to-chart. let mut upgrade_args: Vec = Vec::with_capacity(18); - let version_two_dot_one = VersionReq::parse(TWO_DOT_ONE).context(SemverParse { - version_string: TWO_DOT_ONE.to_string(), + let version_two_dot_o = VersionReq::parse(TWO_DOT_O).context(SemverParse { + version_string: TWO_DOT_O.to_string(), })?; - if version_two_dot_one.matches(from_version) { + if version_two_dot_o.matches(from_version) { let io_engine_key = "io_engine"; let log_level_key = "logLevel"; let log_level_to_replace = "info,io_engine=info";