Documentation ¶
Overview ¶
Package hyper contains HyperContainer implementation of runtime API.
Index ¶
- Constants
- type CheckpointData
- type CheckpointHandler
- type CheckpointStore
- type Client
- func (c *Client) AttachContainer(containerID string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, ...) error
- func (c *Client) ContainerExecCreate(containerId string, cmd []string, tty bool) (string, error)
- func (c *Client) CreateContainer(podID string, spec *types.UserContainer) (string, error)
- func (c *Client) CreatePod(spec *types.UserPod) (string, error)
- func (c *Client) ExecInContainer(containerId string, cmd []string, stdin io.Reader, ...) error
- func (c *Client) ExecInSandbox(sandboxID string, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, ...) error
- func (c *Client) GetContainerInfo(container string) (*types.ContainerInfo, error)
- func (c *Client) GetContainerList() ([]*types.ContainerListResult, error)
- func (c *Client) GetImageInfo(image, tag string) (*types.ImageInfo, error)
- func (c *Client) GetImages() ([]*types.ImageInfo, error)
- func (c *Client) GetPodInfo(podID string) (*types.PodInfo, error)
- func (c *Client) GetPodList() ([]*types.PodListResult, error)
- func (c *Client) GetVersion() (string, string, error)
- func (c *Client) PullImage(image, tag string, auth *types.AuthConfig, out io.Writer) error
- func (c *Client) RemoveContainer(containerID string) error
- func (c *Client) RemoveImage(image, tag string) error
- func (c *Client) RemovePod(podID string) error
- func (c *Client) StartContainer(containerID string) error
- func (c *Client) StartPod(podID string) error
- func (c *Client) StopContainer(containerID string, timeout int64) error
- func (c *Client) StopPod(podID string) (int, string, error)
- func (c *Client) TTYResize(containerID, execID string, height, width int32) error
- func (c *Client) Wait(containerId, execId string, noHang bool) (int32, error)
- type ContainerInterfaceInfo
- type FileStore
- type MemStore
- type NetworkInfo
- type PersistentCheckpointHandler
- func (handler *PersistentCheckpointHandler) CreateCheckpoint(podSandboxID string, checkpoint *PodSandboxCheckpoint) error
- func (handler *PersistentCheckpointHandler) GetCheckpoint(podSandboxID string) (*PodSandboxCheckpoint, error)
- func (handler *PersistentCheckpointHandler) ListCheckpoints() []string
- func (handler *PersistentCheckpointHandler) RemoveCheckpoint(podSandboxID string) error
- type PodSandboxCheckpoint
- type PortMapping
- type Protocol
- type RawExtractor
- type Runtime
- func (h *Runtime) Attach(req *kubeapi.AttachRequest) (*kubeapi.AttachResponse, error)
- func (h *Runtime) ContainerStats(containerID string) (*kubeapi.ContainerStats, error)
- func (h *Runtime) ContainerStatus(containerID string) (*kubeapi.ContainerStatus, error)
- func (h *Runtime) CreateContainer(podSandboxID string, config *kubeapi.ContainerConfig, ...) (string, error)
- func (h *Runtime) Exec(req *kubeapi.ExecRequest) (*kubeapi.ExecResponse, error)
- func (h *Runtime) ExecSync(rawContainerID string, cmd []string, timeout time.Duration) (stdout, stderr []byte, err error)
- func (h *Runtime) ImageFsInfo() ([]*kubeapi.FilesystemUsage, error)
- func (h *Runtime) ImageStatus(image *kubeapi.ImageSpec) (*kubeapi.Image, error)
- func (h *Runtime) ListContainerStats(filter *kubeapi.ContainerStatsFilter) ([]*kubeapi.ContainerStats, error)
- func (h *Runtime) ListContainers(filter *kubeapi.ContainerFilter) ([]*kubeapi.Container, error)
- func (h *Runtime) ListImages(filter *kubeapi.ImageFilter) ([]*kubeapi.Image, error)
- func (h *Runtime) ListPodSandbox(filter *kubeapi.PodSandboxFilter) ([]*kubeapi.PodSandbox, error)
- func (h *Runtime) PodSandboxStatus(podSandboxID string) (*kubeapi.PodSandboxStatus, error)
- func (h *Runtime) PortForward(req *kubeapi.PortForwardRequest) (*kubeapi.PortForwardResponse, error)
- func (h *Runtime) PullImage(image *kubeapi.ImageSpec, authConfig *kubeapi.AuthConfig) (string, error)
- func (h *Runtime) RemoveContainer(rawContainerID string) error
- func (h *Runtime) RemoveImage(image *kubeapi.ImageSpec) error
- func (h *Runtime) RemovePodSandbox(podSandboxID string) error
- func (h *Runtime) ReopenContainerLog(ContainerID string) error
- func (h *Runtime) RunPodSandbox(config *kubeapi.PodSandboxConfig, runtimeHandler string) (string, error)
- func (h *Runtime) ServiceName() string
- func (h *Runtime) StartContainer(rawContainerID string) error
- func (h *Runtime) Status() (*kubeapi.RuntimeStatus, error)
- func (h *Runtime) StopContainer(rawContainerID string, timeout int64) error
- func (h *Runtime) StopPodSandbox(podSandboxID string) error
- func (h *Runtime) UpdateContainerResources(rawContainerID string, config *kubeapi.LinuxContainerResources) error
- func (h *Runtime) UpdateRuntimeConfig(runtimeConfig *kubeapi.RuntimeConfig) error
- func (h *Runtime) Version(kubeApiVersion string) (*kubeapi.VersionResponse, error)
- type StdcopyExtractor
- type StreamExtractor
Constants ¶
const ( // Stdin represents standard input stream type. Stdin stdcopy.StdType = iota // Stdout represents standard output stream type. Stdout // Stderr represents standard error steam type. Stderr )
const ( ProtocolTCP = Protocol("tcp") ProtocolUDP = Protocol("udp") PortMappingsKey = "PortMappings" )
const (
MiB = 1024 * 1024
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckpointData ¶
type CheckpointData struct { PortMappings []*PortMapping `json:"port_mappings,omitempty"` Interfaces []*ContainerInterfaceInfo `json:"interfaces,omitempty"` }
CheckpointData contains all types of data that can be stored in the checkpoint.
type CheckpointHandler ¶
type CheckpointHandler interface { // CreateCheckpoint persists sandbox checkpoint in CheckpointStore. CreateCheckpoint(podSandboxID string, checkpoint *PodSandboxCheckpoint) error // GetCheckpoint retrieves sandbox checkpoint from CheckpointStore. GetCheckpoint(podSandboxID string) (*PodSandboxCheckpoint, error) // RemoveCheckpoint removes sandbox checkpoint form CheckpointStore. // WARNING: RemoveCheckpoint will not return error if checkpoint does not exist. RemoveCheckpoint(podSandboxID string) error // ListCheckpoint returns the list of existing checkpoints. ListCheckpoints() []string }
CheckpointHandler provides the interface to manage PodSandbox checkpoint
func NewPersistentCheckpointHandler ¶
func NewPersistentCheckpointHandler(fraktiRootDir string) (CheckpointHandler, error)
type CheckpointStore ¶
type CheckpointStore interface { // Add persists a checkpoint with key Add(key string, data []byte) error // Get retrieves a checkpoint with key Get(key string) ([]byte, error) // Delete deletes a checkpoint with key Delete(key string) error // List lists all keys of existing checkpoints List() ([]string, error) }
CheckpointStore provides the interface for checkpoint storage backend
func NewMemStore ¶
func NewMemStore() CheckpointStore
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the gRPC client for hyperd
func (*Client) AttachContainer ¶
func (c *Client) AttachContainer(containerID string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error
AttachContainer attach a container with id, io stream and resize
func (*Client) ContainerExecCreate ¶
ContainerExecCreate creates exec in a container
func (*Client) CreateContainer ¶
CreateContainer creates a container
func (*Client) ExecInContainer ¶
func (c *Client) ExecInContainer(containerId string, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize, timeout time.Duration) error
ExecInContainer exec a command in container with specified io, tty and timeout
func (*Client) ExecInSandbox ¶
func (c *Client) ExecInSandbox(sandboxID string, cmd []string, stdin io.Reader, stdout, stderr io.WriteCloser, tty bool, timeout time.Duration) error
ExecInSandbox exec a command in sandbox with specified io, tty and timeout
func (*Client) GetContainerInfo ¶
func (c *Client) GetContainerInfo(container string) (*types.ContainerInfo, error)
GetContainerInfo gets container info by container name or id
func (*Client) GetContainerList ¶
func (c *Client) GetContainerList() ([]*types.ContainerListResult, error)
GetContainerList gets a list of containers
func (*Client) GetImageInfo ¶
GetImageInfo gets the information of the image.
func (*Client) GetPodInfo ¶
GetPodInfo gets pod info by podID
func (*Client) GetPodList ¶
func (c *Client) GetPodList() ([]*types.PodListResult, error)
GetPodList get a list of Pods
func (*Client) GetVersion ¶
GetVersion gets hyperd version
func (*Client) RemoveContainer ¶
RemoveContainer removes a hyper container
func (*Client) RemoveImage ¶
RemoveImage removes a image from hyperd
func (*Client) StartContainer ¶
StartContainer starts a hyper container
func (*Client) StopContainer ¶
StopContainer stops a hyper container
type ContainerInterfaceInfo ¶
type ContainerInterfaceInfo struct { // Name of the interface. Name string `json:"name,omitempty"` // IP address of the interface. Addr *net.IPNet `json:"addr,omitempty"` }
ContainerInterfaceInfo contains a network interface inside the container.
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
FileStore is an implementation of CheckpointStore interface which stores checkpoint in file.
type MemStore ¶
type MemStore struct {
// contains filtered or unexported fields
}
MemStore is an implementation of CheckpointStore interface which stores checkpoint in memory.
type NetworkInfo ¶
type NetworkInfo struct { IfName string Mac string Ip string Mtu int Gateway string BridgeName string }
The network information needed to create HyperContainer network device from CNI Result
type PersistentCheckpointHandler ¶
type PersistentCheckpointHandler struct {
// contains filtered or unexported fields
}
PersistentCheckpointHandler is an implementation of CheckpointHandler. It persists checkpoint in CheckpointStore
func (*PersistentCheckpointHandler) CreateCheckpoint ¶
func (handler *PersistentCheckpointHandler) CreateCheckpoint(podSandboxID string, checkpoint *PodSandboxCheckpoint) error
func (*PersistentCheckpointHandler) GetCheckpoint ¶
func (handler *PersistentCheckpointHandler) GetCheckpoint(podSandboxID string) (*PodSandboxCheckpoint, error)
func (*PersistentCheckpointHandler) ListCheckpoints ¶
func (handler *PersistentCheckpointHandler) ListCheckpoints() []string
func (*PersistentCheckpointHandler) RemoveCheckpoint ¶
func (handler *PersistentCheckpointHandler) RemoveCheckpoint(podSandboxID string) error
type PodSandboxCheckpoint ¶
type PodSandboxCheckpoint struct { // Version of the pod sandbox checkpoint schema. Version string `json:"version"` // Pod name of the sandbox. Same as the pod name in the PodSpec. Name string `json:"name"` // Pod namespace of the sandbox. Same as the pod namespace in the PodSpec. Namespace string `json:"namespace"` // Pod netnspath of sandbox. NetNsPath string `json:"netnspath"` // Host bridge of sandbox. HostBridge string `json:"hostBridge,omitempty"` // Data to checkpoint for pod sandbox. Data *CheckpointData `json:"data,omitempty"` }
PodSandboxCheckpoint is the checkpoint structure for a sandbox
func NewPodSandboxCheckpoint ¶
func NewPodSandboxCheckpoint(namespace, name string) *PodSandboxCheckpoint
type PortMapping ¶
type PortMapping struct { // Protocol of the port mapping. Protocol *Protocol `json:"protocol,omitempty"` // Port number within the container. ContainerPort *int32 `json:"container_port,omitempty"` // Port number on the host. HostPort *int32 `json:"host_port,omitempty"` }
PortMapping is the port mapping configurations of a sandbox.
type RawExtractor ¶
type RawExtractor struct{}
RawExtractor is a stream extractor can only extract raw data which was not be multiplexed.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime is the HyperContainer implementation of kubelet runtime API
func NewHyperRuntime ¶
func NewHyperRuntime(hyperEndpoint string, streamingConfig *streaming.Config, cniNetDir, cniPluginDir, rootDir string, defaultCPUNum, defaultMemoryMB int32) (*Runtime, streaming.Server, error)
NewHyperRuntime creates a new Runtime
func (*Runtime) Attach ¶
func (h *Runtime) Attach(req *kubeapi.AttachRequest) (*kubeapi.AttachResponse, error)
Attach prepares a streaming endpoint to attach to a running container.
func (*Runtime) ContainerStats ¶
func (h *Runtime) ContainerStats(containerID string) (*kubeapi.ContainerStats, error)
ContainerStats returns stats of the container. If the container does not exist, the call returns an error.
func (*Runtime) ContainerStatus ¶
func (h *Runtime) ContainerStatus(containerID string) (*kubeapi.ContainerStatus, error)
ContainerStatus returns the container status.
func (*Runtime) CreateContainer ¶
func (h *Runtime) CreateContainer(podSandboxID string, config *kubeapi.ContainerConfig, sandboxConfig *kubeapi.PodSandboxConfig) (string, error)
CreateContainer creates a new container in specified PodSandbox
func (*Runtime) Exec ¶
func (h *Runtime) Exec(req *kubeapi.ExecRequest) (*kubeapi.ExecResponse, error)
Exec prepares a streaming endpoint to execute a command in the container.
func (*Runtime) ExecSync ¶
func (h *Runtime) ExecSync(rawContainerID string, cmd []string, timeout time.Duration) (stdout, stderr []byte, err error)
ExecSync runs a command in a container synchronously.
func (*Runtime) ImageFsInfo ¶
func (h *Runtime) ImageFsInfo() ([]*kubeapi.FilesystemUsage, error)
ImageFsInfo returns information of the filesystem that is used to store images.
func (*Runtime) ImageStatus ¶
ImageStatus returns the status of the image.
func (*Runtime) ListContainerStats ¶
func (h *Runtime) ListContainerStats(filter *kubeapi.ContainerStatsFilter) ( []*kubeapi.ContainerStats, error)
ListContainerStats returns stats of all running containers.
func (*Runtime) ListContainers ¶
ListContainers lists all containers by filters.
func (*Runtime) ListImages ¶
ListImages lists existing images.
func (*Runtime) ListPodSandbox ¶
func (h *Runtime) ListPodSandbox(filter *kubeapi.PodSandboxFilter) ([]*kubeapi.PodSandbox, error)
ListPodSandbox returns a list of Sandbox.
func (*Runtime) PodSandboxStatus ¶
func (h *Runtime) PodSandboxStatus(podSandboxID string) (*kubeapi.PodSandboxStatus, error)
PodSandboxStatus returns the Status of the PodSandbox.
func (*Runtime) PortForward ¶
func (h *Runtime) PortForward(req *kubeapi.PortForwardRequest) (*kubeapi.PortForwardResponse, error)
PortForward prepares a streaming endpoint to forward ports from a PodSandbox.
func (*Runtime) PullImage ¶
func (h *Runtime) PullImage(image *kubeapi.ImageSpec, authConfig *kubeapi.AuthConfig) (string, error)
PullImage pulls the image with authentication config.
func (*Runtime) RemoveContainer ¶
RemoveContainer removes the container. If the container is running, the container should be force removed.
func (*Runtime) RemoveImage ¶
RemoveImage removes the image.
func (*Runtime) RemovePodSandbox ¶
RemovePodSandbox deletes the sandbox. If there are any running containers in the sandbox, they should be force deleted.
func (*Runtime) ReopenContainerLog ¶ added in v1.10.0
ReopenContainerLog asks runtime to reopen the stdout/stderr log file for the container.
func (*Runtime) RunPodSandbox ¶
func (h *Runtime) RunPodSandbox(config *kubeapi.PodSandboxConfig, runtimeHandler string) (string, error)
RunPodSandbox creates and starts a pod-level sandbox.
func (*Runtime) ServiceName ¶
ServiceName method is used to log out with service's name
func (*Runtime) StartContainer ¶
StartContainer starts the container.
func (*Runtime) Status ¶
func (h *Runtime) Status() (*kubeapi.RuntimeStatus, error)
Status returns the status of the runtime.
func (*Runtime) StopContainer ¶
StopContainer stops a running container with a grace period (i.e. timeout).
func (*Runtime) StopPodSandbox ¶
StopPodSandbox stops the sandbox. If there are any running containers in the sandbox, they should be force terminated.
func (*Runtime) UpdateContainerResources ¶
func (h *Runtime) UpdateContainerResources( rawContainerID string, config *kubeapi.LinuxContainerResources, ) error
UpdateContainerResources updates the resource constraints for the container.
func (*Runtime) UpdateRuntimeConfig ¶
func (h *Runtime) UpdateRuntimeConfig(runtimeConfig *kubeapi.RuntimeConfig) error
UpdateRuntimeConfig updates runtime configuration if specified
type StdcopyExtractor ¶
type StdcopyExtractor struct {
// contains filtered or unexported fields
}
StdcopyExtractor is a stream extractor, which can extract data multiplexed by stdWriter from docker/pkg/stdcopy.
func (*StdcopyExtractor) Extract ¶
func (s *StdcopyExtractor) Extract(orig []byte) ([]byte, []byte, error)
Extract will demultiplex `orig`, assuming that it contains two kinds of stream bytes(`stdout` and `stderr`), and previously multiplexed together using a StdWriter instance from docker/pkg/stdcopy. As it reads from `orig`, Extract will return stdout and stderr.
type StreamExtractor ¶
StreamExtractor interface should be implemented by any stream extractor who want extract multiplexed stream to multiple kind of stream.
func NewExtractor ¶
func NewExtractor(tty bool) StreamExtractor
NewExtractor instantiates a new StreamExtractor. When tty is enabled, return a RawExtractor which only extract raw data because tty is a signal stream. When tty is unabled, return a StdcopyExtractor.