k0sproject / k0sctl

A bootstrapping and management tool for k0s clusters.
Other
391 stars 77 forks source link

os support module not found #483

Open dongminglei opened 1 year ago

dongminglei commented 1 year ago

Linux test01 4.19.90-25.23.v2101.ky10.aarch64 #1 SMP Wed Jan 4 09:57:28 CST 2023 aarch64 aarch64 aarch64 GNU/Linux

jnummelin commented 1 year ago

Based on the uname output I assume this is Kylin OS?

The issue in that case is that k0sctl does not detect that as supported OS. k0sctl pre-configures the OS for k0s so it needs to detect the OS to know how to e.g. install packages etc.

As Kylin is not something we have in our hands, PRs are welcome.

Look for an example in: https://github.com/k0sproject/k0sctl/blob/main/configurer/linux/ubuntu.go#L1

If Kylin is based on Debian/Ubuntu/what-ever, your starting point would be something like this:

// Kylin provides OS support for Kylin systems
type Kylin struct {
    Debian
}

func init() {
    registry.RegisterOSModule(
        func(os rig.OSVersion) bool {
            return os.ID == "kylin"
        },
        func() interface{} {
            linuxType := &Kylin{}
            linuxType.PathFuncs = interface{}(linuxType).(configurer.PathFuncs)
            return linuxType
        },
    )
}
till commented 1 year ago

Just as an alternative... most OS' have an ID_LIKE:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

Then, whatever logic is employed to determine the OS can rely on ID_LIKE and have fewer abstractions?

kke commented 1 year ago

You can also use the os: key in config yaml to force detection as some other distro, like debian.