Skip to content

Commit

Permalink
fix: fix k3d destroy func (#1623)
Browse files Browse the repository at this point in the history
  • Loading branch information
echoboomer authored Jun 15, 2023
1 parent eb5175d commit ce56faf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/k3d/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,15 @@ func destroyK3d(cmd *cobra.Command, args []string) error {
}
}

if viper.GetBool("kubefirst-checks.terraform-apply-k3d") || viper.GetBool("kubefirst-checks.terraform-apply-k3d-failed") {
if viper.GetBool("kubefirst-checks.create-k3d-cluster") || viper.GetBool("kubefirst-checks.create-k3d-cluster-failed") {
log.Info().Msg("destroying k3d resources with terraform")

err := k3d.DeleteK3dCluster(clusterName, config.K1Dir, config.K3dClient)
if err != nil {
return err
}

viper.Set("kubefirst-checks.terraform-apply-k3d", false)
viper.Set("kubefirst-checks.create-k3d-cluster", false)
viper.WriteConfig()
log.Info().Msg("k3d resources terraform destroyed")
progressPrinter.IncrementTracker("platform-destroy", 1)
Expand All @@ -223,7 +223,7 @@ func destroyK3d(cmd *cobra.Command, args []string) error {
}

//* remove local content and kubefirst config file for re-execution
if !viper.GetBool(fmt.Sprintf("kubefirst-checks.terraform-apply-%s", gitProvider)) && !viper.GetBool("kubefirst-checks.terraform-apply-k3d") {
if !viper.GetBool(fmt.Sprintf("kubefirst-checks.terraform-apply-%s", gitProvider)) && !viper.GetBool("kubefirst-checks.create-k3d-cluster") {
log.Info().Msg("removing previous platform content")

err := pkg.ResetK1Dir(config.K1Dir)
Expand Down

0 comments on commit ce56faf

Please sign in to comment.