k0sctl icon indicating copy to clipboard operation
k0sctl copied to clipboard

os support module not found

Open dongminglei opened this issue 2 years ago • 3 comments

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

dongminglei avatar May 26 '23 12:05 dongminglei

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
		},
	)
}

jnummelin avatar May 26 '23 12:05 jnummelin

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?

till avatar May 26 '23 16:05 till

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

kke avatar May 31 '23 07:05 kke