Documentation ¶
Index ¶
- Constants
- Variables
- func InitDockerAddress(dockerAddress string)
- func IsImageNotFoundError(err error) bool
- func NewDockerClient(dockerEndpoint string) (dockerapi.CommonAPIClient, error)
- func NewDockerConfig() *dockershim.ClientConfig
- type DockerConfig
- type DockerConfigEntry
- type DockerConfigJSON
- type DockerManager
- func (dm *DockerManager) APIVersion() (kubecontainer.Version, error)
- func (dm *DockerManager) ContainerStatus(containerID string) (*cri.ContainerStatus, error)
- func (dm *DockerManager) CreateContainer(config *cri.ContainerConfig) (string, error)
- func (dm *DockerManager) DeleteContainer(containerID kubecontainer.ContainerID) error
- func (dm *DockerManager) EnsureImageExists(pod *v1.Pod, secrets []v1.Secret) error
- func (dm *DockerManager) GetContainerLogs(pod *v1.Pod, containerID kubecontainer.ContainerID, ...) (err error)
- func (dm *DockerManager) GetImageRef(image kubecontainer.ImageSpec) (string, error)
- func (dm *DockerManager) GetNetNS(containerID kubecontainer.ContainerID) (string, error)
- func (dm *DockerManager) GetPodContainerID(*kubecontainer.Pod) (kubecontainer.ContainerID, error)
- func (dm *DockerManager) GetPodStatus(uid types.UID, name, namespace string) (*kubecontainer.PodStatus, error)
- func (dm *DockerManager) ImageStats() (*kubecontainer.ImageStats, error)
- func (dm *DockerManager) InspectContainer(containerID string) (*cri.ContainerInspect, error)
- func (dm *DockerManager) InspectImageByID(imageID string) (*types.ImageInspect, error)
- func (dm *DockerManager) IsImagePresent(image kubecontainer.ImageSpec) (bool, error)
- func (dm *DockerManager) KillPod(pod *v1.Pod, runningPod kubecontainer.Pod, gracePeriodOverride *int64) error
- func (dm *DockerManager) ListContainers() ([]*cri.Container, error)
- func (dm *DockerManager) ListImages() ([]kubecontainer.Image, error)
- func (dm *DockerManager) PullImage(image kubecontainer.ImageSpec, pullSecrets []v1.Secret) (string, error)
- func (dm *DockerManager) RemoveImage(image kubecontainer.ImageSpec) error
- func (dm *DockerManager) StartContainer(containerID string) error
- func (dm *DockerManager) Status() (*kubecontainer.RuntimeStatus, error)
- func (dm *DockerManager) StopContainer(containerID string, timeout uint32) error
- func (dm *DockerManager) SyncPod(pod *v1.Pod, apiPodStatus v1.PodStatus, podStatus *kubecontainer.PodStatus, ...) kubecontainer.PodSyncResult
- func (dm *DockerManager) Type() string
- func (dm *DockerManager) UpdatePodCIDR(podCIDR string) error
- func (dm *DockerManager) Version() (kubecontainer.Version, error)
- type FakeDockerClient
- func (cli *FakeDockerClient) ContainerCreate(ctx context.Context, config *container.Config, ...) (container.ContainerCreateCreatedBody, error)
- func (cli *FakeDockerClient) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
- func (cli *FakeDockerClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
- func (cli *FakeDockerClient) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
- func (cli *FakeDockerClient) ContainerStart(ctx context.Context, containerID string, opts types.ContainerStartOptions) error
- func (cli *FakeDockerClient) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
- func (cli *FakeDockerClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
- func (cli *FakeDockerClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
- func (cli *FakeDockerClient) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
- func (cli *FakeDockerClient) ServerVersion(ctx context.Context) (types.Version, error)
- type IFakeDockerClient
Constants ¶
const DockerDefaultAddress = "unix:///var/run/docker.sock"
DockerDefaultAddress is default address for docker
const EMPTYVALUE byte = 0
EMPTYVALUE is byte type for zero value
const PROJECTNAME = "southchina"
PROJECTNAME needs to be specified, temporarily written as "southchina"
const (
//ZeroTime defines base time
ZeroTime = "0001-01-01T00:00:00Z"
)
Variables ¶
var ( // ErrImageNeverPull : Required Image is absent on host and PullPolicy is NeverPullImage ErrImageNeverPull = errors.New("ErrImageNeverPull") // DockerAddress is address for docker DockerAddress = DockerDefaultAddress )
var ImagePullError error
ImagePullError is var of error type
Functions ¶
func InitDockerAddress ¶
func InitDockerAddress(dockerAddress string)
InitDockerAddress inits docker address
func IsImageNotFoundError ¶
IsImageNotFoundError checks error to be of type imageNotFoundError
func NewDockerClient ¶
func NewDockerClient(dockerEndpoint string) (dockerapi.CommonAPIClient, error)
NewDockerClient gets a *dockerapi.Client, either using the endpoint passed in, or using DOCKER_HOST, DOCKER_TLS_VERIFY, and DOCKER_CERT path per their spec
func NewDockerConfig ¶
func NewDockerConfig() *dockershim.ClientConfig
NewDockerConfig configures docker client TODO: fillup other field in this struct
Types ¶
type DockerConfig ¶
type DockerConfig map[string]DockerConfigEntry
DockerConfig represents the config file used by the docker CLI. This config that represents the credentials that should be used when pulling images from specific image repositories.
type DockerConfigEntry ¶
DockerConfigEntry defines
func (DockerConfigEntry) MarshalJSON ¶
func (ident DockerConfigEntry) MarshalJSON() ([]byte, error)
MarshalJSON is to encode byte array to json
func (*DockerConfigEntry) UnmarshalJSON ¶
func (ident *DockerConfigEntry) UnmarshalJSON(data []byte) error
UnmarshalJSON is to unmarshal json object
type DockerConfigJSON ¶
type DockerConfigJSON struct { Auths DockerConfig `json:"auths"` // +optional HTTPHeaders map[string]string `json:"HttpHeaders,omitempty"` }
DockerConfigJSON is json struct for docker configuration
type DockerManager ¶
type DockerManager struct { containers.ContainerManager // contains filtered or unexported fields }
DockerManager defines object structure of docker manager
func NewDockerManager ¶
func NewDockerManager(livenessManager proberesults.Manager, qps float32, burst int, backOff *flowcontrol.Backoff, serializeImagePulls bool, devicePluginEnabled bool, gpuManager gpu.GPUManager, interfaceName string) (*DockerManager, error)
NewDockerManager returns a docker manager object
func (*DockerManager) APIVersion ¶
func (dm *DockerManager) APIVersion() (kubecontainer.Version, error)
APIVersion returns docker version
func (*DockerManager) ContainerStatus ¶
func (dm *DockerManager) ContainerStatus(containerID string) (*cri.ContainerStatus, error)
ContainerStatus gives container status
func (*DockerManager) CreateContainer ¶
func (dm *DockerManager) CreateContainer(config *cri.ContainerConfig) (string, error)
CreateContainer creates container and returns ID
func (*DockerManager) DeleteContainer ¶
func (dm *DockerManager) DeleteContainer(containerID kubecontainer.ContainerID) error
DeleteContainer deletes container given ID
func (*DockerManager) EnsureImageExists ¶
EnsureImageExists checks existence of image in container
func (*DockerManager) GetContainerLogs ¶
func (dm *DockerManager) GetContainerLogs(pod *v1.Pod, containerID kubecontainer.ContainerID, logOptions *v1.PodLogOptions, stdout, stderr io.Writer) (err error)
GetContainerLogs returns logs of a specific container. By default, it returns a snapshot of the container log.
func (*DockerManager) GetImageRef ¶
func (dm *DockerManager) GetImageRef(image kubecontainer.ImageSpec) (string, error)
GetImageRef is part of interface.
func (*DockerManager) GetNetNS ¶
func (dm *DockerManager) GetNetNS(containerID kubecontainer.ContainerID) (string, error)
GetNetNS returns the network namespace path for the given container
func (*DockerManager) GetPodContainerID ¶
func (dm *DockerManager) GetPodContainerID(*kubecontainer.Pod) (kubecontainer.ContainerID, error)
GetPodContainerID returns a container in the pod with the given ID.
func (*DockerManager) GetPodStatus ¶
func (dm *DockerManager) GetPodStatus(uid types.UID, name, namespace string) (*kubecontainer.PodStatus, error)
GetPodStatus returns pod status
func (*DockerManager) ImageStats ¶
func (dm *DockerManager) ImageStats() (*kubecontainer.ImageStats, error)
ImageStats is part of interface.
func (*DockerManager) InspectContainer ¶
func (dm *DockerManager) InspectContainer(containerID string) (*cri.ContainerInspect, error)
InspectContainer is to inspect the container returning ContainerInspect object
func (*DockerManager) InspectImageByID ¶
func (dm *DockerManager) InspectImageByID(imageID string) (*types.ImageInspect, error)
InspectImageByID checks if the inspected image matches what we are looking for
func (*DockerManager) IsImagePresent ¶
func (dm *DockerManager) IsImagePresent(image kubecontainer.ImageSpec) (bool, error)
IsImagePresent checks whether the container image is already in the local storage
func (*DockerManager) KillPod ¶
func (dm *DockerManager) KillPod(pod *v1.Pod, runningPod kubecontainer.Pod, gracePeriodOverride *int64) error
KillPod ends the pod
func (*DockerManager) ListContainers ¶
func (dm *DockerManager) ListContainers() ([]*cri.Container, error)
ListContainers returns all containers list
func (*DockerManager) ListImages ¶
func (dm *DockerManager) ListImages() ([]kubecontainer.Image, error)
ListImages gets all images currently on the machine
func (*DockerManager) PullImage ¶
func (dm *DockerManager) PullImage(image kubecontainer.ImageSpec, pullSecrets []v1.Secret) (string, error)
PullImage pulls an image from network to local storage
func (*DockerManager) RemoveImage ¶
func (dm *DockerManager) RemoveImage(image kubecontainer.ImageSpec) error
RemoveImage removes the specified image
func (*DockerManager) StartContainer ¶
func (dm *DockerManager) StartContainer(containerID string) error
StartContainer is for ContainerStart
func (*DockerManager) Status ¶
func (dm *DockerManager) Status() (*kubecontainer.RuntimeStatus, error)
Status returns runtime status
func (*DockerManager) StopContainer ¶
func (dm *DockerManager) StopContainer(containerID string, timeout uint32) error
StopContainer is to stop the container given its ID
func (*DockerManager) SyncPod ¶
func (dm *DockerManager) SyncPod(pod *v1.Pod, apiPodStatus v1.PodStatus, podStatus *kubecontainer.PodStatus, pullSecrets []v1.Secret, backOff *flowcontrol.Backoff) kubecontainer.PodSyncResult
SyncPod is to synchronise pods
func (*DockerManager) Type ¶
func (dm *DockerManager) Type() string
Type is string var to define typeof docker
func (*DockerManager) UpdatePodCIDR ¶
func (dm *DockerManager) UpdatePodCIDR(podCIDR string) error
UpdatePodCIDR to update pod CIDR
func (*DockerManager) Version ¶
func (dm *DockerManager) Version() (kubecontainer.Version, error)
Version returns kubecontainer version
type FakeDockerClient ¶
type FakeDockerClient struct { dockerapi.CommonAPIClient // contains filtered or unexported fields }
FakeDockerClient is object for a docker client
func NewFakeDockerClient ¶
func NewFakeDockerClient(imageList map[string]types.ImageSummary) *FakeDockerClient
NewFakeDockerClient is to initialise docker client
func (*FakeDockerClient) ContainerCreate ¶
func (cli *FakeDockerClient) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
ContainerCreate creates a container body and returns it
func (*FakeDockerClient) ContainerInspect ¶
func (cli *FakeDockerClient) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
ContainerInspect returns container JSON to inspect
func (*FakeDockerClient) ContainerList ¶
func (cli *FakeDockerClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
ContainerList returns list of created container
func (*FakeDockerClient) ContainerRemove ¶
func (cli *FakeDockerClient) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
ContainerRemove removes container object
func (*FakeDockerClient) ContainerStart ¶
func (cli *FakeDockerClient) ContainerStart(ctx context.Context, containerID string, opts types.ContainerStartOptions) error
ContainerStart starts the container
func (*FakeDockerClient) ContainerStop ¶
func (cli *FakeDockerClient) ContainerStop(ctx context.Context, containerID string, timeout *time.Duration) error
ContainerStop stops the container
func (*FakeDockerClient) ImageList ¶
func (cli *FakeDockerClient) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.ImageSummary, error)
ImageList returns image list
func (*FakeDockerClient) ImagePull ¶
func (cli *FakeDockerClient) ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
ImagePull reads image from repository
func (*FakeDockerClient) ImageRemove ¶
func (cli *FakeDockerClient) ImageRemove(ctx context.Context, imageID string, options types.ImageRemoveOptions) ([]types.ImageDeleteResponseItem, error)
ImageRemove removes image from repository
func (*FakeDockerClient) ServerVersion ¶
ServerVersion returns server version