container

package
v5.0.0-preview.1+incom... Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2022 License: Apache-2.0 Imports: 34 Imported by: 32

Documentation

Index

Constants

View Source
const (
	DockerUCPInstanceIDKey   string = "com.docker.ucp.InstanceID"
	DockerUCPVersionKey      string = "com.docker.ucp.version"
	DockerUCPCollectionKey   string = "com.docker.ucp.collection"
	DockerSwarmServiceKey    string = "com.docker.swarm.service.name"
	DockerSwarmTaskName      string = "com.docker.swarm.task.name"
	DockerSwarmTaskID        string = "com.docker.swarm.task.id"
	DockerComposeProjectKey  string = "com.docker.compose.project"
	DockerComposeServiceKey  string = "com.docker.compose.service"
	DockerIngressNetworkName string = "ingress"
	DockerIngressSandboxName string = "ingress-sbox"
	DockerIngressEPName      string = "ingress-endpoint"
)
View Source
const (
	RancherCNINetwork          string = "io.rancher.cni.network"
	RancherContainerNetwork    string = "io.rancher.container.network"
	RancherKeyContainerIP      string = "io.rancher.container.ip"
	RancherKeyContainerSystem  string = "io.rancher.container.system"
	RancherKeyContainerName    string = "io.rancher.container.name"
	RancherKeyStackName        string = "io.rancher.stack.name"
	RancherKeyStackServiceName string = "io.rancher.stack_service.name"
)
View Source
const (
	KubeKeyPodNamespace    string = "io.kubernetes.pod.namespace"
	KubeKeyPodName         string = "io.kubernetes.pod.name"
	KubeKeyDeployConfig    string = "deploymentconfig"
	KubeKeyPodHash         string = "pod-template-hash"
	KubeKeyContainerName   string = "io.kubernetes.container.name"
	KubeNamespaceSystem    string = "kube-system"
	KubeNamespaceCatalog   string = "kube-service-catalog"
	KubeContainerNamePod   string = "POD"
	KubeContainerNameProxy string = "kube-proxy"
	KubePodNamePrefixProxy string = "kube-proxy"
)
View Source
const (
	KubeLinkerdProxyName        string = "linkerd-proxy"
	KubeLinkerdSysPodNamespace  string = "linkerd"
	KubeIstioProxyName          string = "istio-proxy"
	KubeProxyMeshLoMacStr       string = "6c:6b:73:74:%02x:%02x"
	KubeProxyMeshLoMacPrefix    string = "6c:6b:73:74"
	KubeIstioSystemPodNamespace string = "istio-system"
	KubeIstioSystemIngGwPrefix  string = "istio-ingressgateway"
	KubeIstioSystemEgGwPrefix   string = "istio-egressgateway"
	KubeAwsProxyName            string = "envoy"
)
View Source
const (
	OpenShiftPodImage string = "openshift/origin-pod"
	OpenShiftPodTag   string = "io.openshift.tags"
)
View Source
const (
	KubeRancherPodNamespace     string = "cattle-system"
	KubeRancherKeyStackName     string = "annotation.io.rancher.stack.name"
	KubeRancherIngressNamespace string = "ingress-nginx"
)
View Source
const (
	AliyunSystem string = "aliyun.system"
	AliyunAddon  string = "aliyun.addon"
)
View Source
const (
	ECSAgentImagePrefix string = "amazon/amazon-ecs-agent:"
	ECSTaskDefinition   string = "com.amazonaws.ecs.task-definition-family"
	ECSContainerName    string = "com.amazonaws.ecs.container-name"
	ECSCluster          string = "com.amazonaws.ecs.cluster"
)
View Source
const (
	PlatformContainerNone                = ""
	PlatformContainerNeuVector           = "NeuVector"
	PlatformContainerDockerUCPCtrl       = "Docker-UCP-Controller"
	PlatformContainerDockerUCPSwarm      = "Docker-UCP-Swarm"
	PlatformContainerDockerUCPOther      = "Docker-UCP-Other"
	PlatformContainerDockerDTR           = "Docker-DTR"
	PlatformContainerDockerSystem        = "Docker-System" // generic
	PlatformContainerRancherInfra        = "Rancher"
	PlatformContainerRancherAgent        = "Rancher-Agent"
	PlatformContainerRancherNetworkAgent = "Rancher-Network-Agent"
	PlatformContainerOpenshift           = "Openshift"
	PlatformContainerKubeInfra           = "Kubernetes"
	PlatformContainerKubeInfraPause      = "Kubernetes-System-POD"
	PlatformContainerAliyunAgent         = "Aliyu-Agent"
	PlatformContainerAliyunAddon         = "Aliyu-Addon"
	PlatformContainerECSAgent            = "ECS-Agent"
	PlatformContainerIstioInfra          = "Istio-System-POD"
	PlatformContainerLinkerdInfra        = "Linkerd-System-POD"
)
View Source
const (
	RuntimeDocker     = "docker"
	RuntimeContainerd = "containerd"
	RuntimeCriO       = "cri-o"
)
View Source
const (
	DockerNetworkGlobal = "global"
	DockerNetworkSwarm  = "swarm"
	DockerNetworkLocal  = "local"
)
View Source
const (
	EventContainerStart   = "start"
	EventContainerStop    = "stop"
	EventContainerDelete  = "delete"
	EventContainerCopyIn  = "copy-in"
	EventContainerCopyOut = "copy-out"
	EventSocketError      = "socket-err"
	EventServiceCreate    = "create-service"
	EventServiceUpdate    = "update-service"
	EventServiceDelete    = "delete-service"
	EventNetworkCreate    = "create-network"
	EventNetworkDelete    = "delete-network"
)
View Source
const (
	RancherOverlayNetworkName string = "rancher"
)

