Skip to content

Commit

Permalink
[Backport release-v1.4] fix: yurtadm join can't work when kubernetes …
Browse files Browse the repository at this point in the history
…version large than v1.27.0 (#1998)

* fix yurtadm join can't work when kubernetes version large than v1.27.0

(cherry picked from commit ed743d7)
  • Loading branch information
github-actions[bot] authored Mar 28, 2024
1 parent cb2055b commit 32a9758
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkg/yurtadm/util/kubernetes/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,17 +396,25 @@ func SetKubeadmJoinConfig(data joindata.YurtJoinData) error {
"criSocket": nodeReg.CRISocket,
"name": nodeReg.Name,
}

v1, err := version.NewVersion(data.KubernetesVersion())
if err != nil {
return err
}

if nodeReg.CRISocket == constants.DefaultDockerCRISocket {
ctx["networkPlugin"] = "cni"
} else {
ctx["containerRuntime"] = "remote"
v124alpha, err := version.NewVersion("1.24.0-alpha.0")
if err != nil {
return err
}
if v1.LessThan(v124alpha) {
ctx["containerRuntime"] = "remote"
}
ctx["containerRuntimeEndpoint"] = nodeReg.CRISocket
}

v1, err := version.NewVersion(data.KubernetesVersion())
if err != nil {
return err
}
v2, err := version.NewVersion("v1.22.0")
if err != nil {
return err
Expand Down

0 comments on commit 32a9758

Please sign in to comment.