Documentation ¶
Index ¶
- Constants
- func IsBridge(mode string) bool
- func IsContainer(mode string) bool
- func IsHost(mode string) bool
- func IsNone(mode string) bool
- func Register(f SetupFunc)
- type AttachConfig
- type CniManager
- type CniMgr
- type Container
- func (c *Container) Config() *types.ContainerConfig
- func (c *Container) HostConfig() *types.HostConfig
- func (c *Container) ID() string
- func (c *Container) Image() string
- func (c *Container) IsCreated() bool
- func (c *Container) IsExited() bool
- func (c *Container) IsPaused() bool
- func (c *Container) IsRestarting() bool
- func (c *Container) IsRunning() bool
- func (c *Container) IsStopped() bool
- func (c *Container) Key() string
- func (c *Container) Name() string
- func (c *Container) StopTimeout() int64
- func (c *Container) Write(store *meta.Store) error
- type ContainerEvent
- type ContainerExecInspect
- type ContainerFilter
- type ContainerListOption
- type ContainerManager
- func (mgr *ContainerManager) Attach(ctx context.Context, name string, attach *AttachConfig) error
- func (mgr *ContainerManager) Create(ctx context.Context, name string, config *types.ContainerCreateConfig) (*types.ContainerCreateResp, error)
- func (mgr *ContainerManager) CreateExec(ctx context.Context, name string, config *types.ExecCreateConfig) (string, error)
- func (mgr *ContainerManager) Get(ctx context.Context, name string) (*ContainerMeta, error)
- func (mgr *ContainerManager) InspectExec(ctx context.Context, execid string) (*ContainerExecInspect, error)
- func (mgr *ContainerManager) List(ctx context.Context, filter ContainerFilter, option *ContainerListOption) ([]*ContainerMeta, error)
- func (mgr *ContainerManager) Pause(ctx context.Context, name string) error
- func (mgr *ContainerManager) Remove(ctx context.Context, name string, option *ContainerRemoveOption) error
- func (mgr *ContainerManager) Rename(ctx context.Context, oldName, newName string) error
- func (mgr *ContainerManager) Resize(ctx context.Context, name string, opts types.ResizeOptions) error
- func (mgr *ContainerManager) Restart(ctx context.Context, name string, timeout int64) error
- func (mgr *ContainerManager) Restore(ctx context.Context) error
- func (mgr *ContainerManager) Start(ctx context.Context, id, detachKeys string) (err error)
- func (mgr *ContainerManager) StartExec(ctx context.Context, execid string, config *types.ExecStartConfig, ...) error
- func (mgr *ContainerManager) Stop(ctx context.Context, name string, timeout int64) error
- func (mgr *ContainerManager) Top(ctx context.Context, name string, psArgs string) (*types.ContainerProcessList, error)
- func (mgr *ContainerManager) Unpause(ctx context.Context, name string) error
- func (mgr *ContainerManager) Update(ctx context.Context, name string, config *types.UpdateConfig) error
- func (mgr *ContainerManager) Upgrade(ctx context.Context, name string, config *types.ContainerUpgradeConfig) error
- type ContainerMeta
- type ContainerMgr
- type ContainerMonitor
- type ContainerRemoveOption
- type ContainerRestartPolicy
- type CriManager
- func (c *CriManager) Attach(ctx context.Context, r *runtime.AttachRequest) (*runtime.AttachResponse, error)
- func (c *CriManager) ContainerStats(ctx context.Context, r *runtime.ContainerStatsRequest) (*runtime.ContainerStatsResponse, error)
- func (c *CriManager) ContainerStatus(ctx context.Context, r *runtime.ContainerStatusRequest) (*runtime.ContainerStatusResponse, error)
- func (c *CriManager) CreateContainer(ctx context.Context, r *runtime.CreateContainerRequest) (*runtime.CreateContainerResponse, error)
- func (c *CriManager) Exec(ctx context.Context, r *runtime.ExecRequest) (*runtime.ExecResponse, error)
- func (c *CriManager) ExecSync(ctx context.Context, r *runtime.ExecSyncRequest) (*runtime.ExecSyncResponse, error)
- func (c *CriManager) ImageFsInfo(ctx context.Context, r *runtime.ImageFsInfoRequest) (*runtime.ImageFsInfoResponse, error)
- func (c *CriManager) ImageStatus(ctx context.Context, r *runtime.ImageStatusRequest) (*runtime.ImageStatusResponse, error)
- func (c *CriManager) ListContainerStats(ctx context.Context, r *runtime.ListContainerStatsRequest) (*runtime.ListContainerStatsResponse, error)
- func (c *CriManager) ListContainers(ctx context.Context, r *runtime.ListContainersRequest) (*runtime.ListContainersResponse, error)
- func (c *CriManager) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (*runtime.ListImagesResponse, error)
- func (c *CriManager) ListPodSandbox(ctx context.Context, r *runtime.ListPodSandboxRequest) (*runtime.ListPodSandboxResponse, error)
- func (c *CriManager) PodSandboxStatus(ctx context.Context, r *runtime.PodSandboxStatusRequest) (*runtime.PodSandboxStatusResponse, error)
- func (c *CriManager) PortForward(ctx context.Context, r *runtime.PortForwardRequest) (*runtime.PortForwardResponse, error)
- func (c *CriManager) PullImage(ctx context.Context, r *runtime.PullImageRequest) (*runtime.PullImageResponse, error)
- func (c *CriManager) RemoveContainer(ctx context.Context, r *runtime.RemoveContainerRequest) (*runtime.RemoveContainerResponse, error)
- func (c *CriManager) RemoveImage(ctx context.Context, r *runtime.RemoveImageRequest) (*runtime.RemoveImageResponse, error)
- func (c *CriManager) RemovePodSandbox(ctx context.Context, r *runtime.RemovePodSandboxRequest) (*runtime.RemovePodSandboxResponse, error)
- func (c *CriManager) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandboxRequest) (*runtime.RunPodSandboxResponse, error)
- func (c *CriManager) StartContainer(ctx context.Context, r *runtime.StartContainerRequest) (*runtime.StartContainerResponse, error)
- func (c *CriManager) Status(ctx context.Context, r *runtime.StatusRequest) (*runtime.StatusResponse, error)
- func (c *CriManager) StopContainer(ctx context.Context, r *runtime.StopContainerRequest) (*runtime.StopContainerResponse, error)
- func (c *CriManager) StopPodSandbox(ctx context.Context, r *runtime.StopPodSandboxRequest) (*runtime.StopPodSandboxResponse, error)
- func (c *CriManager) StreamServerStart() error
- func (c *CriManager) UpdateContainerResources(ctx context.Context, r *runtime.UpdateContainerResourcesRequest) (*runtime.UpdateContainerResourcesResponse, error)
- func (c *CriManager) UpdateRuntimeConfig(ctx context.Context, r *runtime.UpdateRuntimeConfigRequest) (*runtime.UpdateRuntimeConfigResponse, error)
- func (c *CriManager) Version(ctx context.Context, r *runtime.VersionRequest) (*runtime.VersionResponse, error)
- type CriMgr
- type CriWrapper
- func (c *CriWrapper) Attach(ctx context.Context, r *runtime.AttachRequest) (res *runtime.AttachResponse, err error)
- func (c *CriWrapper) ContainerStats(ctx context.Context, r *runtime.ContainerStatsRequest) (res *runtime.ContainerStatsResponse, err error)
- func (c *CriWrapper) ContainerStatus(ctx context.Context, r *runtime.ContainerStatusRequest) (res *runtime.ContainerStatusResponse, err error)
- func (c *CriWrapper) CreateContainer(ctx context.Context, r *runtime.CreateContainerRequest) (res *runtime.CreateContainerResponse, err error)
- func (c *CriWrapper) Exec(ctx context.Context, r *runtime.ExecRequest) (res *runtime.ExecResponse, err error)
- func (c *CriWrapper) ExecSync(ctx context.Context, r *runtime.ExecSyncRequest) (res *runtime.ExecSyncResponse, err error)
- func (c *CriWrapper) ImageFsInfo(ctx context.Context, r *runtime.ImageFsInfoRequest) (res *runtime.ImageFsInfoResponse, err error)
- func (c *CriWrapper) ImageStatus(ctx context.Context, r *runtime.ImageStatusRequest) (res *runtime.ImageStatusResponse, err error)
- func (c *CriWrapper) ListContainerStats(ctx context.Context, r *runtime.ListContainerStatsRequest) (res *runtime.ListContainerStatsResponse, err error)
- func (c *CriWrapper) ListContainers(ctx context.Context, r *runtime.ListContainersRequest) (res *runtime.ListContainersResponse, err error)
- func (c *CriWrapper) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (res *runtime.ListImagesResponse, err error)
- func (c *CriWrapper) ListPodSandbox(ctx context.Context, r *runtime.ListPodSandboxRequest) (res *runtime.ListPodSandboxResponse, err error)
- func (c *CriWrapper) PodSandboxStatus(ctx context.Context, r *runtime.PodSandboxStatusRequest) (res *runtime.PodSandboxStatusResponse, err error)
- func (c *CriWrapper) PortForward(ctx context.Context, r *runtime.PortForwardRequest) (res *runtime.PortForwardResponse, err error)
- func (c *CriWrapper) PullImage(ctx context.Context, r *runtime.PullImageRequest) (res *runtime.PullImageResponse, err error)
- func (c *CriWrapper) RemoveContainer(ctx context.Context, r *runtime.RemoveContainerRequest) (res *runtime.RemoveContainerResponse, err error)
- func (c *CriWrapper) RemoveImage(ctx context.Context, r *runtime.RemoveImageRequest) (res *runtime.RemoveImageResponse, err error)
- func (c *CriWrapper) RemovePodSandbox(ctx context.Context, r *runtime.RemovePodSandboxRequest) (res *runtime.RemovePodSandboxResponse, err error)
- func (c *CriWrapper) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandboxRequest) (res *runtime.RunPodSandboxResponse, err error)
- func (c *CriWrapper) StartContainer(ctx context.Context, r *runtime.StartContainerRequest) (res *runtime.StartContainerResponse, err error)
- func (c *CriWrapper) Status(ctx context.Context, r *runtime.StatusRequest) (res *runtime.StatusResponse, err error)
- func (c *CriWrapper) StopContainer(ctx context.Context, r *runtime.StopContainerRequest) (res *runtime.StopContainerResponse, err error)
- func (c *CriWrapper) StopPodSandbox(ctx context.Context, r *runtime.StopPodSandboxRequest) (res *runtime.StopPodSandboxResponse, err error)
- func (c *CriWrapper) StreamServerStart() (err error)
- func (c *CriWrapper) UpdateContainerResources(ctx context.Context, r *runtime.UpdateContainerResourcesRequest) (res *runtime.UpdateContainerResourcesResponse, err error)
- func (c *CriWrapper) UpdateRuntimeConfig(ctx context.Context, r *runtime.UpdateRuntimeConfigRequest) (res *runtime.UpdateRuntimeConfigResponse, err error)
- func (c *CriWrapper) Version(ctx context.Context, r *runtime.VersionRequest) (res *runtime.VersionResponse, err error)
- type ImageManager
- func (mgr *ImageManager) GetImage(ctx context.Context, idOrRef string) (*types.ImageInfo, error)
- func (mgr *ImageManager) ListImages(ctx context.Context, filters string) ([]types.ImageInfo, error)
- func (mgr *ImageManager) PullImage(pctx context.Context, image, tag string, authConfig *types.AuthConfig, ...) error
- func (mgr *ImageManager) RemoveImage(ctx context.Context, image *types.ImageInfo, name string, ...) error
- func (mgr *ImageManager) SearchImages(ctx context.Context, name string, registry string) ([]types.SearchResultItem, error)
- type ImageMgr
- type ImageRemoveOption
- type NetworkManager
- func (nm *NetworkManager) Controller() libnetwork.NetworkController
- func (nm *NetworkManager) Create(ctx context.Context, create apitypes.NetworkCreateConfig) (*types.Network, error)
- func (nm *NetworkManager) EndpointCreate(ctx context.Context, endpoint *types.Endpoint) (string, error)
- func (nm *NetworkManager) EndpointInfo(ctx context.Context, name string) (*types.Endpoint, error)
- func (nm *NetworkManager) EndpointList(ctx context.Context) ([]*types.Endpoint, error)
- func (nm *NetworkManager) EndpointRemove(ctx context.Context, endpoint *types.Endpoint) error
- func (nm *NetworkManager) Get(ctx context.Context, name string) (*types.Network, error)
- func (nm *NetworkManager) List(ctx context.Context, labels map[string]string) ([]*types.Network, error)
- func (nm *NetworkManager) Remove(ctx context.Context, name string) error
- type NetworkMgr
- type NoopCniManager
- func (n *NoopCniManager) GetPodNetworkStatus(netnsPath string) (string, error)
- func (n *NoopCniManager) Name() string
- func (n *NoopCniManager) SetUpPodNetwork(podNetwork *ocicni.PodNetwork) error
- func (n *NoopCniManager) Status() error
- func (n *NoopCniManager) TearDownPodNetwork(podNetwork *ocicni.PodNetwork) error
- type SandboxMeta
- type SetupFunc
- type SpecWrapper
- type SystemManager
- type SystemMgr
- type VolumeManager
- func (vm *VolumeManager) Attach(ctx context.Context, name string, options map[string]string) (*types.Volume, error)
- func (vm *VolumeManager) Create(ctx context.Context, name, driver string, options, labels map[string]string) error
- func (vm *VolumeManager) Detach(ctx context.Context, name string, options map[string]string) (*types.Volume, error)
- func (vm *VolumeManager) Get(ctx context.Context, name string) (*types.Volume, error)
- func (vm *VolumeManager) List(ctx context.Context, labels map[string]string) ([]string, error)
- func (vm *VolumeManager) Path(ctx context.Context, name string) (string, error)
- func (vm *VolumeManager) Remove(ctx context.Context, name string) error
- type VolumeMgr
Constants ¶
const ( // ProfileNamePrefix is the prefix for loading profiles on a localhost. Eg. localhost/profileName. ProfileNamePrefix = "localhost/" // ProfileRuntimeDefault indicates that we should use or create a runtime default profile. ProfileRuntimeDefault = "runtime/default" // ProfileDockerDefault indicates that we should use or create a docker default profile. ProfileDockerDefault = "docker/default" // ProfilePouchDefault indicates that we should use or create a pouch default profile. ProfilePouchDefault = "pouch/default" // ProfileNameUnconfined is a string indicating one should run a pod/containerd without a security profile. ProfileNameUnconfined = "unconfined" )
const (
// DefaultStopTimeout is the timeout (in seconds) for the syscall signal used to stop a container.
DefaultStopTimeout = 10
)
const ( // EvExit represents container's exit event. EvExit = iota )
Variables ¶
This section is empty.
Functions ¶
func IsContainer ¶
IsContainer is used to check network mode is container mode.
Types ¶
type AttachConfig ¶
type AttachConfig struct { Stdin bool Stdout bool Stderr bool // Attach using http. Hijack http.Hijacker Upgrade bool // Attach using memory buffer. MemBuffer *bytes.Buffer // Attach using streams. Streams *remotecommand.Streams // Attach to the container to get its log. CriLogFile *os.File }
AttachConfig wraps some infos of attaching.
type CniManager ¶
type CniManager struct {
// contains filtered or unexported fields
}
CniManager is an implementation of interface CniMgr.
func (*CniManager) GetPodNetworkStatus ¶
func (c *CniManager) GetPodNetworkStatus(netnsPath string) (string, error)
GetPodNetworkStatus is the method called to obtain the ipv4 or ipv6 addresses of the pod sandbox.
func (*CniManager) Name ¶
func (c *CniManager) Name() string
Name returns the plugin's name. This will be used when searching for a plugin by name, e.g.
func (*CniManager) SetUpPodNetwork ¶
func (c *CniManager) SetUpPodNetwork(podNetwork *ocicni.PodNetwork) error
SetUpPodNetwork is the method called after the sandbox container of the pod has been created but before the other containers of the pod are launched.
func (*CniManager) Status ¶
func (c *CniManager) Status() error
Status returns error if the network plugin is in error state.
func (*CniManager) TearDownPodNetwork ¶
func (c *CniManager) TearDownPodNetwork(podNetwork *ocicni.PodNetwork) error
TearDownPodNetwork is the method called before a pod's sandbox container will be deleted.
type CniMgr ¶
type CniMgr interface { // Name returns the plugin's name. This will be used when searching // for a plugin by name, e.g. Name() string // SetUpPodNetwork is the method called after the sandbox container of the // pod has been created but before the other containers of the pod // are launched. SetUpPodNetwork(podNetwork *ocicni.PodNetwork) error // TearDownPodNetwork is the method called before a pod's sandbox container will be deleted. TearDownPodNetwork(podNetwork *ocicni.PodNetwork) error // GetPodNetworkStatus is the method called to obtain the ipv4 or ipv6 addresses of the pod sandbox. GetPodNetworkStatus(netnsPath string) (string, error) // Status returns error if the network plugin is in error state. Status() error }
CniMgr as an interface defines all operations against CNI.
func NewCniManager ¶
NewCniManager initializes a brand new cni manager. If initialize failed, return NoopCniManager, we should not make pouchd creashed because of the failure of cni manager.
type Container ¶
Container represents the container instance in runtime.
func (*Container) Config ¶
func (c *Container) Config() *types.ContainerConfig
Config returns container's config.
func (*Container) HostConfig ¶
func (c *Container) HostConfig() *types.HostConfig
HostConfig returns container's hostconfig.
func (*Container) IsRestarting ¶
IsRestarting returns container is restarting or not.
func (*Container) StopTimeout ¶
StopTimeout returns the timeout (in seconds) used to stop the container.
type ContainerEvent ¶
type ContainerEvent struct { Kind int // contains filtered or unexported fields }
ContainerEvent represents the container's events.
func ContainerExitEvent ¶
func ContainerExitEvent(c *Container) *ContainerEvent
ContainerExitEvent represents container's exit event.
func (*ContainerEvent) String ¶
func (e *ContainerEvent) String() string
String returns container's event type as a string.
func (*ContainerEvent) WithHandle ¶
func (e *ContainerEvent) WithHandle(handle func(*Container) error) *ContainerEvent
WithHandle sets the event's handler.
type ContainerExecInspect ¶
ContainerExecInspect holds low-level information about exec command.
type ContainerFilter ¶
type ContainerFilter func(*ContainerMeta) bool
ContainerFilter defines a function to filter container in the store.
type ContainerListOption ¶
type ContainerListOption struct {
All bool
}
ContainerListOption wraps the container list interface params.
type ContainerManager ¶
type ContainerManager struct { // Store stores containers in Backend store. // Element operated in store must has a type of *ContainerMeta. // By default, Store will use local filesystem with json format to store containers. Store *meta.Store // Client is used to interact with containerd. Client ctrd.APIClient // NameToID stores relations between container's name and ID. // It is used to get container ID via container name. NameToID *collect.SafeMap ImageMgr ImageMgr VolumeMgr VolumeMgr NetworkMgr NetworkMgr IOs *containerio.Cache ExecProcesses *collect.SafeMap Config *config.Config // contains filtered or unexported fields }
ContainerManager is the default implement of interface ContainerMgr.
func NewContainerManager ¶
func NewContainerManager(ctx context.Context, store *meta.Store, cli ctrd.APIClient, imgMgr ImageMgr, volMgr VolumeMgr, netMgr NetworkMgr, cfg *config.Config, contPlugin plugins.ContainerPlugin) (*ContainerManager, error)
NewContainerManager creates a brand new container manager.
func (*ContainerManager) Attach ¶
func (mgr *ContainerManager) Attach(ctx context.Context, name string, attach *AttachConfig) error
Attach attachs a container's io.
func (*ContainerManager) Create ¶
func (mgr *ContainerManager) Create(ctx context.Context, name string, config *types.ContainerCreateConfig) (*types.ContainerCreateResp, error)
Create checks passed in parameters and create a Container object whose status is set at Created.
func (*ContainerManager) CreateExec ¶
func (mgr *ContainerManager) CreateExec(ctx context.Context, name string, config *types.ExecCreateConfig) (string, error)
CreateExec creates exec process's meta data.
func (*ContainerManager) Get ¶
func (mgr *ContainerManager) Get(ctx context.Context, name string) (*ContainerMeta, error)
Get the detailed information of container.
func (*ContainerManager) InspectExec ¶
func (mgr *ContainerManager) InspectExec(ctx context.Context, execid string) (*ContainerExecInspect, error)
InspectExec returns low-level information about exec command.
func (*ContainerManager) List ¶
func (mgr *ContainerManager) List(ctx context.Context, filter ContainerFilter, option *ContainerListOption) ([]*ContainerMeta, error)
List returns the container's list.
func (*ContainerManager) Pause ¶
func (mgr *ContainerManager) Pause(ctx context.Context, name string) error
Pause pauses a running container.
func (*ContainerManager) Remove ¶
func (mgr *ContainerManager) Remove(ctx context.Context, name string, option *ContainerRemoveOption) error
Remove removes a container, it may be running or stopped and so on.
func (*ContainerManager) Rename ¶
func (mgr *ContainerManager) Rename(ctx context.Context, oldName, newName string) error
Rename renames a container
func (*ContainerManager) Resize ¶
func (mgr *ContainerManager) Resize(ctx context.Context, name string, opts types.ResizeOptions) error
Resize resizes the size of a container tty.
func (*ContainerManager) Restore ¶
func (mgr *ContainerManager) Restore(ctx context.Context) error
Restore containers from meta store to memory and recover those container.
func (*ContainerManager) Start ¶
func (mgr *ContainerManager) Start(ctx context.Context, id, detachKeys string) (err error)
Start a pre created Container.
func (*ContainerManager) StartExec ¶
func (mgr *ContainerManager) StartExec(ctx context.Context, execid string, config *types.ExecStartConfig, attach *AttachConfig) error
StartExec executes a new process in container.
func (*ContainerManager) Top ¶
func (mgr *ContainerManager) Top(ctx context.Context, name string, psArgs string) (*types.ContainerProcessList, error)
Top lists the processes running inside of the given container
func (*ContainerManager) Unpause ¶
func (mgr *ContainerManager) Unpause(ctx context.Context, name string) error
Unpause unpauses a paused container.
func (*ContainerManager) Update ¶
func (mgr *ContainerManager) Update(ctx context.Context, name string, config *types.UpdateConfig) error
Update updates the configurations of a container.
func (*ContainerManager) Upgrade ¶
func (mgr *ContainerManager) Upgrade(ctx context.Context, name string, config *types.ContainerUpgradeConfig) error
Upgrade upgrades a container with new image and args.
type ContainerMeta ¶
type ContainerMeta struct { // app armor profile AppArmorProfile string `json:"AppArmorProfile,omitempty"` // seccomp profile SeccompProfile string `json:"SeccompProfile,omitempty"` // no new privileges NoNewPrivileges bool `json:"NoNewPrivileges,omitempty"` // The arguments to the command being run Args []string `json:"Args"` // config Config *types.ContainerConfig `json:"Config,omitempty"` // The time the container was created Created string `json:"Created,omitempty"` // driver Driver string `json:"Driver,omitempty"` // exec ids ExecIds string `json:"ExecIDs,omitempty"` // graph driver GraphDriver *types.GraphDriverData `json:"GraphDriver,omitempty"` // host config HostConfig *types.HostConfig `json:"HostConfig,omitempty"` // hostname path HostnamePath string `json:"HostnamePath,omitempty"` // hosts path HostsPath string `json:"HostsPath,omitempty"` // The ID of the container ID string `json:"Id,omitempty"` // The container's image Image string `json:"Image,omitempty"` // log path LogPath string `json:"LogPath,omitempty"` // mount label MountLabel string `json:"MountLabel,omitempty"` // mounts Mounts []*types.MountPoint `json:"Mounts"` // name Name string `json:"Name,omitempty"` // network settings NetworkSettings *types.NetworkSettings `json:"NetworkSettings,omitempty"` Node interface{} `json:"Node,omitempty"` // The path to the command being run Path string `json:"Path,omitempty"` // process label ProcessLabel string `json:"ProcessLabel,omitempty"` // resolv conf path ResolvConfPath string `json:"ResolvConfPath,omitempty"` // restart count RestartCount int64 `json:"RestartCount,omitempty"` // The total size of all the files in this container. SizeRootFs int64 `json:"SizeRootFs,omitempty"` // The size of files that have been created or changed by this container. SizeRw int64 `json:"SizeRw,omitempty"` // state State *types.ContainerState `json:"State,omitempty"` // BaseFS BaseFS string `json:"BaseFS, omitempty"` }
ContainerMeta represents the container's meta data.
func (*ContainerMeta) FormatStatus ¶
func (meta *ContainerMeta) FormatStatus() (string, error)
FormatStatus format container status
type ContainerMgr ¶
type ContainerMgr interface { // Create a new container. Create(ctx context.Context, name string, config *types.ContainerCreateConfig) (*types.ContainerCreateResp, error) // Start a container. Start(ctx context.Context, id, detachKeys string) error // Stop a container. Stop(ctx context.Context, name string, timeout int64) error // Pause a container. Pause(ctx context.Context, name string) error // Unpause a container. Unpause(ctx context.Context, name string) error // Attach a container. Attach(ctx context.Context, name string, attach *AttachConfig) error // List returns the list of containers. List(ctx context.Context, filter ContainerFilter, option *ContainerListOption) ([]*ContainerMeta, error) // CreateExec creates exec process's environment. CreateExec(ctx context.Context, name string, config *types.ExecCreateConfig) (string, error) // StartExec executes a new process in container. StartExec(ctx context.Context, execid string, config *types.ExecStartConfig, attach *AttachConfig) error // InspectExec returns low-level information about exec command. InspectExec(ctx context.Context, execid string) (*ContainerExecInspect, error) // Remove removes a container, it may be running or stopped and so on. Remove(ctx context.Context, name string, option *ContainerRemoveOption) error // Rename renames a container. Rename(ctx context.Context, oldName string, newName string) error // Get the detailed information of container. Get(ctx context.Context, name string) (*ContainerMeta, error) // Update updates the configurations of a container. Update(ctx context.Context, name string, config *types.UpdateConfig) error // Upgrade upgrades a container with new image and args. Upgrade(ctx context.Context, name string, config *types.ContainerUpgradeConfig) error // Top lists the processes running inside of the given container Top(ctx context.Context, name string, psArgs string) (*types.ContainerProcessList, error) // Resize resizes the size of container tty. Resize(ctx context.Context, name string, opts types.ResizeOptions) error // Restart restart a running container. Restart(ctx context.Context, name string, timeout int64) error }
ContainerMgr as an interface defines all operations against container.
type ContainerMonitor ¶
type ContainerMonitor struct {
// contains filtered or unexported fields
}
ContainerMonitor is used to monitor contianer's event.
func NewContainerMonitor ¶
func NewContainerMonitor() *ContainerMonitor
NewContainerMonitor returns one ContainerMonitor object.
func (*ContainerMonitor) PostEvent ¶
func (m *ContainerMonitor) PostEvent(ev *ContainerEvent)
PostEvent sends a event to monitor.
type ContainerRemoveOption ¶
ContainerRemoveOption wraps the container remove interface params.
type ContainerRestartPolicy ¶
type ContainerRestartPolicy types.RestartPolicy
ContainerRestartPolicy represents the policy is used to manage container.
func (ContainerRestartPolicy) IsAlways ¶
func (p ContainerRestartPolicy) IsAlways() bool
IsAlways returns the container need to be restarted or not.
func (ContainerRestartPolicy) IsNone ¶
func (p ContainerRestartPolicy) IsNone() bool
IsNone returns the container don't need to be restarted or not.
type CriManager ¶
type CriManager struct { ContainerMgr ContainerMgr ImageMgr ImageMgr CniMgr CniMgr // StreamServer is the stream server of CRI serves container streaming request. StreamServer stream.Server // SandboxBaseDir is the directory used to store sandbox files like /etc/hosts, /etc/resolv.conf, etc. SandboxBaseDir string // SandboxStore stores the configuration of sandboxes. SandboxStore *collect.SafeMap }
CriManager is an implementation of interface CriMgr.
func (*CriManager) Attach ¶
func (c *CriManager) Attach(ctx context.Context, r *runtime.AttachRequest) (*runtime.AttachResponse, error)
Attach prepares a streaming endpoint to attach to a running container, and returns the address.
func (*CriManager) ContainerStats ¶
func (c *CriManager) ContainerStats(ctx context.Context, r *runtime.ContainerStatsRequest) (*runtime.ContainerStatsResponse, error)
ContainerStats returns stats of the container. If the container does not exist, the call returns an error.
func (*CriManager) ContainerStatus ¶
func (c *CriManager) ContainerStatus(ctx context.Context, r *runtime.ContainerStatusRequest) (*runtime.ContainerStatusResponse, error)
ContainerStatus inspects the container and returns the status.
func (*CriManager) CreateContainer ¶
func (c *CriManager) CreateContainer(ctx context.Context, r *runtime.CreateContainerRequest) (*runtime.CreateContainerResponse, error)
CreateContainer creates a new container in the given PodSandbox.
func (*CriManager) Exec ¶
func (c *CriManager) Exec(ctx context.Context, r *runtime.ExecRequest) (*runtime.ExecResponse, error)
Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
func (*CriManager) ExecSync ¶
func (c *CriManager) ExecSync(ctx context.Context, r *runtime.ExecSyncRequest) (*runtime.ExecSyncResponse, error)
ExecSync executes a command in the container, and returns the stdout output. If command exits with a non-zero exit code, an error is returned.
func (*CriManager) ImageFsInfo ¶
func (c *CriManager) ImageFsInfo(ctx context.Context, r *runtime.ImageFsInfoRequest) (*runtime.ImageFsInfoResponse, error)
ImageFsInfo returns information of the filesystem that is used to store images.
func (*CriManager) ImageStatus ¶
func (c *CriManager) ImageStatus(ctx context.Context, r *runtime.ImageStatusRequest) (*runtime.ImageStatusResponse, error)
ImageStatus returns the status of the image, returns nil if the image isn't present.
func (*CriManager) ListContainerStats ¶
func (c *CriManager) ListContainerStats(ctx context.Context, r *runtime.ListContainerStatsRequest) (*runtime.ListContainerStatsResponse, error)
ListContainerStats returns stats of all running containers.
func (*CriManager) ListContainers ¶
func (c *CriManager) ListContainers(ctx context.Context, r *runtime.ListContainersRequest) (*runtime.ListContainersResponse, error)
ListContainers lists all containers matching the filter.
func (*CriManager) ListImages ¶
func (c *CriManager) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (*runtime.ListImagesResponse, error)
ListImages lists existing images.
func (*CriManager) ListPodSandbox ¶
func (c *CriManager) ListPodSandbox(ctx context.Context, r *runtime.ListPodSandboxRequest) (*runtime.ListPodSandboxResponse, error)
ListPodSandbox returns a list of Sandbox.
func (*CriManager) PodSandboxStatus ¶
func (c *CriManager) PodSandboxStatus(ctx context.Context, r *runtime.PodSandboxStatusRequest) (*runtime.PodSandboxStatusResponse, error)
PodSandboxStatus returns the status of the PodSandbox.
func (*CriManager) PortForward ¶
func (c *CriManager) PortForward(ctx context.Context, r *runtime.PortForwardRequest) (*runtime.PortForwardResponse, error)
PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.
func (*CriManager) PullImage ¶
func (c *CriManager) PullImage(ctx context.Context, r *runtime.PullImageRequest) (*runtime.PullImageResponse, error)
PullImage pulls an image with authentication config.
func (*CriManager) RemoveContainer ¶
func (c *CriManager) RemoveContainer(ctx context.Context, r *runtime.RemoveContainerRequest) (*runtime.RemoveContainerResponse, error)
RemoveContainer removes the container.
func (*CriManager) RemoveImage ¶
func (c *CriManager) RemoveImage(ctx context.Context, r *runtime.RemoveImageRequest) (*runtime.RemoveImageResponse, error)
RemoveImage removes the image.
func (*CriManager) RemovePodSandbox ¶
func (c *CriManager) RemovePodSandbox(ctx context.Context, r *runtime.RemovePodSandboxRequest) (*runtime.RemovePodSandboxResponse, error)
RemovePodSandbox removes the sandbox. If there are running containers in the sandbox, they should be forcibly removed.
func (*CriManager) RunPodSandbox ¶
func (c *CriManager) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandboxRequest) (*runtime.RunPodSandboxResponse, error)
RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure the sandbox is in ready state.
func (*CriManager) StartContainer ¶
func (c *CriManager) StartContainer(ctx context.Context, r *runtime.StartContainerRequest) (*runtime.StartContainerResponse, error)
StartContainer starts the container.
func (*CriManager) Status ¶
func (c *CriManager) Status(ctx context.Context, r *runtime.StatusRequest) (*runtime.StatusResponse, error)
Status returns the status of the runtime.
func (*CriManager) StopContainer ¶
func (c *CriManager) StopContainer(ctx context.Context, r *runtime.StopContainerRequest) (*runtime.StopContainerResponse, error)
StopContainer stops a running container with a grace period (i.e., timeout).
func (*CriManager) StopPodSandbox ¶
func (c *CriManager) StopPodSandbox(ctx context.Context, r *runtime.StopPodSandboxRequest) (*runtime.StopPodSandboxResponse, error)
StopPodSandbox stops the sandbox. If there are any running containers in the sandbox, they should be forcibly terminated.
func (*CriManager) StreamServerStart ¶
func (c *CriManager) StreamServerStart() error
StreamServerStart starts the stream server of CRI.
func (*CriManager) UpdateContainerResources ¶
func (c *CriManager) UpdateContainerResources(ctx context.Context, r *runtime.UpdateContainerResourcesRequest) (*runtime.UpdateContainerResourcesResponse, error)
UpdateContainerResources updates ContainerConfig of the container.
func (*CriManager) UpdateRuntimeConfig ¶
func (c *CriManager) UpdateRuntimeConfig(ctx context.Context, r *runtime.UpdateRuntimeConfigRequest) (*runtime.UpdateRuntimeConfigResponse, error)
UpdateRuntimeConfig updates the runtime config. Currently only handles podCIDR updates.
func (*CriManager) Version ¶
func (c *CriManager) Version(ctx context.Context, r *runtime.VersionRequest) (*runtime.VersionResponse, error)
Version returns the runtime name, runtime version and runtime API version.
type CriMgr ¶
type CriMgr interface { // RuntimeServiceServer is interface of CRI runtime service. runtime.RuntimeServiceServer // ImageServiceServer is interface of CRI image service. runtime.ImageServiceServer // StreamServerStart starts the stream server of CRI. StreamServerStart() error }
CriMgr as an interface defines all operations against CRI.
func NewCriManager ¶
NewCriManager creates a brand new cri manager.
type CriWrapper ¶
type CriWrapper struct {
*CriManager
}
CriWrapper wraps CriManager and logs each operation for debugging convenice.
func NewCriWrapper ¶
func NewCriWrapper(c *CriManager) *CriWrapper
NewCriWrapper creates a brand new CriWrapper.
func (*CriWrapper) Attach ¶
func (c *CriWrapper) Attach(ctx context.Context, r *runtime.AttachRequest) (res *runtime.AttachResponse, err error)
Attach prepares a streaming endpoint to attach to a running container, and returns the address.
func (*CriWrapper) ContainerStats ¶
func (c *CriWrapper) ContainerStats(ctx context.Context, r *runtime.ContainerStatsRequest) (res *runtime.ContainerStatsResponse, err error)
ContainerStats returns stats of the container. If the container does not exist, the call returns an error.
func (*CriWrapper) ContainerStatus ¶
func (c *CriWrapper) ContainerStatus(ctx context.Context, r *runtime.ContainerStatusRequest) (res *runtime.ContainerStatusResponse, err error)
ContainerStatus inspects the container and returns the status.
func (*CriWrapper) CreateContainer ¶
func (c *CriWrapper) CreateContainer(ctx context.Context, r *runtime.CreateContainerRequest) (res *runtime.CreateContainerResponse, err error)
CreateContainer creates a new container in the given PodSandbox.
func (*CriWrapper) Exec ¶
func (c *CriWrapper) Exec(ctx context.Context, r *runtime.ExecRequest) (res *runtime.ExecResponse, err error)
Exec prepares a streaming endpoint to execute a command in the container, and returns the address.
func (*CriWrapper) ExecSync ¶
func (c *CriWrapper) ExecSync(ctx context.Context, r *runtime.ExecSyncRequest) (res *runtime.ExecSyncResponse, err error)
ExecSync executes a command in the container, and returns the stdout output. If command exits with a non-zero exit code, an error is returned.
func (*CriWrapper) ImageFsInfo ¶
func (c *CriWrapper) ImageFsInfo(ctx context.Context, r *runtime.ImageFsInfoRequest) (res *runtime.ImageFsInfoResponse, err error)
ImageFsInfo returns information of the filesystem that is used to store images.
func (*CriWrapper) ImageStatus ¶
func (c *CriWrapper) ImageStatus(ctx context.Context, r *runtime.ImageStatusRequest) (res *runtime.ImageStatusResponse, err error)
ImageStatus returns the status of the image, returns nil if the image isn't present.
func (*CriWrapper) ListContainerStats ¶
func (c *CriWrapper) ListContainerStats(ctx context.Context, r *runtime.ListContainerStatsRequest) (res *runtime.ListContainerStatsResponse, err error)
ListContainerStats returns stats of all running containers.
func (*CriWrapper) ListContainers ¶
func (c *CriWrapper) ListContainers(ctx context.Context, r *runtime.ListContainersRequest) (res *runtime.ListContainersResponse, err error)
ListContainers lists all containers matching the filter.
func (*CriWrapper) ListImages ¶
func (c *CriWrapper) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (res *runtime.ListImagesResponse, err error)
ListImages lists existing images.
func (*CriWrapper) ListPodSandbox ¶
func (c *CriWrapper) ListPodSandbox(ctx context.Context, r *runtime.ListPodSandboxRequest) (res *runtime.ListPodSandboxResponse, err error)
ListPodSandbox returns a list of Sandbox.
func (*CriWrapper) PodSandboxStatus ¶
func (c *CriWrapper) PodSandboxStatus(ctx context.Context, r *runtime.PodSandboxStatusRequest) (res *runtime.PodSandboxStatusResponse, err error)
PodSandboxStatus returns the status of the PodSandbox.
func (*CriWrapper) PortForward ¶
func (c *CriWrapper) PortForward(ctx context.Context, r *runtime.PortForwardRequest) (res *runtime.PortForwardResponse, err error)
PortForward prepares a streaming endpoint to forward ports from a PodSandbox, and returns the address.
func (*CriWrapper) PullImage ¶
func (c *CriWrapper) PullImage(ctx context.Context, r *runtime.PullImageRequest) (res *runtime.PullImageResponse, err error)
PullImage pulls an image with authentication config.
func (*CriWrapper) RemoveContainer ¶
func (c *CriWrapper) RemoveContainer(ctx context.Context, r *runtime.RemoveContainerRequest) (res *runtime.RemoveContainerResponse, err error)
RemoveContainer removes the container.
func (*CriWrapper) RemoveImage ¶
func (c *CriWrapper) RemoveImage(ctx context.Context, r *runtime.RemoveImageRequest) (res *runtime.RemoveImageResponse, err error)
RemoveImage removes the image.
func (*CriWrapper) RemovePodSandbox ¶
func (c *CriWrapper) RemovePodSandbox(ctx context.Context, r *runtime.RemovePodSandboxRequest) (res *runtime.RemovePodSandboxResponse, err error)
RemovePodSandbox removes the sandbox. If there are running containers in the sandbox, they should be forcibly removed.
func (*CriWrapper) RunPodSandbox ¶
func (c *CriWrapper) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandboxRequest) (res *runtime.RunPodSandboxResponse, err error)
RunPodSandbox creates and starts a pod-level sandbox. Runtimes should ensure the sandbox is in ready state.
func (*CriWrapper) StartContainer ¶
func (c *CriWrapper) StartContainer(ctx context.Context, r *runtime.StartContainerRequest) (res *runtime.StartContainerResponse, err error)
StartContainer starts the container.
func (*CriWrapper) Status ¶
func (c *CriWrapper) Status(ctx context.Context, r *runtime.StatusRequest) (res *runtime.StatusResponse, err error)
Status returns the status of the runtime.
func (*CriWrapper) StopContainer ¶
func (c *CriWrapper) StopContainer(ctx context.Context, r *runtime.StopContainerRequest) (res *runtime.StopContainerResponse, err error)
StopContainer stops a running container with a grace period (i.e., timeout).
func (*CriWrapper) StopPodSandbox ¶
func (c *CriWrapper) StopPodSandbox(ctx context.Context, r *runtime.StopPodSandboxRequest) (res *runtime.StopPodSandboxResponse, err error)
StopPodSandbox stops the sandbox. If there are any running containers in the sandbox, they should be forcibly terminated.
func (*CriWrapper) StreamServerStart ¶
func (c *CriWrapper) StreamServerStart() (err error)
StreamServerStart starts the stream server of CRI.
func (*CriWrapper) UpdateContainerResources ¶
func (c *CriWrapper) UpdateContainerResources(ctx context.Context, r *runtime.UpdateContainerResourcesRequest) (res *runtime.UpdateContainerResourcesResponse, err error)
UpdateContainerResources updates ContainerConfig of the container.
func (*CriWrapper) UpdateRuntimeConfig ¶
func (c *CriWrapper) UpdateRuntimeConfig(ctx context.Context, r *runtime.UpdateRuntimeConfigRequest) (res *runtime.UpdateRuntimeConfigResponse, err error)
UpdateRuntimeConfig updates the runtime config. Currently only handles podCIDR updates.
func (*CriWrapper) Version ¶
func (c *CriWrapper) Version(ctx context.Context, r *runtime.VersionRequest) (res *runtime.VersionResponse, err error)
Version returns the runtime name, runtime version and runtime API version.
type ImageManager ¶
type ImageManager struct { // DefaultRegistry is the default registry of daemon. // When users do not specify image repo in image name, // daemon will automatically pull images with DefaultRegistry and DefaultNamespace. DefaultRegistry string // DefaultNamespace is the default namespace used in DefaultRegistry. DefaultNamespace string // contains filtered or unexported fields }
ImageManager is an implementation of interface ImageMgr. It is a stateless manager, and it will never store image details. When image details needed from users, ImageManager interacts with containerd to get details.
func NewImageManager ¶
NewImageManager initializes a brand new image manager.
func (*ImageManager) ListImages ¶
ListImages lists images stored by containerd.
func (*ImageManager) PullImage ¶
func (mgr *ImageManager) PullImage(pctx context.Context, image, tag string, authConfig *types.AuthConfig, out io.Writer) error
PullImage pulls images from specified registry.
func (*ImageManager) RemoveImage ¶
func (mgr *ImageManager) RemoveImage(ctx context.Context, image *types.ImageInfo, name string, option *ImageRemoveOption) error
RemoveImage deletes an image by reference.
func (*ImageManager) SearchImages ¶
func (mgr *ImageManager) SearchImages(ctx context.Context, name string, registry string) ([]types.SearchResultItem, error)
SearchImages searches imaged from specified registry.
type ImageMgr ¶
type ImageMgr interface { // PullImage pulls images from specified registry. PullImage(ctx context.Context, image, tag string, authConfig *types.AuthConfig, out io.Writer) error // ListImages lists images stored by containerd. ListImages(ctx context.Context, filters string) ([]types.ImageInfo, error) // Search Images from specified registry. SearchImages(ctx context.Context, name string, registry string) ([]types.SearchResultItem, error) // GetImage gets image by image id or ref. GetImage(ctx context.Context, idOrRef string) (*types.ImageInfo, error) // RemoveImage deletes an image by reference. RemoveImage(ctx context.Context, image *types.ImageInfo, name string, option *ImageRemoveOption) error }
ImageMgr as an interface defines all operations against images.
type ImageRemoveOption ¶
type ImageRemoveOption struct {
Force bool
}
ImageRemoveOption wraps the image remove interface params.
type NetworkManager ¶
type NetworkManager struct {
// contains filtered or unexported fields
}
NetworkManager is the default implement of interface NetworkMgr.
func NewNetworkManager ¶
NewNetworkManager creates a brand new network manager.
func (*NetworkManager) Controller ¶
func (nm *NetworkManager) Controller() libnetwork.NetworkController
Controller returns the network controller.
func (*NetworkManager) Create ¶
func (nm *NetworkManager) Create(ctx context.Context, create apitypes.NetworkCreateConfig) (*types.Network, error)
Create is used to create network.
func (*NetworkManager) EndpointCreate ¶
func (nm *NetworkManager) EndpointCreate(ctx context.Context, endpoint *types.Endpoint) (string, error)
EndpointCreate is used to create network endpoint.
func (*NetworkManager) EndpointInfo ¶
EndpointInfo returns the information of endpoint that specified name/id.
func (*NetworkManager) EndpointList ¶
EndpointList returns all endpoints.
func (*NetworkManager) EndpointRemove ¶
EndpointRemove is used to remove network endpoint.
type NetworkMgr ¶
type NetworkMgr interface { // Create is used to create network. Create(ctx context.Context, create apitypes.NetworkCreateConfig) (*types.Network, error) // NetworkRemove is used to delete an existing network. Remove(ctx context.Context, name string) error // List returns all networks on this host. List(ctx context.Context, labels map[string]string) ([]*types.Network, error) // Get returns the information of network that specified name/id. Get(ctx context.Context, name string) (*types.Network, error) // EndpointCreate is used to create network endpoint. EndpointCreate(ctx context.Context, endpoint *types.Endpoint) (string, error) // EndpointRemove is used to remove network endpoint. EndpointRemove(ctx context.Context, endpoint *types.Endpoint) error // EndpointList returns all endpoints. EndpointList(ctx context.Context) ([]*types.Endpoint, error) // EndpointInfo returns the information of endpoint that specified name/id. EndpointInfo(ctx context.Context, name string) (*types.Endpoint, error) // Controller returns the network controller. Controller() libnetwork.NetworkController }
NetworkMgr defines interface to manage container network.
type NoopCniManager ¶
type NoopCniManager struct { }
NoopCniManager is an implementation of interface CniMgr, but makes no operation.
func (*NoopCniManager) GetPodNetworkStatus ¶
func (n *NoopCniManager) GetPodNetworkStatus(netnsPath string) (string, error)
GetPodNetworkStatus of NoopCniManager makes no operation.
func (*NoopCniManager) Name ¶
func (n *NoopCniManager) Name() string
Name of NoopCniManager return the name of plugin as "none".
func (*NoopCniManager) SetUpPodNetwork ¶
func (n *NoopCniManager) SetUpPodNetwork(podNetwork *ocicni.PodNetwork) error
SetUpPodNetwork of NoopCniManager makes no operation.
func (*NoopCniManager) Status ¶
func (n *NoopCniManager) Status() error
Status of NoopCniManager makes no operation.
func (*NoopCniManager) TearDownPodNetwork ¶
func (n *NoopCniManager) TearDownPodNetwork(podNetwork *ocicni.PodNetwork) error
TearDownPodNetwork of NoopCniManager makes no operation.
type SandboxMeta ¶
type SandboxMeta struct { // Config is CRI sandbox config. Config *runtime.PodSandboxConfig // NetNSPath is the network namespace used by the sandbox. NetNSPath string }
SandboxMeta represents the sandbox's meta data.
type SetupFunc ¶
type SetupFunc func(ctx context.Context, m *ContainerMeta, s *SpecWrapper) error
SetupFunc defines spec setup function type.
type SpecWrapper ¶
type SpecWrapper struct {
// contains filtered or unexported fields
}
SpecWrapper wraps the container's specs and add manager operations.
type SystemManager ¶
type SystemManager struct {
// contains filtered or unexported fields
}
SystemManager is an instance of system management.
func NewSystemManager ¶
NewSystemManager creates a brand new system manager.
func (*SystemManager) Auth ¶
func (mgr *SystemManager) Auth(auth *types.AuthConfig) (string, error)
Auth to log in to a registry.
func (*SystemManager) Info ¶
func (mgr *SystemManager) Info() (types.SystemInfo, error)
Info shows system information of daemon.
func (*SystemManager) Version ¶
func (mgr *SystemManager) Version() (types.SystemVersion, error)
Version shows version of daemon.
type SystemMgr ¶
type SystemMgr interface { Info() (types.SystemInfo, error) Version() (types.SystemVersion, error) Auth(*types.AuthConfig) (string, error) }
SystemMgr as an interface defines all operations against host.
type VolumeManager ¶
type VolumeManager struct {
// contains filtered or unexported fields
}
VolumeManager is the default implement of interface VolumeMgr.
func NewVolumeManager ¶
func NewVolumeManager(cfg volume.Config) (*VolumeManager, error)
NewVolumeManager creates a brand new volume manager.
func (*VolumeManager) Attach ¶
func (vm *VolumeManager) Attach(ctx context.Context, name string, options map[string]string) (*types.Volume, error)
Attach is used to bind a volume to container.
func (*VolumeManager) Create ¶
func (vm *VolumeManager) Create(ctx context.Context, name, driver string, options, labels map[string]string) error
Create is used to create volume.
func (*VolumeManager) Detach ¶
func (vm *VolumeManager) Detach(ctx context.Context, name string, options map[string]string) (*types.Volume, error)
Detach is used to unbind a volume from container.
type VolumeMgr ¶
type VolumeMgr interface { // Create is used to create volume. Create(ctx context.Context, name, driver string, options, labels map[string]string) error // Remove is used to delete an existing volume. Remove(ctx context.Context, name string) error // List returns all volumes on this host. List(ctx context.Context, labels map[string]string) ([]string, error) // Get returns the information of volume that specified name/id. Get(ctx context.Context, name string) (*types.Volume, error) // Path returns the mount path of volume. Path(ctx context.Context, name string) (string, error) // Attach is used to bind a volume to container. Attach(ctx context.Context, name string, options map[string]string) (*types.Volume, error) // Detach is used to unbind a volume from container. Detach(ctx context.Context, name string, options map[string]string) (*types.Volume, error) }
VolumeMgr defines interface to manage container volume.
Source Files ¶
- container.go
- container_monitor.go
- container_rich_mode.go
- container_types.go
- container_utils.go
- cri.go
- cri_network.go
- cri_stream.go
- cri_types.go
- cri_utils.go
- cri_wrapper.go
- image.go
- image_types.go
- image_utils.go
- network.go
- network_utils.go
- spec.go
- spec_annotations.go
- spec_blkio.go
- spec_cgroup_cpu.go
- spec_cgroup_memory.go
- spec_devices.go
- spec_hook.go
- spec_linux.go
- spec_namespace.go
- spec_network.go
- spec_process.go
- spec_root.go
- spec_volume.go
- system.go
- volume.go