Variables

View Source
var (
	ErrUnknownRuntime     = errors.New("Unknown container runtime")
	ErrMethodNotSupported = errors.New("Method not supported")
	ErrNotFound           = errors.New("Not found")
)

Functions

func GetAddressAndDialer

func GetAddressAndDialer(endpoint string) (string, func(addr string, timeout time.Duration) (net.Conn, error), error)

GetAddressAndDialer returns the address parsed from the given endpoint and a dialer.

func LocalEndpoint

func LocalEndpoint(path, file string) string

LocalEndpoint returns the full path to a unix socket at the given endpoint

func ShortContainerId

func ShortContainerId(id string) string

func TrimContainerImageRepo

func TrimContainerImageRepo(image string) string

func TrimContainerImageVersion

func TrimContainerImageVersion(image string) string

func TrimImageID

func TrimImageID(in string) string

Types

type ContainerMeta

type ContainerMeta struct {
	ID       string
	Name     string
	Image    string
	Labels   map[string]string
	Hostname string
	Pid      int
	Envs     []string
	PidMode  string
	NetMode  string
	Sandbox  string
	// contains filtered or unexported fields
}

type ContainerMetaExtra

type ContainerMetaExtra struct {
	ContainerMeta
	ImageID     string
	ImageDigest string
	Author      string
	Privileged  bool
	ExitCode    int
	Running     bool
	CreatedAt   time.Time
	StartedAt   time.Time
	FinishedAt  time.Time
	MemoryLimit int64
	CPUs        string
	ProxyMesh   bool
	Sidecar     bool
	RunAsRoot   bool
	// network
	IPAddress   string
	IPPrefixLen int
	MappedPorts map[share.CLUSProtoPort]*share.CLUSMappedPort
	Networks    utils.Set
	LogPath     string
}

func SortContainers

func SortContainers(cs []*ContainerMetaExtra) []*ContainerMetaExtra

type Event

type Event string

type EventCallback

type EventCallback func(event Event, id string, pid int)

type ImageHistory

type ImageHistory struct {
	ID   string
	Cmd  string
	Size int64
}

type ImageMeta

type ImageMeta struct {
	ID        string
	Digest    string
	CreatedAt time.Time
	Size      int64
	Env       []string
	Author    string
	Labels    map[string]string
	RepoTags  []string
	Layers    []string
}

type Network

type Network struct {
	Name     string
	ID       string
	Scope    string
	Driver   string
	Subnets  []*net.IPNet
	Gateways []net.IP
}

type NetworkEndpoint

type NetworkEndpoint struct {
	ID    string
	Name  string
	MAC   net.HardwareAddr
	IPNet *net.IPNet
}

type Runtime

type Runtime interface {
	String() string
	MonitorEvent(cb EventCallback, cpath bool) error
	StopMonitorEvent()
	GetHost() (*share.CLUSHost, error)
	GetDevice(id string) (*share.CLUSDevice, *ContainerMetaExtra, error)
	GetContainer(id string) (*ContainerMetaExtra, error)
	ListContainers(runningOnly bool) ([]*ContainerMeta, error)
	ListContainerIDs() utils.Set
	GetImageHistory(name string) ([]*ImageHistory, error)
	GetImage(name string) (*ImageMeta, error)
	GetImageFile(id string) (io.ReadCloser, error)
	GetNetworkEndpoint(netName, container, epName string) (*NetworkEndpoint, error)
	ListNetworks() (map[string]*Network, error)
	GetService(id string) (*Service, error)
	ListServices() ([]*Service, error)
	// Return if container is child and parent container id. If pidMap is nil, only return if it's child.
	GetParent(meta *ContainerMetaExtra, pidMap map[int]string) (bool, string)
	IsDaemonProcess(proc string, cmds []string) bool
	IsRuntimeProcess(proc string, cmds []string) bool
	GetProxy() (string, string, string)
	GetDefaultRegistries() []string
	GetStorageDriver() string
}

func Connect

func Connect(endpoint string, sys *system.SystemTools) (Runtime, error)

func ConnectDocker

func ConnectDocker(endpoint string, sys *system.SystemTools) (Runtime, error)

type Service

type Service struct {
	ID     string
	Name   string
	Labels map[string]string
	VIPs   []net.IP
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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