This repository has been archived by the owner on Sep 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from mumoshu/kube-aws-node-pools-destroy-cmd
Add `kube-aws node-pools destroy` command
- Loading branch information
Showing
5 changed files
with
63 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package nodepool | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/coreos/kube-aws/nodepool/cluster" | ||
"github.com/coreos/kube-aws/nodepool/config" | ||
) | ||
|
||
var ( | ||
cmdDestroy = &cobra.Command{ | ||
Use: "destroy", | ||
Short: "Destroy an existing node pool", | ||
Long: ``, | ||
RunE: runCmdDestroy, | ||
SilenceUsage: true, | ||
} | ||
destroyOpts = struct { | ||
awsDebug bool | ||
}{} | ||
) | ||
|
||
func init() { | ||
NodePoolCmd.AddCommand(cmdDestroy) | ||
cmdDestroy.Flags().BoolVar(&destroyOpts.awsDebug, "aws-debug", false, "Log debug information from aws-sdk-go library") | ||
} | ||
|
||
func runCmdDestroy(cmd *cobra.Command, args []string) error { | ||
cfg, err := config.ClusterFromFile(nodePoolClusterConfigFilePath()) | ||
if err != nil { | ||
return fmt.Errorf("Error parsing node pool config: %v", err) | ||
} | ||
|
||
c := cluster.New(cfg, destroyOpts.awsDebug) | ||
if err := c.Destroy(); err != nil { | ||
return fmt.Errorf("Failed destroying node pool: %v", err) | ||
} | ||
|
||
fmt.Println("CloudFormation stack is being destroyed. This will take several minutes") | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters