Skip to content

Commit

Permalink
Merge pull request #16 from konstructio/add-jobs
Browse files Browse the repository at this point in the history
create k8s resources from init plus cleanup
  • Loading branch information
jarededwards authored Nov 20, 2024
2 parents d5dffb3 + 67c87d3 commit 6011a18
Show file tree
Hide file tree
Showing 18 changed files with 463 additions and 382 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,4 @@ go.work.sum
tmp/
dist/
.vscode
./templates
colony.yaml
colony.yaml.tmpl
vendor/
15 changes: 7 additions & 8 deletions cmd/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,30 @@ func getDestroyCommand() *cobra.Command {
ctx := cmd.Context()
log := logger.New(logger.Debug)

homeDir, err := os.UserHomeDir()
if err != nil {
return fmt.Errorf("error getting user home directory: %w", err)
}

log.Info("creating docker client")
dockerCLI, err := docker.New(log)
if err != nil {
return fmt.Errorf("error creating docker client: %w", err)
}
defer dockerCLI.Close()

pwd, err := os.Getwd()
if err != nil {
return fmt.Errorf("error getting current working directory: %w", err)
}

err = dockerCLI.RemoveColonyK3sContainer(ctx)
if err != nil {
return fmt.Errorf("error: failed to remove colony container %w", err)
}

err = exec.DeleteFile(filepath.Join(pwd, constants.KubeconfigHostPath))
err = exec.DeleteDirectory(filepath.Join(homeDir, constants.ColonyDir))
if err != nil {
return fmt.Errorf("error: failed to delete kubeconfig file %w", err)
}

//! templates directory is not removed
log.Info("colony installation removed successfully")

log.Info("colony installation removed from host")
return nil
},
}
Expand Down
Loading

0 comments on commit 6011a18

Please sign in to comment.