Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(upgrade-job): set defaults for absent helm values #337

Merged
merged 1 commit into from
Sep 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion k8s/upgrade/src/bin/upgrade-job/helm/chart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pub(crate) struct CoreValues {
/// This is the yaml object which contains the configuration for the io-engine DaemonSet.
io_engine: IoEngine,
/// This toggles installation of eventing components.
#[serde(default)]
eventing: Eventing,
/// This contains Kubernetes CSI sidecar container image details.
csi: Csi,
Expand Down Expand Up @@ -111,8 +112,15 @@ impl IoEngine {

/// This is used to deserialize the yaml object 'eventing', v2.3.0 has it disabled by default,
/// the default thereafter has it enabled.
#[derive(Deserialize)]
#[derive(Deserialize, Default)]
pub(crate) struct Eventing {
// This value is defaulted to 'false' when 'Eventing' is absent in the yaml.
// This works fine because we don't use the serde deserialized values during
// the values.yaml merge. The merge is done with 'yq'. These are assumed values,
// in case the value is absent (usually due to added features). This is used
// to compare against new values (those bundled with the chart in the upgrade-job's
// local filesystem) and decide if a yq 'set' is required. This default is not a
// fallback value that is set in case the user's value's yaml is missing the value.
enabled: bool,
}

Expand Down Expand Up @@ -161,7 +169,9 @@ impl Csi {
pub(crate) struct CsiImage {
provisioner_tag: String,
attacher_tag: String,
#[serde(default)]
snapshotter_tag: String,
#[serde(default)]
snapshot_controller_tag: String,
registrar_tag: String,
}
Expand Down