@@ -27,6 +27,7 @@ import (
27
27
"sync"
28
28
"time"
29
29
30
+ kubeutil "github.com/codefresh-io/cli-v2/pkg/util/kube"
30
31
routingutil "github.com/codefresh-io/cli-v2/pkg/util/routing"
31
32
32
33
"github.com/codefresh-io/cli-v2/pkg/log"
@@ -500,6 +501,7 @@ func runRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) err
500
501
501
502
// check whether the runtime exists
502
503
var err error
504
+
503
505
if ! opts .SkipChecks {
504
506
_ , err = getRuntime (ctx , opts .RuntimeName )
505
507
}
@@ -575,12 +577,33 @@ func runRuntimeUninstall(ctx context.Context, opts *RuntimeUninstallOptions) err
575
577
cfConfig .GetCurrentContext ().DefaultRuntime = ""
576
578
}
577
579
580
+ err = runPostUninstallCleanup (ctx , opts .KubeFactory , opts .RuntimeName )
581
+ if err != nil {
582
+ return fmt .Errorf ("failed to do post uninstall cleanup: %w" , err )
583
+ }
584
+
578
585
uninstallDoneStr := fmt .Sprintf ("Done uninstalling runtime \" %s\" " , opts .RuntimeName )
579
586
appendLogToSummary (uninstallDoneStr , nil )
580
587
581
588
return nil
582
589
}
583
590
591
+ func runPostUninstallCleanup (ctx context.Context , kubeFactory kube.Factory , namespace string ) error {
592
+ secrets , err := kubeutil .GetSecretsWithLabel (ctx , kubeFactory , namespace , store .Get ().LabelSelectorSealedSecret )
593
+ if err != nil {
594
+ return err
595
+ }
596
+
597
+ for _ , secret := range secrets .Items {
598
+ err = kubeutil .DeleteSecretWithFinalizer (ctx , kubeFactory , & secret )
599
+ if err != nil {
600
+ log .G ().Warn ("failed to delete secret: %w" , err )
601
+ }
602
+ }
603
+
604
+ return nil
605
+ }
606
+
584
607
func printApplicationsState (ctx context.Context , runtime string , f kube.Factory , managed bool ) error {
585
608
if managed {
586
609
return nil
0 commit comments