From ab7b07c1df18a3244b1c4886383eca0e0403860f Mon Sep 17 00:00:00 2001
From: Deshi Xiao <xiaods@gmail.com>
Date: Sun, 7 Aug 2022 13:33:27 +0800
Subject: [PATCH] fix: delete k3s cluster with kubenetes version

fix issue: https://github.com/kubesphere/kubekey/issues/1148

let below cmd works
```
./kk delete cluster --with-kubenetes v1.21.6-k3s
```

Signed-off-by: Deshi Xiao <xiaods@gmail.com>
---
 cmd/ctl/delete/delete_cluster.go | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/cmd/ctl/delete/delete_cluster.go b/cmd/ctl/delete/delete_cluster.go
index f533b2d8..62d8136d 100644
--- a/cmd/ctl/delete/delete_cluster.go
+++ b/cmd/ctl/delete/delete_cluster.go
@@ -27,6 +27,7 @@ import (
 type DeleteClusterOptions struct {
 	CommonOptions  *options.CommonOptions
 	ClusterCfgFile string
+	Kubernetes     string
 }
 
 func NewDeleteClusterOptions() *DeleteClusterOptions {
@@ -53,12 +54,14 @@ func NewCmdDeleteCluster() *cobra.Command {
 
 func (o *DeleteClusterOptions) Run() error {
 	arg := common.Argument{
-		FilePath: o.ClusterCfgFile,
-		Debug:    o.CommonOptions.Verbose,
+		FilePath:          o.ClusterCfgFile,
+		Debug:             o.CommonOptions.Verbose,
+		KubernetesVersion: o.Kubernetes,
 	}
 	return pipelines.DeleteCluster(arg)
 }
 
 func (o *DeleteClusterOptions) AddFlags(cmd *cobra.Command) {
 	cmd.Flags().StringVarP(&o.ClusterCfgFile, "filename", "f", "", "Path to a configuration file")
+	cmd.Flags().StringVarP(&o.Kubernetes, "with-kubernetes", "", "", "Specify a supported version of kubernetes")
 }
-- 
2.21.0

