talos

Форк
0
/
extensions.go 
56 строк · 1.4 Кб
1
// This Source Code Form is subject to the terms of the Mozilla Public
2
// License, v. 2.0. If a copy of the MPL was not distributed with this
3
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
4

5
// Package extensions contains Talos extensions specific API.
6
package extensions
7

8
import "path/filepath"
9

10
// AllowedPaths lists paths allowed in the extension images.
11
var AllowedPaths = []string{
12
	"/etc/cri/conf.d",
13
	"/lib/firmware",
14
	"/lib/modules",
15
	"/lib64/ld-linux-x86-64.so.2",
16
	"/usr/etc/udev/rules.d",
17
	"/usr/local",
18
	// glvnd, egl and vulkan are needed for OpenGL/Vulkan.
19
	"/usr/share/glvnd",
20
	"/usr/share/egl",
21
	"/etc/vulkan",
22
}
23

24
// Extension represents unpacked extension in the filesystem.
25
type Extension struct {
26
	Manifest Manifest
27

28
	directory  string
29
	rootfsPath string
30
}
31

32
// RootfsPath returns the path to the rootfs directory.
33
func (ext *Extension) RootfsPath() string {
34
	return ext.rootfsPath
35
}
36

37
// Directory returns the directory name of the extension.
38
func (ext *Extension) Directory() string {
39
	return ext.directory
40
}
41

42
// New creates a new extension from the rootfs path, directory name and manifest.
43
func New(rootfsPath, directory string, manifest Manifest) *Extension {
44
	extension := &Extension{
45
		Manifest: manifest,
46

47
		rootfsPath: rootfsPath,
48
		directory:  directory,
49
	}
50

51
	if extension.directory == "" {
52
		extension.directory = filepath.Base(rootfsPath)
53
	}
54

55
	return extension
56
}
57

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.