Skip to content

Commit

Permalink
Feat/new sealer ipv6 dual (sealerio#1804)
Browse files Browse the repository at this point in the history
* Support ipv6 dual stack.

* bugfix: image save use ociv1 format

* fix lint

support sealer delete -f clusterfile flag

modify
  • Loading branch information
VinceCui authored and Stevent-fei committed Oct 28, 2022
1 parent f21cbb8 commit 0f4a586
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions cmd/sealer/cmd/cluster/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ import (
)

var (
deleteFlags *types.Flags
deleteAll bool
ForceDelete bool
deleteFlags *types.Flags
deleteClusterFile string
deleteAll bool
ForceDelete bool
)

var longDeleteCmdDescription = `delete command is used to delete part or all of existing cluster.
Expand Down Expand Up @@ -69,14 +70,12 @@ func NewDeleteCmd() *cobra.Command {
mastersToDelete = deleteFlags.Masters
workersToDelete = deleteFlags.Nodes
)

if mastersToDelete == "" && workersToDelete == "" && !deleteAll {
workClusterfile := common.GetDefaultClusterfile()
if mastersToDelete == "" && workersToDelete == "" && !deleteAll && deleteClusterFile == "" {
return fmt.Errorf("you must input node ip Or set flag -a")
}

workClusterfile := common.GetDefaultClusterfile()
if deleteAll {
return deleteCluster(workClusterfile)
if deleteClusterFile != "" {
return deleteCluster(deleteClusterFile)
}
return scaleDownCluster(mastersToDelete, workersToDelete, workClusterfile)
},
Expand All @@ -85,9 +84,10 @@ func NewDeleteCmd() *cobra.Command {
deleteFlags = &types.Flags{}
deleteCmd.Flags().StringVarP(&deleteFlags.Masters, "masters", "m", "", "reduce Count or IPList to masters")
deleteCmd.Flags().StringVarP(&deleteFlags.Nodes, "nodes", "n", "", "reduce Count or IPList to nodes")
deleteCmd.Flags().StringVarP(&deleteClusterFile, "Clusterfile", "f", "Clusterfile", "delete a kubernetes cluster with Clusterfile")
deleteCmd.Flags().StringSliceVarP(&deleteFlags.CustomEnv, "env", "e", []string{}, "set custom environment variables")
deleteCmd.Flags().BoolVarP(&ForceDelete, "force", "f", false, "We also can input an --force flag to delete cluster by force")
deleteCmd.Flags().BoolVarP(&deleteAll, "all", "a", false, "this flags is for delete the entire cluster, default is false")
deleteCmd.Flags().BoolVarP(&ForceDelete, "force", "", false, "We also can input an --force flag to delete cluster by force")
deleteCmd.Flags().BoolVar(&deleteAll, "a", false, "this flags is for delete the entire cluster, default is false")
deleteCmd.Flags().BoolVarP(&imagedistributor.IsPrune, "prune", "p", true, "this flags is for delete all cluster rootfs, default is true")

return deleteCmd
Expand Down

0 comments on commit 0f4a586

Please sign in to comment.