Skip to content
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

Add ArchLinux support #183

Merged
merged 2 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions config/cluster/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,16 @@ func (h *Host) NeedIPTables() bool {
return !h.Configurer.CommandExist(h, "iptables")
}

// NeedInetUtils returns true when the inetutils package is needed on the host to run `hostname`.
func (h *Host) NeedInetUtils() bool {
// Windows does not need inetutils
if h.Configurer.Kind() == "windows" {
return false
}

return !h.Configurer.CommandExist(h, "hostname")
}

// WaitKubeAPIReady blocks until the local kube api responds to /version
func (h *Host) WaitKubeAPIReady() error {
// If the anon-auth is disabled on kube api the version endpoint will give 401
Expand Down
25 changes: 25 additions & 0 deletions configurer/linux/archlinux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package linux

import (
"github.com/k0sproject/k0sctl/configurer"
"github.com/k0sproject/rig"
"github.com/k0sproject/rig/os/linux"
"github.com/k0sproject/rig/os/registry"
)

// Archlinux provides OS support for Archlinux systems
type Archlinux struct {
linux.Archlinux
configurer.Linux
}

func init() {
registry.RegisterOSModule(
func(os rig.OSVersion) bool {
return os.IDLike == "arch"
},
func() interface{} {
return &Archlinux{}
},
)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/go-playground/validator/v10 v10.4.1
github.com/hashicorp/go-version v1.2.1
github.com/k0sproject/dig v0.1.1
github.com/k0sproject/rig v0.3.21
github.com/k0sproject/rig v0.3.23
github.com/logrusorgru/aurora v2.0.3+incompatible
github.com/mattn/go-isatty v0.0.12
github.com/segmentio/analytics-go v3.1.0+incompatible
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/k0sproject/dig v0.1.1 h1:TmNoZtsCXF3jDzwSSEEwKjjD7fG5IyG0p8uvK+z1Wyo=
github.com/k0sproject/dig v0.1.1/go.mod h1:rBcqaQlJpcKdt2x/OE/lPvhGU50u/e95CSm5g/r4s78=
github.com/k0sproject/rig v0.3.21 h1:kUFYSTULHbXp8HgQHWJZGtmdj+AtY/lTT1ZH54Q/wMk=
github.com/k0sproject/rig v0.3.21/go.mod h1:6BgqiLQMw5SCMrysZ42ORzyXd3NOyr9KDEa2UGYphdY=
github.com/k0sproject/rig v0.3.23 h1:jmGxX8nuT0GNrjmjCCQIASaSPg5g26gYJjdPMo6Mu2Y=
github.com/k0sproject/rig v0.3.23/go.mod h1:6BgqiLQMw5SCMrysZ42ORzyXd3NOyr9KDEa2UGYphdY=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
Expand Down
4 changes: 4 additions & 0 deletions phase/prepare_hosts.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ func (p *PrepareHosts) prepareHost(h *cluster.Host) error {
pkgs = append(pkgs, "iptables")
}

if h.NeedInetUtils() {
pkgs = append(pkgs, "inetutils")
}

if len(pkgs) > 0 {
log.Infof("%s: installing packages (%s)", h, strings.Join(pkgs, ", "))
if err := h.Configurer.InstallPackage(h, pkgs...); err != nil {
Expand Down