diff --git a/k8s/upgrade/src/bin/upgrade-job/helm/chart.rs b/k8s/upgrade/src/bin/upgrade-job/helm/chart.rs index 0e567b23e..8a90faf74 100644 --- a/k8s/upgrade/src/bin/upgrade-job/helm/chart.rs +++ b/k8s/upgrade/src/bin/upgrade-job/helm/chart.rs @@ -61,8 +61,10 @@ impl HelmValuesCollection for UmbrellaValues { /// This is used to deserialize the values.yaml of the Core chart. #[derive(Deserialize)] pub(crate) struct CoreValues { - /// This contains values for all of the agents. + /// This contains values for all the agents. agents: Agents, + /// This contains values for all the base components. + base: Base, /// This is the yaml object which contains values for the container image registry, repository, /// tag, etc. image: Image, @@ -182,6 +184,11 @@ impl CoreValues { self.csi.node_nvme_io_timeout() } + /// This returns the value of the removed key for CSI socket mount path. + pub(crate) fn deprecated_node_csi_mount_path(&self) -> &str { + self.csi.deprecated_node_csi_mount_path() + } + /// This is a getter for the grafana/loki container image tag. pub(crate) fn loki_stack_loki_image_tag(&self) -> &str { self.loki_stack.loki_image_tag() @@ -298,6 +305,11 @@ impl CoreValues { pub(crate) fn prometheus_server_image_tag(&self) -> &str { self.loki_stack.prometheus_server_image_tag() } + + /// This is the value of the deprecated key for log silence configuration. + pub(crate) fn deprecated_log_silence_level(&self) -> &str { + self.base.deprecated_log_silence_level() + } } /// This is used to deserialize the yaml object agents. @@ -313,6 +325,20 @@ impl Agents { } } +/// This is used to deserialize the yaml object base. +#[derive(Deserialize)] +struct Base { + #[serde(default, rename(deserialize = "logSilenceLevel"))] + deprecated_log_silence_level: String, +} + +impl Base { + /// This returns the value for the removed base.logSilenceLevel YAML key. + fn deprecated_log_silence_level(&self) -> &str { + self.deprecated_log_silence_level.as_str() + } +} + /// This is used to deserialize the yaml object 'agents.ha'. #[derive(Deserialize)] struct Ha { @@ -475,6 +501,11 @@ impl Csi { fn node_nvme_io_timeout(&self) -> &str { self.node.nvme_io_timeout() } + + /// This returns the mount path value's key, the old one with the typo. + fn deprecated_node_csi_mount_path(&self) -> &str { + self.node.deprecated_plugin_mount_path() + } } /// This contains the image tags for the CSI sidecar containers. @@ -534,6 +565,8 @@ impl CsiImage { #[derive(Deserialize)] struct CsiNode { nvme: CsiNodeNvme, + #[serde(default, rename(deserialize = "pluginMounthPath"))] + deprecated_plugin_mount_path: String, } impl CsiNode { @@ -541,6 +574,11 @@ impl CsiNode { fn nvme_io_timeout(&self) -> &str { self.nvme.io_timeout() } + + /// This returns the csi node mount path key's value. The key had a typo, it's been removed. + fn deprecated_plugin_mount_path(&self) -> &str { + self.deprecated_plugin_mount_path.as_str() + } } /// This is used to deserialize the yaml object 'csi.node.nvme'. diff --git a/k8s/upgrade/src/bin/upgrade-job/helm/values.rs b/k8s/upgrade/src/bin/upgrade-job/helm/values.rs index 895d08c31..0f83767ed 100644 --- a/k8s/upgrade/src/bin/upgrade-job/helm/values.rs +++ b/k8s/upgrade/src/bin/upgrade-job/helm/values.rs @@ -264,13 +264,7 @@ where upgrade_values_file.path(), )?; } - } - // Special-case values for 2.6.x. - let two_dot_six = Version::parse(TWO_DOT_SIX).context(SemverParse { - version_string: TWO_DOT_SIX.to_string(), - })?; - if source_version.ge(&two_dot_o_rc_zero) && source_version.lt(&two_dot_six) { // Switch out image tag for the latest one. yq.set_literal_value( YamlKey::try_from(".loki-stack.loki.image.tag")?, @@ -361,6 +355,30 @@ where target_values.promtail_readiness_probe_http_get_path(), upgrade_values_file.path(), )?; + + // This helm value key was changed: + // Ref: https://github.com/openebs/mayastor-extensions/pull/419 + yq.set_literal_value( + YamlKey::try_from(".base.logging.silenceLevel")?, + source_values.deprecated_log_silence_level(), + upgrade_values_file.path(), + )?; + yq.delete_object( + YamlKey::try_from(".base.logSilenceLevel")?, + upgrade_values_file.path(), + )?; + + // This is a fix for a typo in the .csi.node.pluginMounthPath key. + // It was fixed, and the key now is called .csi.node.pluginMountPath. + yq.set_literal_value( + YamlKey::try_from(".csi.node.pluginMountPath")?, + source_values.deprecated_node_csi_mount_path(), + upgrade_values_file.path(), + )?; + yq.delete_object( + YamlKey::try_from(".csi.node.pluginMounthPath")?, + upgrade_values_file.path(), + )?; } // Default options.