Skip to content

Commit 753d4c4

Browse files
authored
Ignore 64bit ARM when setting ETCD_UNSUPPORTED_ARCH (#519)
* Ignore 64bit ARM when setting ETCD_UNSUPPORTED_ARCH Signed-off-by: Kimmo Lehto <[email protected]> * Add version switch Signed-off-by: Kimmo Lehto <[email protected]> --------- Signed-off-by: Kimmo Lehto <[email protected]>
1 parent ee995eb commit 753d4c4

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

phase/arm_prepare.go

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package phase
33
import (
44
"strings"
55

6+
"github.com/k0sproject/version"
67
log "github.com/sirupsen/logrus"
78

89
"github.com/k0sproject/k0sctl/pkg/apis/k0sctl.k0sproject.io/v1beta1"
@@ -26,8 +27,34 @@ func (p *PrepareArm) Prepare(config *v1beta1.Cluster) error {
2627
p.Config = config
2728

2829
p.hosts = p.Config.Spec.Hosts.Filter(func(h *cluster.Host) bool {
30+
if h.Role == "worker" {
31+
return false
32+
}
33+
2934
arch := h.Metadata.Arch
30-
return h.Role != "worker" && (strings.HasPrefix(arch, "arm") || strings.HasPrefix(arch, "aarch"))
35+
36+
if !strings.HasPrefix(arch, "arm") && !strings.HasPrefix(arch, "aarch") {
37+
return false
38+
}
39+
40+
if strings.HasSuffix(arch, "64") {
41+
// 64-bit arm is supported on etcd 3.5.0+ which is included in k0s v1.22.1+k0s.0 and newer
42+
minVer, err := version.NewVersion("v1.22.1+k0s.0")
43+
if err != nil {
44+
log.Warnf("failed to parse constraint k0s version: %v", err)
45+
return false
46+
}
47+
k0sVer, err := version.NewVersion(p.Config.Spec.K0s.Version)
48+
if err != nil {
49+
log.Warnf("failed to parse target k0s version: %v", err)
50+
return false
51+
}
52+
if k0sVer.GreaterThanOrEqual(minVer) {
53+
return false
54+
}
55+
}
56+
57+
return true
3158
})
3259

3360
return nil

0 commit comments

Comments
 (0)