Skip to main content

helm_rs/command/release/
upgrade.rs

1use super::shared::release_command;
2use super::{ServerSide, ValuesMode};
3use crate::backend::Command;
4use crate::command::ChartRef;
5use crate::release::Release;
6
7release_command! {
8    /// `helm upgrade -o json` (`pkg/cmd/upgrade.go`, `pkg/action/upgrade.go`): upgrades a release to a
9    /// chart and returns the release Helm recorded. With `install`, a missing or uninstalled release
10    /// is installed instead and the same JSON comes back.
11    Upgrade, UpgradeBuilder, upgrade_builder {
12        required {
13            /// The `RELEASE` argument.
14            release: String,
15        }
16        collections {}
17        flags {
18            /// Flag `--cleanup-on-fail`: delete the resources this upgrade created if it fails.
19            cleanup_on_fail: bool,
20            /// Flag `--hide-notes`: leave the notes out of the output.
21            hide_notes: bool,
22            /// Flag `--hide-secret`: hide Secrets in a dry-run (Helm requires a dry-run mode with it).
23            hide_secret: bool,
24            /// Flag `--history-max`: how many revisions to keep; 0 keeps all (Helm's default is 10).
25            history_max: Option<u32>,
26            /// Flag `--install`: install when the release does not exist.
27            install: bool,
28            /// Flag `--render-subchart-notes`: include the subcharts' notes.
29            render_subchart_notes: bool,
30            /// Flags `--reset-values`, `--reuse-values` and `--reset-then-reuse-values`.
31            values_mode: Option<ValuesMode>,
32            /// Flag `--server-side` (Helm's default is `auto`).
33            server_side: Option<ServerSide>,
34        }
35    }
36}
37
38impl Upgrade {
39    /// An upgrade of `release` to `chart` with every other setting left to Helm.
40    #[must_use]
41    pub fn new(release: impl Into<String>, chart: ChartRef) -> Self {
42        Self::builder(release, chart).build()
43    }
44}
45
46impl Command for Upgrade {
47    type Output = Release;
48}