Skip to content

Commit

Permalink
fix: KubeSphere version check error
Browse files Browse the repository at this point in the history
Signed-off-by: pixiake <guofeng@yunify.com>
  • Loading branch information
pixiake committed Jul 27, 2023
1 parent 3e84255 commit bae75d7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cmd/kk/pkg/bootstrap/os/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ var (
etcdFiles = []string{
"/usr/local/bin/etcd",
"/etc/ssl/etcd",
"/var/lib/etcd",
"/var/lib/etcd/*",
"/etc/etcd.env",
}
clusterFiles = []string{
Expand All @@ -149,7 +149,7 @@ var (
"/var/log/pods/",
"/var/lib/cni",
"/var/lib/calico",
"/var/lib/kubelet",
"/var/lib/kubelet/*",
"/run/calico",
"/run/flannel",
"/etc/flannel",
Expand Down Expand Up @@ -231,7 +231,7 @@ func (r *RemoveNodeFiles) Execute(runtime connector.Runtime) error {
"/var/log/pods/",
"/var/lib/cni",
"/var/lib/calico",
"/var/lib/kubelet",
"/var/lib/kubelet/*",
"/run/calico",
"/run/flannel",
"/etc/flannel",
Expand Down
4 changes: 3 additions & 1 deletion cmd/kk/pkg/bootstrap/precheck/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,11 @@ func (k *KsVersionCheck) Execute(runtime connector.Runtime) error {
ccKsVersionStr, ccErr := runtime.GetRunner().SudoCmd(
"/usr/local/bin/kubectl get ClusterConfiguration ks-installer -n kubesphere-system -o jsonpath='{.metadata.labels.version}'",
false)
if ccErr == nil && ksVersionStr == "v3.1.0" {

if ccErr == nil && versionutil.MustParseSemantic(ccKsVersionStr).AtLeast(versionutil.MustParseSemantic("v3.1.0")) {
ksVersionStr = ccKsVersionStr
}

k.PipelineCache.Set(common.KubeSphereVersion, ksVersionStr)
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/kk/pkg/kubernetes/kubernetes_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (k *KubernetesStatus) SearchJoinInfo(runtime connector.Runtime) error {
return nil
}

uploadCertsCmd := "/usr/local/bin/kubeadm init phase upload-certs --upload-certs"
uploadCertsCmd := "/usr/local/bin/kubeadm init phase upload-certs --upload-certs --config /etc/kubernetes/kubeadm-config.yaml"
output, err := runtime.GetRunner().SudoCmd(uploadCertsCmd, true)
if err != nil {
return errors.Wrap(errors.WithStack(err), "Failed to upload kubeadm certs")
Expand Down
15 changes: 15 additions & 0 deletions cmd/kk/pkg/kubernetes/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,23 @@ func (s *SetUpgradePlanModule) Init() {
Action: &SetUpgradePlan{Step: s.Step},
}

generateKubeadmConfigInit := &task.RemoteTask{
Name: "GenerateKubeadmConfig",
Desc: "Generate kubeadm config",
Hosts: s.Runtime.GetHostsByRole(common.Master),
Prepare: &prepare.PrepareCollection{
new(common.OnlyFirstMaster),
},
Action: &GenerateKubeadmConfig{
IsInitConfiguration: true,
WithSecurityEnhancement: s.KubeConf.Arg.SecurityEnhancement,
},
Parallel: true,
}

s.Tasks = []task.Interface{
plan,
generateKubeadmConfigInit,
}
}

Expand Down
4 changes: 4 additions & 0 deletions cmd/kk/pkg/version/kubernetes/version_enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const (
V123
V124
V125
V126
)

var VersionList = []Version{
Expand All @@ -45,6 +46,7 @@ var VersionList = []Version{
V123,
V124,
V125,
V126,
}

func (v Version) String() string {
Expand All @@ -63,6 +65,8 @@ func (v Version) String() string {
return "v1.24"
case V125:
return "v1.25"
case V126:
return "v1.26"
default:
return "invalid option"
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/kk/pkg/version/kubesphere/ks_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,5 @@ var KsV340 = &KsInstaller{
V332.String(),
V331.String(),
V330.String(),
V320.String(),
V321.String(),
},
}

0 comments on commit bae75d7

Please sign in to comment.