Skip to content

Commit d4ddda4

Browse files
swebxeniape
andauthored
feat(stackablectl): check for namespace before attempting uninstall (#442)
* feat(stackablectl): check for namespace before attempting uninstall * chore: extend changelog * Update rust/stackablectl/CHANGELOG.md Co-authored-by: Xenia <xenia.fischer@stackable.tech> --------- Co-authored-by: Xenia <xenia.fischer@stackable.tech>
1 parent 42b93d8 commit d4ddda4

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

rust/stackablectl/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,14 @@ All notable changes to this project will be documented in this file.
1212
- Add `--assume-yes` option for running commands non-interactively ([#429]).
1313
- Support Helm charts sourced from OCI registries in demo/stack manifests ([#440]).
1414

15+
### Changed
16+
17+
- Abort early if `uninstall` is issued for `default` namespace ([#442]).
18+
1519
[#429]: https://github.com/stackabletech/stackable-cockpit/pull/429
1620
[#438]: https://github.com/stackabletech/stackable-cockpit/pull/438
1721
[#440]: https://github.com/stackabletech/stackable-cockpit/pull/440
22+
[#442]: https://github.com/stackabletech/stackable-cockpit/pull/442
1823

1924
## [1.4.0] - 2026-03-18
2025

rust/stackablectl/src/cmds/demo.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ pub enum CmdError {
183183
demo_name: String,
184184
},
185185

186+
#[snafu(display(
187+
"demo {demo_name:?} cannot be uninstalled from the {DEFAULT_NAMESPACE:?} namespace, because Kubernetes does not allow deleting it. Pass --namespace <NAMESPACE> if the demo was installed in a different namespace, or delete the demo's resources manually"
188+
))]
189+
UninstallFromDefaultNamespace { demo_name: String },
190+
186191
#[snafu(display("failed to build labels for demo resources"))]
187192
BuildLabels { source: LabelError },
188193

@@ -525,6 +530,13 @@ async fn uninstall_cmd(
525530
// Init result output and progress output
526531
let mut output = Cli::result();
527532

533+
ensure!(
534+
args.namespaces.namespace != DEFAULT_NAMESPACE,
535+
UninstallFromDefaultNamespaceSnafu {
536+
demo_name: args.demo_name.clone(),
537+
}
538+
);
539+
528540
let proceed_with_uninstall = args.prompt_args.assume_yes
529541
|| {
530542
tracing_indicatif::suspend_tracing_indicatif(|| -> Result<bool, CmdError> {

rust/stackablectl/src/cmds/stack.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ pub enum CmdError {
178178
stack_name: String,
179179
},
180180

181+
#[snafu(display(
182+
"stack {stack_name:?} cannot be uninstalled from the {DEFAULT_NAMESPACE:?} namespace, because Kubernetes does not allow deleting it. Pass --namespace <NAMESPACE> if the stack was installed in a different namespace, or delete the stack's resources manually"
183+
))]
184+
UninstallFromDefaultNamespace { stack_name: String },
185+
181186
#[snafu(display("failed to build labels for stack resources"))]
182187
BuildLabels { source: LabelError },
183188

@@ -496,6 +501,13 @@ async fn uninstall_cmd(
496501
) -> Result<String, CmdError> {
497502
let mut output = Cli::result();
498503

504+
ensure!(
505+
args.namespaces.namespace != DEFAULT_NAMESPACE,
506+
UninstallFromDefaultNamespaceSnafu {
507+
stack_name: args.stack_name.clone(),
508+
}
509+
);
510+
499511
let proceed_with_uninstall = args.prompt_args.assume_yes
500512
|| tracing_indicatif::suspend_tracing_indicatif(|| -> Result<bool, CmdError> {
501513
Confirm::new()

0 commit comments

Comments
 (0)