fix: delete k3s cluster with kubenetes version

Signed-off-by: chenmaodong <chenmaodong@xfusion.com>
This commit is contained in:
chenmaodong 2023-01-06 15:56:50 +08:00
parent 69cc390fc9
commit 3907126fe0
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,49 @@
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

View File

@ -3,12 +3,13 @@
Name: kubekey
Summary: Install Kubernetes/K3s only, both Kubernetes/K3s and KubeSphere, and related cloud-native add-ons, it supports all-in-one, multi-node, and HA.
Version: v2.2.2
Release: 2
Release: 3
License: Apache-2.0
URL: https://github.com/kubesphere/kubekey
Source0: https://github.com/kubesphere/kubekey/releases/download/%{version}-openEuler/kubekey-%{version}.tar.gz
Patch0001: backport-0001-fix-invalid-syntax-of-etc_sysctl_conf.patch
Patch0002: backport-0001-fix-delete-k3s-cluster-with-kubenetes-version.patch
BuildRequires: git go
Requires: socat
@ -33,6 +34,9 @@ cp output/kk $RPM_BUILD_ROOT/usr/local/bin
%changelog
* Fri Jan 06 chenmaodong <chenmaodong@xfusion.com> v2.2.2-3
- fix: delete k3s cluster with kubenetes version
* Thu Dec 29 2022 chenmaodong <chenmaodong@xfusion.com> v2.2.2-2
- fix invalid syntax of /etc/sysctl.conf after executing init os script