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) (*volume.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 ¶
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 ¶
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 ¶
GetDemoPorts will return demo ports
func GetDevPorts ¶
GetDevPorts will return dev cluster (minio + postgres) ports
func GetOrCreateVolume ¶
func GetSandbox ¶
GetSandbox will return sandbox container if it exist
func GetSandboxPorts ¶
GetSandboxPorts will return sandbox ports
func InspectExecResp ¶
func PrintCreateContainer ¶
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 ¶
func PrintCreateVolume(name string)
func PrintPullImage ¶
func PrintPullImage(image string, pullOptions ImagePullOptions)
PrintPullImage helper function to print the sandbox pull image command
func PrintRemoveContainer ¶
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 ¶
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 *ocispec.Platform, containerName string) (container.CreateResponse, error) ContainerStart(ctx context.Context, containerID string, options container.StartOptions) error ImagePull(ctx context.Context, refStr string, options types.ImagePullOptions) (io.ReadCloser, error) ContainerWait(ctx context.Context, container string, condition container.WaitCondition) (<-chan container.WaitResponse, <-chan error) ContainerLogs(ctx context.Context, container string, options container.LogsOptions) (io.ReadCloser, error) ContainerRemove(ctx context.Context, containerID string, options container.RemoveOptions) error ContainerList(ctx context.Context, options container.ListOptions) ([]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) ([]image.Summary, 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.CreateOptions) (volume.Volume, error) VolumeList(ctx context.Context, options volume.ListOptions) (volume.ListResponse, error) VolumeRemove(ctx context.Context, volumeID string, force bool) error }
func GetDockerClient ¶
GetDockerClient will returns the docker client
type FlyteDocker ¶
type ImagePullOptions ¶
type ImagePullPolicy ¶
type ImagePullPolicy int
const ( ImagePullPolicyAlways ImagePullPolicy = iota ImagePullPolicyIfNotPresent ImagePullPolicyNever )
func ImagePullPolicyString ¶
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 ¶
func ImagePullPolicyValues() []ImagePullPolicy
ImagePullPolicyValues returns all values of the enum
func (ImagePullPolicy) IsAImagePullPolicy ¶
func (i ImagePullPolicy) IsAImagePullPolicy() bool
IsAImagePullPolicy returns "true" if the value is listed in the enum definition. "false" otherwise
func (ImagePullPolicy) MarshalJSON ¶
func (i ImagePullPolicy) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for ImagePullPolicy
func (*ImagePullPolicy) Set ¶
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 ¶
func (i ImagePullPolicy) String() string
func (ImagePullPolicy) Type ¶
func (i ImagePullPolicy) Type() string
Type implements PFlag's Value interface to return type name.
func (*ImagePullPolicy) UnmarshalJSON ¶
func (i *ImagePullPolicy) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for ImagePullPolicy