Documentation ¶
Index ¶
- func GetTaskPID(path string) int
- func GetTaskStatus(cgrouppath string) (string, error)
- func PathExists(path string, isfile bool) bool
- func ReadCgroupEvents(path string) (int, int, error)
- type Container
- type ContainerExplorer
- type Content
- type Image
- type SnapshotKeyInfo
- type State
- type SupportContainer
- func (sc *SupportContainer) IsSupportContainer(ctr Container) bool
- func (sc *SupportContainer) JSON() string
- func (sc *SupportContainer) SupportContainerImage(image string) bool
- func (sc *SupportContainer) SupportContainerLabel(label string) bool
- func (sc *SupportContainer) SupportContainerName(name string) bool
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTaskStatus ¶
GetTaskStatus returns task status
func PathExists ¶
PathExists returns true if the path exists
Types ¶
type Container ¶
type Container struct { Namespace string Hostname string ImageBase string SupportContainer bool ContainerType string ProcessID int Status string // containerd specific fields containers.Container // docker specific fields Running bool ExposedPorts []string }
Container provides information about a container.
type ContainerExplorer ¶
type ContainerExplorer interface { // SnapshotRoot returns the directory containing snapshots and snapshot // database i.e. metadata.db // // SnapshotRoot is required for the containers managed using containerd. SnapshotRoot(snapshotter string) string // ListNamespaces returns all the namespaces in the metadata file i.e. // meta.db ListNamespaces(ctx context.Context) ([]string, error) // ListContainers returns all the containers in all the namespaces. // // ListContainers returns the ContainerExplorer's Containers structure // that holds additional information about the containers. ListContainers(ctx context.Context) ([]Container, error) // ListImages returns content information ListImages(ctx context.Context) ([]Image, error) // ListSnapshots returns the snapshot information ListSnapshots(ctx context.Context) ([]SnapshotKeyInfo, error) // ListContent returns information about content ListContent(ctx context.Context) ([]Content, error) // ListTasks returns the container task status ListTasks(ctx context.Context) ([]Task, error) // InfoContainer returns container internal information InfoContainer(ctx context.Context, containerid string, spec bool) (interface{}, error) // MountContainer mounts a container to the specified path MountContainer(ctx context.Context, containerid string, mountpoint string) error // MountAllContainer mounts all containers to the specfied path MountAllContainers(ctx context.Context, mountpoint string, skipsupportcontainers bool) error // Close releases the internal resources Close() error }
ContainerExplorer defines the methods required to explore a container.
type SnapshotKeyInfo ¶
type SnapshotKeyInfo struct { Namespace string // namespace only used in meta.db Snapshotter string // only used in meta.db Key string // snapshot key ID uint64 // File system ID. Only used in metadata.db Name string // snapshot name. Only used in meta.db Parent string // snapshot parent Kind snapshots.Kind // snapshot kind Inodes []int64 // Inode numbers. Only in metadata.db Size uint64 // Only in metadata.db OverlayPath string // Custom field added by container explorer Labels map[string]string // mapped labels Children []string // array of <snapshot key>. Only in meta.db CreatedAt time.Time // created timestamp UpdatedAt time.Time // updated timestamp }
SnapshotKeyInfo provides information about snapshots.
SnapshotKeyInfo contains information found in containerd metadata (meta.db) and snapshot database (metadata.db).
type State ¶
type State struct { ID string `json:"state,omitempty"` InitProcessPid int `json:"init_process_pid"` InitProcessstart int `json:"init_process_start"` Created time.Time `json:"created"` Config map[string]interface{} `json:"config"` Rootless bool `json:"rootless"` CgroupPaths map[string]string `json:"cgroup_paths"` NamespacePaths map[string]string `json:"namespace_paths"` ExternalDescriptors []string `json:"external_descriptors"` IntelRdtPath string `json:"intel_rdt_path"` }
State holds runc state information.
runc state file is located at `/run/containerd/runc/<namespace>/<container_id>/state.json`.
The State structure only maps the required attributes form state.json.
type SupportContainer ¶
type SupportContainer struct { ContainerNames []string `json:"names" yaml:"names"` ImageNames []string `json:"images" yaml:"images"` Labels []string `json:"labels" yaml:"labels"` }
SupportContainer contains information about support container.
A support container can be identified by: - Container or pod hostname - Image name - Container labels or annotations
func LoadSupportContainerFromFile ¶
func LoadSupportContainerFromFile(path string) (SupportContainer, error)
LoadSupportContainerFromFile loads the support container information from a yaml file on disk.
func NewSupportContainer ¶
func NewSupportContainer(path string) (*SupportContainer, error)
NewSupportContainer returns the support container instance.
func (*SupportContainer) IsSupportContainer ¶
func (sc *SupportContainer) IsSupportContainer(ctr Container) bool
IsSupportContainer returns if the support container
func (*SupportContainer) JSON ¶
func (sc *SupportContainer) JSON() string
JSON returns the data in json
func (*SupportContainer) SupportContainerImage ¶
func (sc *SupportContainer) SupportContainerImage(image string) bool
SupportContainerImage returns true if the supplied image is a known support container image.
func (*SupportContainer) SupportContainerLabel ¶
func (sc *SupportContainer) SupportContainerLabel(label string) bool
SupportContainerLabel returns true if the supplied name is a known support container label
func (*SupportContainer) SupportContainerName ¶
func (sc *SupportContainer) SupportContainerName(name string) bool
SupportContainerName returns true if the supplied name is a known support container name.