Documentation
¶
Index ¶
- func AddDeviceFile(config *Config, deviceInfo api.DeviceInfo) error
- func CheckResourcesInNode(node *v1.Node, request map[v1.ResourceName]resource.Quantity) bool
- func CheckResourcesInSlice(resources map[v1.ResourceName]resource.Quantity, slice, ignore []string) bool
- func CopyMap[K comparable, V any](src, dst map[K]V)
- func DeleteSliceFunc[S ~[]E, E any](s S, filter func(E) bool) S
- func GetContainerStatus(pod *v1.Pod, containerName string) (*v1.ContainerStatus, bool)
- func GetDeviceFileVersion(deviceFile string) (uint32, uint32, error)
- func GetDeviceFileVersionV2(deviceFile string) (uint32, uint32, devices.Type, error)
- func GetK8sPodCGroupFullPath(podCGroupPath string) string
- func GetK8sPodCGroupPath(pod *v1.Pod, container *api.Container, getFullPath func(string) string) (string, error)
- func GetK8sPodDeviceCGroupFullPath(podCGroupPath string) string
- func IsSidecar(container v1.Container) bool
- func KillRunningProcesses(config *Config, processes []int) error
- func LoadEmulator(path string) (*devices.Emulator, error)
- func LoopRetry(retryCount uint, interval time.Duration, conditionFunc wait.ConditionFunc) error
- func NewDeviceSlavePod(ownerPod *v1.Pod, limits map[v1.ResourceName]resource.Quantity, ...) *v1.Pod
- func NilCloser() error
- func PathIsNotExist(fullPath string) bool
- func RemoveDeviceFile(config *Config, deviceInfo api.DeviceInfo) error
- func SetDeviceRulesByCgroupv1(path string, r *configs.Resources) (func() error, error)
- func SetDeviceRulesByCgroupv2(dirPath string, r *configs.Resources) (func() error, func() error, error)
- func SystemdPathPrefixOfRuntime(runtimeName string) string
- type CgroupName
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddDeviceFile ¶
func AddDeviceFile(config *Config, deviceInfo api.DeviceInfo) error
func CheckResourcesInNode ¶
func CheckResourcesInSlice ¶
func CopyMap ¶
func CopyMap[K comparable, V any](src, dst map[K]V)
func DeleteSliceFunc ¶
func GetContainerStatus ¶
func GetDeviceFileVersionV2 ¶
func GetK8sPodCGroupFullPath ¶
func GetK8sPodCGroupPath ¶
func KillRunningProcesses ¶
func NewDeviceSlavePod ¶
func PathIsNotExist ¶
func RemoveDeviceFile ¶
func RemoveDeviceFile(config *Config, deviceInfo api.DeviceInfo) error
Types ¶
type CgroupName ¶
type CgroupName []string
func NewPodCgroupName ¶
func NewPodCgroupName(pod *v1.Pod) CgroupName
func (CgroupName) ToCgroupfs ¶
func (cgroupName CgroupName) ToCgroupfs() string
func (CgroupName) ToSystemd ¶
func (cgroupName CgroupName) ToSystemd() string
cgroupName.ToSystemd converts the internal cgroup name to a systemd name. For example, the name {"kubepods", "burstable", "pod1234-abcd-5678-efgh"} becomes "/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod1234_abcd_5678_efgh.slice" This function always expands the systemd name into the cgroupfs form. If only the last part is needed, use path.Base(...) on it to discard the rest.
type Config ¶
type Config struct {
Cgroup bool // Enter cgroup namespace
CgroupFile string // Cgroup namespace location, default to /proc/PID/ns/cgroup
FollowContext bool // Set SELinux security context
GID int // GID to use to execute given program
IPC bool // Enter IPC namespace
IPCFile string // IPC namespace location, default to /proc/PID/ns/ipc
Mount bool // Enter mount namespace
MountFile string // Mount namespace location, default to /proc/PID/ns/mnt
Net bool // Enter network namespace
NetFile string // Network namespace location, default to /proc/PID/ns/net
NoFork bool // Do not fork before executing the specified program
PID bool // Enter PID namespace
PIDFile string // PID namespace location, default to /proc/PID/ns/pid
PreserveCredentials bool // Preserve current UID/GID when entering namespaces
RootDirectory string // Set the root directory, default to target process root directory
Target int // Target PID (required)
UID int // UID to use to execute given program
User bool // Enter user namespace
UserFile string // User namespace location, default to /proc/PID/ns/user
UTS bool // Enter UTS namespace
UTSFile string // UTS namespace location, default to /proc/PID/ns/uts
WorkingDirectory string // Set the working directory, default to target process working directory
}
Config is the nsenter configuration used to generate nsenter command
Click to show internal directories.
Click to hide internal directories.