utils

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmdAndArgs

func CmdAndArgs(args []string) (command string, argv []string)

func CopyFile

func CopyFile(src, dst string) error

CopyFile

func CreateDir

func CreateDir(dir string) error

CreateDir creates a directory if not exist

func Extract

func Extract(tarball, target string) error

Extract untars both .tar and .tar.gz files.

func GenIPAddress

func GenIPAddress() string

GenIPAddress generates ip address randomly (and dummy). NOTE(kiennt26): It doesn't check this IP address is used or not, as I assume there is just only 1 container run at time.

func GenTemplate

func GenTemplate(name, tempStr string, input any) error

GenTemplate inits and execute the given template

func GenUID

func GenUID() string

GenUID returns a random string

func InitKokerDirs

func InitKokerDirs() error

InitKokerDirs creates all related directories

func SetNamespace

func SetNamespace(pid string, flag int) error

SetNamespace calls setns syscall for set of flags. It changes current process namespace to namespace of another process which can be specified by pid.

NOTE: A process may not be reassociated with a new mount namespace if it is multi-threaded. Changing the mount namespace requires that the caller possess both CAP_SYS_CHROOT and CAP_SYS_ADMIN capabilities in its own user namespace and CAP_SYS_ADMIN in the target mount namespace.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL