Skip to content

Commit

Permalink
feat(cmd/k8s/delete_pods/delete_pods): Add --force param
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejsika committed Jul 28, 2023
1 parent c233fd0 commit 39c8a3b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cmd/k8s/delete_pods/delete_pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,24 @@ import (
"github.com/spf13/cobra"
)

var FlagForce bool

var Cmd = &cobra.Command{
Use: "delete-pods",
Short: "Delete \"not ready\" pods in all namespaces",
Args: cobra.NoArgs,
Run: func(c *cobra.Command, args []string) {
clientset, _, _ := k8s.KubernetesClient()
k8s.DeleteNoReadyPods(clientset, false)
k8s.DeleteNoReadyPods(clientset, FlagForce)
},
}

func init() {
k8s_cmd.Cmd.AddCommand(Cmd)
Cmd.Flags().BoolVar(
&FlagForce,
"force",
false,
"Force delete pods (set grace period to 0)",
)
}

0 comments on commit 39c8a3b

Please sign in to comment.