Skip to content
This repository has been archived by the owner on Jun 28, 2023. It is now read-only.

Commit

Permalink
add (infra-provider) credential detection for cluster deletion (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshrosso authored May 25, 2021
1 parent f63751b commit 8e5fa83
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
17 changes: 10 additions & 7 deletions cli/pkg/standalone-cluster/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ import (
)

type teardownStandaloneOptions struct {
force bool
skip bool
force bool
skip bool
configFile string
}

// DeleteCmd deletes a standalone workload cluster.
var DeleteCmd = &cobra.Command{
Use: "delete <cluster name>",
Use: "delete <cluster name> -f <config file>",
Short: "delete a standalone workload cluster",
PreRunE: func(cmd *cobra.Command, args []string) (err error) {
return nil
Expand All @@ -36,7 +37,8 @@ var DeleteCmd = &cobra.Command{
var tso = teardownStandaloneOptions{}

func init() {
DeleteCmd.Flags().BoolVarP(&tso.force, "force", "f", false, "Force delete")
DeleteCmd.Flags().StringVarP(&tso.configFile, "config", "f", "", "Cluster configuration file")
DeleteCmd.Flags().BoolVar(&tso.force, "force", false, "Force delete")
DeleteCmd.Flags().BoolVarP(&tso.skip, "yes", "y", false, "Delete workload cluster without asking for confirmation")
}

Expand Down Expand Up @@ -71,9 +73,10 @@ func teardown(cmd *cobra.Command, args []string) error {

// delete a new standlone cluster
teardownRegionOpts := tkgctl.DeleteRegionOptions{
ClusterName: clusterName,
Force: tso.force,
SkipPrompt: tso.skip,
ClusterName: clusterName,
Force: tso.force,
SkipPrompt: tso.skip,
ClusterConfig: tso.configFile,
}

err = c.DeleteStandalone(teardownRegionOpts)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ replace (
// github.com/vmware-tanzu-private/core => ../../vmware-tanzu-private/core
github.com/vmware-tanzu-private/core => github.com/vmware-tanzu-private/core v1.3.1-0.20210524231710-aaa4fe81d0e3
// github.com/vmware-tanzu-private/tanzu-cli-tkg-plugins => ../../vmware-tanzu-private/tanzu-cli-tkg-plugins
github.com/vmware-tanzu-private/tkg-cli => github.com/vmware-tanzu-private/tkg-cli v1.3.1-0.20210525051804-aecf8ddffda7
// github.com/vmware-tanzu-private/tkg-cli => ../../vmware-tanzu-private/tkg-cli
github.com/vmware-tanzu-private/tkg-cli => github.com/vmware-tanzu-private/tkg-cli v1.3.1-0.20210524231343-b0dd61093e8d
// github.com/vmware-tanzu-private/tkg-providers => ../../vmware-tanzu-private/tkg-providers
github.com/vmware-tanzu-private/tkg-providers => github.com/vmware-tanzu-private/tkg-providers v1.3.1-0.20210422215837-027482ef8765

Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,10 @@ github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYp
github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI=
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
github.com/vito/go-interact v0.0.0-20171111012221-fa338ed9e9ec/go.mod h1:wPlfmglZmRWMYv/qJy3P+fK/UnoQB5ISk4txfNd9tDo=
github.com/vmware-tanzu-private/core v1.3.1-0.20210524181536-6510d9ff7974 h1:yX8XKPIY0A/2FqGy4JzVSyabO7sj6jyOMotTAWNyjwo=
github.com/vmware-tanzu-private/core v1.3.1-0.20210524181536-6510d9ff7974/go.mod h1:w7vyUrDtTZWYIyxOG5DqQuNQLbo40lGqr99LPJfJnj8=
github.com/vmware-tanzu-private/tkg-cli v1.3.1-0.20210525051804-aecf8ddffda7 h1:6aaIGoW3QEMTarQIHmtRbEc5deRoZKJ80vIcC6KRx/8=
github.com/vmware-tanzu-private/tkg-cli v1.3.1-0.20210525051804-aecf8ddffda7/go.mod h1:o1RK/zC9s2WAcsIqhZWNDiJPmXg4SLBHkOlXG95A6Gs=
github.com/vmware-tanzu-private/core v1.3.1-0.20210524231710-aaa4fe81d0e3 h1:oKVJvWNUjrHVBaAF5sTv9GXEHDhsYVjRKIfbGqXRGRI=
github.com/vmware-tanzu-private/core v1.3.1-0.20210524231710-aaa4fe81d0e3/go.mod h1:bFSx4RPTeC/8ha6G/sIV6kWr0tpHgfShHVLI50YdRl4=
github.com/vmware-tanzu-private/tkg-cli v1.3.1-0.20210524231343-b0dd61093e8d h1:aHjP5bkCwIefZidMEzQjl+4q8y8zVi9f78aZE/+CJJQ=
Expand Down

0 comments on commit 8e5fa83

Please sign in to comment.