talos/pkg/machinery/extensions/extensions.go
Dmitry Sharshakov 8680351c13
chore: move system extensions' udev rules
Update packages and relevant paths
Ref: siderolabs/pkgs#1053

Signed-off-by: Dmitry Sharshakov <dmitry.sharshakov@siderolabs.com>
2024-10-23 19:03:25 +02:00

60 lines
1.5 KiB
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Package extensions contains Talos extensions specific API.
package extensions
import "path/filepath"
// AllowedPaths lists paths allowed in the extension images.
var AllowedPaths = []string{
"/etc/cri/conf.d",
"/lib/firmware",
"/lib/modules",
// The glibc loader is required by glibc dynamic binaries.
"/lib64/ld-linux-x86-64.so.2",
// /sbin/ldconfig is required by the nvidia container toolkit.
"/sbin/ldconfig",
"/usr/lib/udev/rules.d",
"/usr/local",
// glvnd, egl and vulkan are needed for OpenGL/Vulkan.
"/usr/share/glvnd",
"/usr/share/egl",
"/etc/vulkan",
}
// Extension represents unpacked extension in the filesystem.
type Extension struct {
Manifest Manifest
directory string
rootfsPath string
}
// RootfsPath returns the path to the rootfs directory.
func (ext *Extension) RootfsPath() string {
return ext.rootfsPath
}
// Directory returns the directory name of the extension.
func (ext *Extension) Directory() string {
return ext.directory
}
// New creates a new extension from the rootfs path, directory name and manifest.
func New(rootfsPath, directory string, manifest Manifest) *Extension {
extension := &Extension{
Manifest: manifest,
rootfsPath: rootfsPath,
directory: directory,
}
if extension.directory == "" {
extension.directory = filepath.Base(rootfsPath)
}
return extension
}