Skip to content

Commit

Permalink
chore(bors): merge pull request #604
Browse files Browse the repository at this point in the history
604: Upgrade changes for v2.7.3 r=niladrih a=niladrih



Co-authored-by: Niladri Halder <[email protected]>
  • Loading branch information
mayastor-bors and niladrih committed Jan 23, 2025
2 parents 1f4f1ed + 5725d9a commit c139bcc
Show file tree
Hide file tree
Showing 4 changed files with 338 additions and 62 deletions.
5 changes: 4 additions & 1 deletion k8s/upgrade/src/common/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,7 @@ pub(crate) const TWO_DOT_FIVE: &str = "2.5.0";
pub(crate) const TWO_DOT_SIX: &str = "2.6.0";

/// Version value for 2.7.2 release.
pub(crate) const TWO_DOT_SEVENT_DOT_TWO: &str = "2.7.2";
pub(crate) const TWO_DOT_SEVEN_DOT_TWO: &str = "2.7.2";

/// Version value for 2.7.3.
pub(crate) const TWO_DOT_SEVEN_DOT_THREE: &str = "2.7.3";
41 changes: 41 additions & 0 deletions k8s/upgrade/src/common/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,47 @@ pub enum Error {
object: String,
},

/// Error in serializing base.initContainers.containers.
#[snafu(display("Failed to serialize .base.initContainers.containers {object:?}: {source}",))]
SerializeBaseInitContainersToJson {
source: serde_json::Error,
object: Container,
},

/// Error in serializing base.initCoreContainers.containers.
#[snafu(display(
"Failed to serialize .base.initCoreContainers.containers {object:?}: {source}",
))]
SerializeBaseInitCoreContainersToJson {
source: serde_json::Error,
object: Container,
},

/// Error in serializing base.initHaNodeContainers.containers.
#[snafu(display(
"Failed to serialize .base.initHaNodeContainers.containers {object:?}: {source}",
))]
SerializeBaseInitHaNodeContainersToJson {
source: serde_json::Error,
object: Container,
},

/// Error in serializing base.initRestContainer.initContainer.
#[snafu(display(
"Failed to serialize .base.initRestContainer.initContainer {object:?}: {source}",
))]
SerializeBaseInitRestContainerToJson {
source: serde_json::Error,
object: Container,
},

/// Error in serializing base.jaeger.agent.initContainers.
#[snafu(display("Failed to serialize .base.jaeger.agent.initContainer {object:?}: {source}",))]
SerializeJaegerAgentInitContainerToJson {
source: serde_json::Error,
object: Container,
},

/// Error for when there are too many io-engine Pods in one single node;
#[snafu(display("Too many io-engine Pods in Node '{node_name}'"))]
TooManyIoEnginePods { node_name: String },
Expand Down
137 changes: 110 additions & 27 deletions k8s/upgrade/src/helm/chart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,6 @@ impl CoreValues {
self.loki_stack.grafana_sidecar_image_tag()
}

/// This is a getter for the localpv-provisioner sub-chart's release version.
pub(crate) fn localpv_release_version(&self) -> &str {
self.localpv_provisioner.release_version()
}

