Documentation ¶
Index ¶
- Variables
- func CopyContainerFile(ctx context.Context, cli Docker, source, destination, name, image string) error
- func ExecCommend(ctx context.Context, cli Docker, containerID string, command []string) (types.IDResponse, error)
- func GetDemoPorts() (map[nat.Port]struct{}, map[nat.Port][]nat.PortBinding, error)
- func GetDevPorts() (map[nat.Port]struct{}, map[nat.Port][]nat.PortBinding, error)
- func GetOrCreateVolume(ctx context.Context, cli Docker, volumeName string, dryRun bool) (*types.Volume, error)
- func GetSandbox(ctx context.Context, cli Docker) (*types.Container, error)
- func GetSandboxPorts() (map[nat.Port]struct{}, map[nat.Port][]nat.PortBinding, error)
- func InspectExecResp(ctx context.Context, cli Docker, containerID string) error
- func PrintCreateContainer(volumes []mount.Mount, portBindings map[nat.Port][]nat.PortBinding, ...)
- func PrintCreateVolume(name string)
- func PrintPullImage(image string, pullOptions ImagePullOptions)
- func PrintRemoveContainer(name string)
- func PullDockerImage(ctx context.Context, cli Docker, image string, pullPolicy ImagePullPolicy, ...) error
- func ReadLogs(ctx context.Context, cli Docker, id string) (*bufio.Scanner, error)
- func RemoveSandbox(ctx context.Context, cli Docker, reader io.Reader) error
- func StartContainer(ctx context.Context, cli Docker, volumes []mount.Mount, ...) (string, error)
- func WaitForSandbox(reader *bufio.Scanner, message string) bool
- type Config
- type Docker
- type FlyteDocker
- type ImagePullOptions
- type ImagePullPolicy
Constants ¶
This section is empty.
Variables ¶
var ( FlyteSandboxConfigDir = f.FilePathJoin(f.UserHomeDir(), ".flyte", "sandbox") Kubeconfig = f.FilePathJoin(FlyteSandboxConfigDir, "kubeconfig") SandboxKubeconfig = f.FilePathJoin(f.UserHomeDir(), ".flyte", "k3s", "k3s.yaml") SuccessMessage = "Deploying Flyte..." FlyteSandboxClusterName = "flyte-sandbox" FlyteSandboxVolumeName = "flyte-sandbox" FlyteSandboxInternalDir = "/var/lib/flyte" FlyteSandboxInternalConfigDir = f.FilePathJoin(FlyteSandboxInternalDir, "config") FlyteSandboxInternalStorageDir = f.FilePathJoin(FlyteSandboxInternalDir, "storage") 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: "/", AttachStdout: true, Cmd: []string{}, } StdWriterPrefixLen = 8 StartingBufLen = 32*1024 + StdWriterPrefixLen + 1 ExtraHosts = []string{"host.docker.internal:host-gateway"} )
var ( DefaultConfig = &Config{ Force: false, } )
Config holds configuration flags for docker command.
Functions ¶
func CopyContainerFile ¶ added in v0.6.24
func CopyContainerFile(ctx context.Context, cli Docker, source, destination, name, image string) error
CopyContainerFile try to create the container, see if the source file is there, copy it to the destination
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
GetDemoPorts will return demo ports
func GetDevPorts ¶ added in v0.6.17
GetDevPorts will return dev cluster (minio + postgres) ports
func GetOrCreateVolume ¶ added in v0.6.28
func GetSandbox ¶
GetSandbox will return sandbox container if it exist
func GetSandboxPorts ¶
GetSandboxPorts will return sandbox ports
func InspectExecResp ¶ added in v0.1.29
func PrintCreateContainer ¶ added in v0.6.22
func PrintCreateContainer(volumes []mount.Mount, portBindings map[nat.Port][]nat.PortBinding, name, image string, environment []string)
PrintCreateContainer helper function to print the docker command to run
func PrintCreateVolume ¶ added in v0.6.28
func PrintCreateVolume(name string)
func PrintPullImage ¶ added in v0.6.22
func PrintPullImage(image string, pullOptions ImagePullOptions)
PrintPullImage helper function to print the sandbox pull image command
func PrintRemoveContainer ¶ added in v0.6.22
func PrintRemoveContainer(name string)
PrintRemoveContainer helper function to remove sandbox container
func PullDockerImage ¶
func PullDockerImage(ctx context.Context, cli Docker, image string, pullPolicy ImagePullPolicy, imagePullOptions ImagePullOptions, dryRun bool) error
PullDockerImage will Pull docker image
func RemoveSandbox ¶
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, dryRun bool) (string, error)
StartContainer will create and start docker container
Types ¶
type Config ¶ added in v0.7.3
type Config struct {
Force bool `json:"force" pflag:",Optional. Forcefully delete existing sandbox cluster if it exists."`
}
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) ContainerStatPath(ctx context.Context, containerID, path string) (types.ContainerPathStat, error) CopyFromContainer(ctx context.Context, containerID, srcPath string) (io.ReadCloser, types.ContainerPathStat, error) VolumeCreate(ctx context.Context, options volume.VolumeCreateBody) (types.Volume, error) VolumeList(ctx context.Context, filter filters.Args) (volume.VolumeListOKBody, error) VolumeRemove(ctx context.Context, volumeID string, force bool) error }
func GetDockerClient ¶
GetDockerClient will returns the docker client
type FlyteDocker ¶
type ImagePullOptions ¶ added in v0.6.0
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