Documentation ¶
Overview ¶
Package utils contains generic helpers, utilities and structs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LilipodBinPath = filepath.Join(GetLilipodHome(), "bin")
LilipodBinPath is the bin path internally used by lilipod.
Functions ¶
func EnsureUNIXDependencies ¶
EnsureUNIXDependencies will link the missing utility to internally managed busybox binary. If the binary does not exist, download it first. Hard dependencies include:
- getsubuids
- newuidmap
- newgudmap
These are needed to correctly spawn user-mapped user namespaces. These cannot be downloaded as they either need to be setuid binaries or setcap binaries.
Other less crucial dependencies include:
- tar
- unshare
- nsenter
These will be downloaded as statically compiled busybox binaries if absent.
Additionally the ptyAgent will be saved into lilipod's bin directory, ready to be injected in the containers.
func GetDefaultTable ¶
GetDefaultTable returns the default table style we use to print out tables.
func GetLilipodHome ¶
func GetLilipodHome() string
GetLilipodHome will return where the program will save data. This function will search the environment or:
LILIPOD_HOME XDG_DATA_HOME HOME
These variable are searched in this order.
func SaveConfig ¶
SaveConfig saves current config from memory to json file.
Types ¶
type Config ¶
type Config struct { Env []string `json:"env"` Cgroup string `json:"cgroup"` Created string `json:"created"` Gidmap string `json:"gidmap"` Hostname string `json:"hostname"` ID string `json:"id"` Image string `json:"image"` Ipc string `json:"ipc"` Names string `json:"names"` Network string `json:"network"` Pid string `json:"pid"` Privileged bool `json:"privileged"` Size string `json:"size"` Status string `json:"status"` Time string `json:"time"` Uidmap string `json:"uidmap"` User string `json:"user"` Userns string `json:"userns"` Workdir string `json:"workdir"` Stopsignal string `json:"stopsignal"` Mounts []string `json:"mounts"` Labels map[string]string `json:"labels"` // entry point related Entrypoint []string `json:"entrypoint"` }
Config is a struct that holds the information of the container we want to create.
Note that this is NOT OCI COMPLIANT, lilipod is oci-registry and images compliant, but doesn't need to create oci-compliant containers.
func GetDefaultConfig ¶
func GetDefaultConfig() Config
GetDefaultConfig returns a plain container Config used to reset to defaults.
func InitConfig ¶
InitConfig returns an unmarshalled config from a byte array.
func LoadConfig ¶
LoadConfig loads a config from file to config struct.