/// This is a getter for the container image tag of the hostpath localpv provisioner.
pub(crate) fn localpv_provisioner_image_tag(&self) -> &str {
self.localpv_provisioner.provisioner_image_tag()
Expand Down Expand Up @@ -299,6 +294,31 @@ impl CoreValues {
self.base.deprecated_log_silence_level()
}

/// This is the array of containers associated with core initContainers.
pub(crate) fn base_init_core_containers(&self) -> &[Container] {
self.base.init_core_containers()
}

/// This is the array of containers associated with ha node initContainers.
pub(crate) fn base_init_ha_node_containers(&self) -> &[Container] {
self.base.init_ha_node_containers()
}

/// This is the array of containers associated with rest api initContainer.
pub(crate) fn base_init_rest_container(&self) -> &[Container] {
self.base.init_rest_container()
}

/// This is the array of containers associated with default initContainers.
pub(crate) fn base_init_containers(&self) -> &[Container] {
self.base.init_containers()
}

/// This is the array of containers associated with jaeger agent initContainers.
pub(crate) fn base_jaeger_agent_init_container(&self) -> &[Container] {
self.base.jaeger_agent_init_container()
}

/// Retrieves the image tag of the Jaeger operator.
/// Useful when updating the Jaeger operator dependency chart to ensure the new chart uses the
/// updated image tag.
Expand Down Expand Up @@ -328,17 +348,75 @@ impl Agents {

/// This is used to deserialize the yaml object base.
#[derive(Deserialize)]
#[serde(rename_all(deserialize = "camelCase"))]
struct Base {
/// This is the older helm value.yaml key for configuring log silence level.
#[serde(default, rename(deserialize = "logSilenceLevel"))]
deprecated_log_silence_level: String,
init_containers: GenericContainers,
init_core_containers: GenericContainers,
init_ha_node_containers: GenericContainers,
init_rest_container: InitRestContainer,
jaeger: Jaeger,
}

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 returns the array of kubernetes initContainer objects.
fn init_containers(&self) -> &[Container] {
self.init_containers.containers()
}

/// This returns the array of kubernetes initContainer objects for core.
fn init_core_containers(&self) -> &[Container] {
self.init_core_containers.containers()
}

/// This returns the array of kubernetes initContainer objects for ha node.
fn init_ha_node_containers(&self) -> &[Container] {
self.init_ha_node_containers.containers()
}

/// This returns the array of kubernetes initContainer objects for rest.
fn init_rest_container(&self) -> &[Container] {
self.init_rest_container.init_container()
}

/// This returns the array of kubernetes initContainer objects for jaeger agent.
fn jaeger_agent_init_container(&self) -> &[Container] {
self.jaeger.agent_init_container()
}
}

/// This is used to deserialize the .base.initRestContainer object.
#[derive(Deserialize)]
#[serde(rename_all(deserialize = "camelCase"))]
struct InitRestContainer {
init_container: Vec<Container>,
}

impl InitRestContainer {
fn init_container(&self) -> &[Container] {
self.init_container.as_slice()
}
}

/// This is used to deserialize various 'containers' yaml objects.
#[derive(Deserialize)]
struct GenericContainers {
/// Container config.
containers: Vec<Container>,
}

impl GenericContainers {
/// Returns container config.
fn containers(&self) -> &[Container] {
self.containers.as_slice()
}
}

/// This is used to deserialize the yaml object 'agents.core'.
Expand Down Expand Up @@ -1063,17 +1141,11 @@ impl PromtailConfigClient {
#[derive(Default, Deserialize)]
#[serde(default, rename_all(deserialize = "camelCase"))]
struct LocalpvProvisioner {
release: LocalpvProvisionerRelease,
localpv: LocalpvProvisionerLocalpv,
helper_pod: LocalpvProvisionerHelperPod,
}

impl LocalpvProvisioner {
/// This is a getter for the localpv-provisioner helm chart's release version.
fn release_version(&self) -> &str {
self.release.version()
}

/// This is a getter for the container image tag of the provisioner-localpv container.
fn provisioner_image_tag(&self) -> &str {
self.localpv.image_tag()
Expand All @@ -1085,22 +1157,6 @@ impl LocalpvProvisioner {
}
}

/// This is used to deserialize the 'release.version' yaml object in the localpv-provisioner helm
/// chart.
#[derive(Default, Deserialize)]
struct LocalpvProvisionerRelease {
#[serde(default)]
version: String,
}

impl LocalpvProvisionerRelease {
/// This is a getter for the release version for the localpv-provisioner helm chart.
/// This value is set as the value of the 'openebs.io/version' label.
fn version(&self) -> &str {
self.version.as_str()
}
}

/// This is used to deserialize the 'localpv' yaml object in the localpv-provisioner helm chart.
#[derive(Default, Deserialize)]
struct LocalpvProvisionerLocalpv {
Expand Down Expand Up @@ -1144,6 +1200,33 @@ impl LocalpvProvisionerHelperPod {
}
}

/// This is used to deserialize the '.jaeger' yaml object.
#[derive(Deserialize)]
struct Jaeger {
agent: JaegerAgent,
}

impl Jaeger {
/// This returns the init containers from the base jaeger agent.
fn agent_init_container(&self) -> &[Container] {
self.agent.init_container()
}
}

/// This is used to deserialize the '.jaeger.agent' yaml object.
#[derive(Deserialize)]
#[serde(rename_all(deserialize = "camelCase"))]
struct JaegerAgent {
init_container: Vec<Container>,
}

impl JaegerAgent {
/// This returns the init containers from the base jaeger agent.
fn init_container(&self) -> &[Container] {
self.init_container.as_slice()
}
}

/// This is used to deserialize the '.jaeger-operator' yaml object.
#[derive(Default, Deserialize)]
struct JaegerOperator {
Expand Down
Loading

0 comments on commit c139bcc

Please sign in to comment.