Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
amorey committed Nov 17, 2024
1 parent 491f081 commit cf44e71
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion dashboard-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@
"vite-tsconfig-paths": "^5.0.1",
"vitest": "^1.6.0"
},
"packageManager": "pnpm@9.12.2+sha512.22721b3a11f81661ae1ec68ce1a7b879425a1ca5b991c975b074ac220b187ce56c708fe5db69f4c962c989452eee76c82877f4ee80f474cebd61ee13461b6228"
"packageManager": "pnpm@9.13.2+sha512.88c9c3864450350e65a33587ab801acf946d7c814ed1134da4a924f6df5a2120fd36b46aab68f7cd1d413149112d53c7db3a4136624cfd00ff1846a0c6cef48a"
}
14 changes: 9 additions & 5 deletions modules/cli/cmd/cluster_uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ package cmd

import (
"fmt"
"log"

"github.com/spf13/cobra"

"github.com/kubetail-org/kubetail/modules/cli/internal/cli"
"github.com/kubetail-org/kubetail/modules/cli/internal/helm"
)

Expand All @@ -33,10 +33,14 @@ var clusterUninstallCmd = &cobra.Command{
Short: "Uninstall an existing release",
Long: clusterUninstallHelp,
Run: func(cmd *cobra.Command, args []string) {
response, err := helm.UninstallRelease()
if err != nil {
log.Fatal(err)
}
// Init client
client, err := helm.NewClient()
cli.ExitOnError(err)

// Uninstall
response, err := client.UninstallRelease()
cli.ExitOnError(err)

fmt.Printf("Deleted release '%s' in namespace '%s'\n", response.Release.Name, response.Release.Namespace)
},
}
Expand Down
14 changes: 14 additions & 0 deletions modules/cli/internal/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@ func (c *Client) UpgradeRelease() (*release.Release, error) {
return release, nil
}

// UninstallRelease uninstalls a release
func (c *Client) UninstallRelease() (*release.UninstallReleaseResponse, error) {
// Create uninstall action
uninstall := action.NewUninstall(c.actionConfig)

// Run uninstall
response, err := uninstall.Run(DefaultReleaseName)
if err != nil {
return nil, fmt.Errorf("failed to uninstall release %s: %w", DefaultReleaseName, err)
}

return response, nil
}

// ListReleases lists all releases across all namespaces.
func (c *Client) ListReleases() ([]*release.Release, error) {
list := action.NewList(c.actionConfig)
Expand Down

0 comments on commit cf44e71

Please sign in to comment.