Documentation ¶
Index ¶
- Variables
- func AddContainerIDMapping(ctx context.Context, containerID, sandboxID string) error
- func CreateContainer(ctx context.Context, vci vc.VC, sandbox vc.VCSandbox, ociSpec specs.Spec, ...) (vc.Process, error)
- func CreateSandbox(ctx context.Context, vci vc.VC, ociSpec specs.Spec, ...) (_ vc.VCSandbox, _ vc.Process, err error)
- func CreateTracer(name string) (opentracing.Tracer, error)
- func DelContainerIDMapping(ctx context.Context, containerID string) error
- func EnterNetNS(netNSPath string, cb func() error) error
- func FetchContainerIDMapping(containerID string) (string, error)
- func FileExists(path string) bool
- func GetDefaultConfigFilePaths() []string
- func GetDefaultHypervisorConfig() vc.HypervisorConfig
- func GetFileContents(file string) (string, error)
- func HandleFactory(ctx context.Context, vci vc.VC, runtimeConfig *oci.RuntimeConfig)
- func IsBlockDevice(filePath string) bool
- func LoadConfiguration(configPath string, ignoreLogging, builtIn bool) (resolvedConfigPath string, config oci.RuntimeConfig, err error)
- func PostStartHooks(ctx context.Context, spec specs.Spec, cid, bundlePath string) error
- func PostStopHooks(ctx context.Context, spec specs.Spec, cid, bundlePath string) error
- func PreStartHooks(ctx context.Context, spec specs.Spec, cid, bundlePath string) error
- func ResolvePath(path string) (string, error)
- func RunCommand(args []string) (string, error)
- func RunCommandFull(args []string, includeStderr bool) (string, error)
- func SetConfigOptions(n, runtimeConfig, sysRuntimeConfig string)
- func SetCtrsMapTreePath(path string)
- func SetEphemeralStorageType(ociSpec specs.Spec) specs.Spec
- func SetKernelParams(runtimeConfig *oci.RuntimeConfig) error
- func SetLogger(ctx context.Context, logger *logrus.Entry, level logrus.Level)
- func SetupNetworkNamespace(config *vc.NetworkConfig) error
- func StopTracing(ctx context.Context)
- func Trace(parent context.Context, name string) (opentracing.Span, context.Context)
- func WriteFile(filePath string, data string, fileMode os.FileMode) error
- type CtrEngine
- func (e *CtrEngine) Create(image string) (string, error)
- func (e *CtrEngine) GetRootfs(ctrID string, dir string) error
- func (e *CtrEngine) Init(name string) (string, error)
- func (e *CtrEngine) Inspect(image string) (string, error)
- func (e *CtrEngine) Pull(image string) (string, error)
- func (e *CtrEngine) Rm(ctrID string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var (
DockerLikeCtrEngines = []string{"docker", "podman"}
)
var GetKernelParamsFunc = getKernelParams
GetKernelParamsFunc use a variable to allow tests to modify its value
Functions ¶
func AddContainerIDMapping ¶
AddContainerIDMapping add a container id mapping to sandbox id
func CreateContainer ¶
func CreateContainer(ctx context.Context, vci vc.VC, sandbox vc.VCSandbox, ociSpec specs.Spec, rootFs vc.RootFs, containerID, bundlePath, console string, disableOutput, builtIn bool) (vc.Process, error)
CreateContainer create a container
func CreateSandbox ¶
func CreateSandbox(ctx context.Context, vci vc.VC, ociSpec specs.Spec, runtimeConfig oci.RuntimeConfig, rootFs vc.RootFs, containerID, bundlePath, console string, disableOutput, systemdCgroup, builtIn bool) (_ vc.VCSandbox, _ vc.Process, err error)
CreateSandbox create a sandbox container
func CreateTracer ¶
func CreateTracer(name string) (opentracing.Tracer, error)
CreateTracer create a tracer
func DelContainerIDMapping ¶
DelContainerIDMapping delete container id mapping from a sandbox
func EnterNetNS ¶
EnterNetNS is free from any call to a go routine, and it calls into runtime.LockOSThread(), meaning it won't be executed in a different thread than the one expected by the caller.
func FetchContainerIDMapping ¶
FetchContainerIDMapping This function assumes it should find only one file inside the container ID directory. If there are several files, we could not determine which file name corresponds to the sandbox ID associated, and this would throw an error.
func GetDefaultConfigFilePaths ¶
func GetDefaultConfigFilePaths() []string
GetDefaultConfigFilePaths returns a list of paths that will be considered as configuration files in priority order.
func GetDefaultHypervisorConfig ¶
func GetDefaultHypervisorConfig() vc.HypervisorConfig
func GetFileContents ¶
GetFileContents return the file contents as a string.
func HandleFactory ¶
HandleFactory set the factory
func IsBlockDevice ¶
IsBlockDevice returns true if the give path is a block device
func LoadConfiguration ¶
func LoadConfiguration(configPath string, ignoreLogging, builtIn bool) (resolvedConfigPath string, config oci.RuntimeConfig, err error)
LoadConfiguration loads the configuration file and converts it into a runtime configuration.
If ignoreLogging is true, the system logger will not be initialised nor will this function make any log calls.
All paths are resolved fully meaning if this function does not return an error, all paths are valid at the time of the call.
func PostStartHooks ¶
PostStartHooks run the hooks just after start container
func PostStopHooks ¶
PostStopHooks run the hooks after stop container
func PreStartHooks ¶
PreStartHooks run the hooks before start container
func ResolvePath ¶
ResolvePath returns the fully resolved and expanded value of the specified path.
func RunCommand ¶
RunCommand returns the commands space-trimmed standard output on success
func RunCommandFull ¶
RunCommandFull returns the commands space-trimmed standard output and error on success. Note that if the command fails, the requested output will still be returned, along with an error.
func SetConfigOptions ¶
func SetConfigOptions(n, runtimeConfig, sysRuntimeConfig string)
SetConfigOptions will override some of the defaults settings.
func SetCtrsMapTreePath ¶
func SetCtrsMapTreePath(path string)
SetCtrsMapTreePath let the testcases change the ctrsMapTreePath to a test dir
func SetEphemeralStorageType ¶
SetEphemeralStorageType sets the mount type to 'ephemeral' if the mount source path is provisioned by k8s for ephemeral storage. For the given pod ephemeral volume is created only once backed by tmpfs inside the VM. For successive containers of the same pod the already existing volume is reused.
func SetKernelParams ¶
func SetKernelParams(runtimeConfig *oci.RuntimeConfig) error
SetKernelParams adds the user-specified kernel parameters (from the configuration file) to the defaults so that the former take priority.
func SetupNetworkNamespace ¶
func SetupNetworkNamespace(config *vc.NetworkConfig) error
SetupNetworkNamespace create a network namespace
func StopTracing ¶
StopTracing ends all tracing, reporting the spans to the collector.