-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set ETCD_UNSUPPORTED_ARCH on ARM controller nodes #184
Conversation
phase/inject_arm_fixes.go
Outdated
func (p *InjectARMFixes) Prepare(config *config.Cluster) error { | ||
p.Config = config | ||
|
||
hosts := p.Config.Spec.Hosts.Filter(func(h *cluster.Host) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this is only needed for controllers
hosts := p.Config.Spec.Hosts.Filter(func(h *cluster.Host) bool { | |
hosts := p.Config.Spec.Hosts.Filter(func(h *cluster.Host) bool { | |
if h.Role == "worker" { | |
return false | |
} |
phase/inject_arm_fixes.go
Outdated
`, h.Metadata.Arch) | ||
|
||
name, err := func() (string, error) { | ||
d, err := ioutil.TempDir("", "k0scontroller.service.d.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ioutil
package is being phased out, os.MkdirTemp
replaces ioutil.TempDir
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 Maybe just host.Configurer.WriteFile(....)
it instead of wrestling with tempfiles and host.Files
.
Signed-off-by: erdii <[email protected]>
Signed-off-by: erdii <[email protected]>
Heyo @kke 👋 Disclaimer: I don't have time to test |
Another problem, only works for systemd. |
Ok I broke it. Fixing it for openrc and relatives seems to require some more changes to rig. |
phase/prepare_arm.go
Outdated
|
||
p.hosts = p.Config.Spec.Hosts.Filter(func(h *cluster.Host) bool { | ||
arch := h.Metadata.Arch | ||
return h.Role != "worker" && (arch == "arm" || arch == "arm64") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: I think this needs aarch64
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly armv7l
and some others... maybe just strings.HasPrefix
with arm
and aarch
, then figure out 32/64bit separately to choose if etcd_unsupported_arch
should be set to arm
or arm64
.
https://etcd.io/docs/v3.5/op-guide/supported-platform/ here's the list of supported platforms and which ones need the env.
I think it needs to print a warning too.
I think it needs a For systemd it can create such |
I think this also needs to be considered when doing a k0sctl reset. |
phase/prepare_arm.go
Outdated
@@ -0,0 +1,58 @@ | |||
package phase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just do not understand what is wrong with this file now.
go vet
gives me:
# github.com/k0sproject/k0sctl/cmd
cmd/apply.go:79:5: undefined: phase.PrepareArm
# github.com/k0sproject/k0sctl/cmd
vet: cmd/apply.go:79:11: PrepareArm not declared by package phase
any ideas, @erdii @jnummelin @jasmingacic ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmmmmmmmmmm, is it the _arm
in filename? maybe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it is.
Files with os and architecture specific suffixes automatically follow those same constraints, e.g. name_linux.go will only build on linux, name_amd64.go will only build on amd64. This is the same as having a
//+build amd64
line at the top of the file
Maybe it works now. @erdii ptal |
Wow thanks! I'll take a look in the next couple of days. Please ping me if I forget to do so! 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried this on my local setup with 3 odroid-hc4 and 3 raspberry pi 4 boards and it worked like a breeze! :)
Thank you very much @kke !
Edit: all my machines are on archlinuxarm so i can't speak for non-systemd distributions
func (p *PrepareArm) etcdUnsupportedArch(h *cluster.Host) error { | ||
var arch string | ||
switch h.Metadata.Arch { | ||
case "aarch32", "arm32", "armv7l", "armhfp", "arm-32": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is that list from? Maybe it makes sense to link the source here in a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several sources, I googled around, there seems to be a huge load of different ones, it's possible this is still incomplete. I think the most important ones here are aarch32
and armv7l
which I think are commonly seen in raspberries.
} | ||
|
||
log.Warnf("%s: enabling ETCD_UNSUPPORTED_ARCH=%s override - you may encounter problems with etcd", h, arch) | ||
h.Environment["ETCD_UNSUPPORTED_ARCH"] = arch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did h.Environment previously do? Will this also set /etc/environment
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It goes both ways, this way also all the HTTP_PROXY
stuff etc that user might have configured will get into the env override file, there's a possibility it will make them end up in k0s process more consistently.
Just had these questions - other than that LGTM! |
Maybe |
Actually now that i think of it I'm afraid that the service override file could have stayed in place during my run of |
I did just let it run in the background of a meeting and there are two issues:
What do you think? |
UpdateServiceEnvironment could call DaemonReload as the final step |
Proposed fix in rig: k0sproject/rig#40 |
The rig fixes are available as v0.4.4-beta.2 currently, I'm in the middle of fixing the sudo stuff in #192 so it will bring in some other changes, should have the v0.4.4 out any time now. |
Observation: when the controller init phase fails, a subsequent reset it not cleaning up service environment |
Another observation: the empty folder |
Clean-up improved |
The empty dir can be fixed separately k0sproject/rig#42 |
Merging to roll out a beta |
Thank you! I will test it asap :) |
works 👍 thank you very much @kke |
Is there a binary for linux arm or should i build it myself? Attempting to try on RPis |
I thought there was, but looks like there isn't. I'll add it to the build scripts. |
@dwarf-king-hreidmar Linux-arm64 binaries now in https://github.com/k0sproject/k0sctl/releases/tag/v0.10.2 |
This PR explores a way to enable cluster creation on arm nodes.
Alternative to this implementation: Add systemd drop-in file via hosts[].files but this is hardcoding node architectures in the cluster configuration