docker

package
v0.6.14 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Kubeconfig              = f.FilePathJoin(f.UserHomeDir(), ".flyte", "k3s", "k3s.yaml")
	SuccessMessage          = "Deploying Flyte..."
	FlyteSandboxClusterName = "flyte-sandbox"
	Environment             = []string{"SANDBOX=1", "KUBERNETES_API_PORT=30086", "FLYTE_HOST=localhost:30081", "FLYTE_AWS_ENDPOINT=http://localhost:30084"}
	Source                  = "/root"
	K3sDir                  = "/etc/rancher/"
	Client                  Docker
	Volumes                 = []mount.Mount{
		{
			Type:   mount.TypeBind,
			Source: f.FilePathJoin(f.UserHomeDir(), ".flyte"),
			Target: K3sDir,
		},
	}
	ExecConfig = types.ExecConfig{
		AttachStderr: true,
		Tty:          true,
		WorkingDir:   Source,
		AttachStdout: true,
		Cmd:          []string{},
	}
	StdWriterPrefixLen = 8
	StartingBufLen     = 32*1024 + StdWriterPrefixLen + 1
)

Functions

func ExecCommend added in v0.1.29

func ExecCommend(ctx context.Context, cli Docker, containerID string, command []string) (types.IDResponse, error)

ExecCommend will execute a command in container and returns an execution id

func GetDemoPorts added in v0.5.19

func GetDemoPorts() (map[nat.Port]struct{}, map[nat.Port][]nat.PortBinding, error)

GetDemoPorts will return demo ports

func GetSandbox

func GetSandbox(ctx context.Context, cli Docker) (*types.Container, error)

GetSandbox will return sandbox container if it exist

func GetSandboxPorts

func GetSandboxPorts() (map[nat.Port]struct{}, map[nat.Port][]nat.PortBinding, error)

GetSandboxPorts will return sandbox ports

func InspectExecResp added in v0.1.29

func InspectExecResp(ctx context.Context, cli Docker, containerID string) error

func PullDockerImage

func PullDockerImage(ctx context.Context, cli Docker, image string, pullPolicy ImagePullPolicy,
	imagePullOptions ImagePullOptions) error

PullDockerImage will Pull docker image

func ReadLogs

func ReadLogs(ctx context.Context, cli Docker, id string) (*bufio.Scanner, error)

ReadLogs will return io scanner for reading the logs of a container

func RemoveSandbox

func RemoveSandbox(ctx context.Context, cli Docker, reader io.Reader) error

RemoveSandbox will remove sandbox container if exist

func StartContainer

func StartContainer(ctx context.Context, cli Docker, volumes []mount.Mount, exposedPorts map[nat.Port]struct{},
	portBindings map[nat.Port][]nat.PortBinding, name, image string, additionalEnvVars []string) (string, error)

StartContainer will create and start docker container

func WaitForSandbox

func WaitForSandbox(reader *bufio.Scanner, message string) bool

WaitForSandbox will wait until it doesn't get success message

Types

type Docker

type Docker interface {
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, platform *specs.Platform, containerName string) (container.ContainerCreateCreatedBody, error)
	ContainerStart(ctx context.Context, containerID string, options types.ContainerStartOptions) error
	ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error)
	ContainerWait(ctx context.Context, containerID string, condition container.WaitCondition) (<-chan container.ContainerWaitOKBody, <-chan error)
	ContainerLogs(ctx context.Context, container string, options types.ContainerLogsOptions) (io.ReadCloser, error)
	ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
	ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
	ContainerExecCreate(ctx context.Context, container string, config types.ExecConfig) (types.IDResponse, error)
	ContainerExecAttach(ctx context.Context, execID string, config types.ExecStartCheck) (types.HijackedResponse, error)
	ContainerExecInspect(ctx context.Context, execID string) (types.ContainerExecInspect, error)
	ImageList(ctx context.Context, listOption types.ImageListOptions) ([]types.ImageSummary, error)
}

func GetDockerClient

func GetDockerClient() (Docker, error)

GetDockerClient will returns the docker client

type FlyteDocker

type FlyteDocker struct {
	*client.Client
}

type ImagePullOptions added in v0.6.0

type ImagePullOptions struct {
	RegistryAuth string `json:"registryAuth" pflag:",The base64 encoded credentials for the registry."`
	Platform     string `json:"platform" pflag:",Forces a specific platform's image to be pulled.'"`
}

type ImagePullPolicy added in v0.6.0

type ImagePullPolicy int
const (
	ImagePullPolicyAlways ImagePullPolicy = iota
	ImagePullPolicyIfNotPresent
	ImagePullPolicyNever
)

func ImagePullPolicyString added in v0.6.0

func ImagePullPolicyString(s string) (ImagePullPolicy, error)

ImagePullPolicyString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func ImagePullPolicyValues added in v0.6.0

func ImagePullPolicyValues() []ImagePullPolicy

ImagePullPolicyValues returns all values of the enum

func (ImagePullPolicy) IsAImagePullPolicy added in v0.6.0

func (i ImagePullPolicy) IsAImagePullPolicy() bool

IsAImagePullPolicy returns "true" if the value is listed in the enum definition. "false" otherwise

func (ImagePullPolicy) MarshalJSON added in v0.6.0

func (i ImagePullPolicy) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for ImagePullPolicy

func (*ImagePullPolicy) Set added in v0.6.0

func (i *ImagePullPolicy) Set(val string) error

Set implements PFlag's Value interface to attempt to set the value of the flag from string.

func (ImagePullPolicy) String added in v0.6.0

func (i ImagePullPolicy) String() string

func (ImagePullPolicy) Type added in v0.6.0

func (i ImagePullPolicy) Type() string

Type implements PFlag's Value interface to return type name.

func (*ImagePullPolicy) UnmarshalJSON added in v0.6.0

func (i *ImagePullPolicy) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface for ImagePullPolicy

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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