dev

package
v2.2.19 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: MIT, Apache-2.0 Imports: 65 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PullImageAlways  = "always"
	PullImageMissing = "missing" // Default (matches previous behavior)
	PullImageNever   = "never"
)

Pull constants

Variables

This section is empty.

Functions

func AddDockerFlags added in v2.2.5

func AddDockerFlags(options *Options, p *pflag.FlagSet)

func ForwardAllSignals added in v2.2.5

func ForwardAllSignals(ctx context.Context, apiClient client.ContainerAPIClient, cid string, sigc <-chan os.Signal)

ForwardAllSignals forwards signals to the container

The channel you pass in must already be setup to receive any signals you want to forward.

func MergeDockerOptions added in v2.2.16

func MergeDockerOptions(list ConfigList, options *Options, config *Config, hostConfig *HostConfig)

func MonitorTtySize added in v2.2.5

func MonitorTtySize(ctx context.Context, cli command.Cli, id string, isExec bool) error

MonitorTtySize updates the container tty size when the terminal tty changes size

func Parse added in v2.2.16

func Parse(flags *pflag.FlagSet, copts *ContainerOptions) (*Config, *HostConfig, error)

Parse parses the args for the specified command and generates a Config, a HostConfig and returns them with the specified command. If the specified args are not valid, it will return an error.

Types

type Config added in v2.2.16

type Config struct {
	AttachStdin  bool                // Attach the standard input, makes possible user interaction
	AttachStdout bool                // Attach the standard output
	AttachStderr bool                // Attach the standard error
	ExposedPorts nat.PortSet         `json:",omitempty"` // List of exposed ports
	Tty          bool                // Attach standard streams to a tty, including stdin if it is not closed.
	OpenStdin    bool                // Open stdin
	StdinOnce    bool                // If true, close stdin after the 1 attached client disconnects.
	Cmd          strslice.StrSlice   // Command to run when starting the container
	Volumes      map[string]struct{} // List of volumes (mounts) used for the container
	Entrypoint   strslice.StrSlice   // Entrypoint to run when starting the container
}

type ConfigList

type ConfigList []*RunConfig

func ConvertPodToContainer added in v2.2.16

func ConvertPodToContainer(ns string, temp v12.PodTemplateSpec, envMap map[string][]string, mountVolume map[string][]mount.Mount, dnsConfig *dns.ClientConfig) (list ConfigList)

func (ConfigList) Remove

func (c ConfigList) Remove(ctx context.Context, cli *client.Client) error

func (ConfigList) Run

func (c ConfigList) Run(ctx context.Context, volume map[string][]mount.Mount, cli *client.Client, dockerCli *command.DockerCli) error

type ConnectMode

type ConnectMode string
const (
	ConnectModeContainer ConnectMode = "container"
	ConnectModeHost      ConnectMode = "host"
)

type ContainerOptions

type ContainerOptions struct {
	Image string
	Args  []string
	// contains filtered or unexported fields
}

ContainerOptions is a data object with all the options for creating a container

type HostConfig added in v2.2.16

type HostConfig struct {
	Binds        []string    // List of volume bindings for this container
	PortBindings nat.PortMap // Port mapping between the exposed port (container) and the host
	AutoRemove   bool        // Automatically remove container when it exits

	Privileged      bool               // Is the container in privileged mode
	PublishAllPorts bool               // Should docker publish all exposed port for the container
	Mounts          []mounttypes.Mount `json:",omitempty"`
}

type Options

type Options struct {
	Headers        map[string]string
	Namespace      string
	Workload       string
	ContainerName  string
	NoProxy        bool
	ExtraRouteInfo handler.ExtraRouteInfo
	ConnectMode    ConnectMode
	Engine         config.Engine

	// docker options
	DevImage string

	RunOptions       RunOptions
	ContainerOptions *ContainerOptions
	// contains filtered or unexported fields
}

func (*Options) AddRollbackFunc

func (option *Options) AddRollbackFunc(f func() error)

func (*Options) Connect added in v2.2.16

func (option *Options) Connect(ctx context.Context, sshConfig *pkgssh.SshConfig, transferImage bool, portBindings nat.PortMap) error

Connect to cluster network on docker container or host

func (*Options) CreateConnectContainer added in v2.2.16

func (option *Options) CreateConnectContainer(portBindings nat.PortMap) (*RunConfig, error)

func (*Options) Dev added in v2.2.16

func (option *Options) Dev(ctx context.Context, cConfig *Config, hostConfig *HostConfig) error

func (*Options) GetExposePort added in v2.2.5

func (option *Options) GetExposePort(portBinds nat.PortMap) (nat.PortMap, nat.PortSet, error)

func (*Options) GetPodTemplateSpec added in v2.2.16

func (option *Options) GetPodTemplateSpec() (*v1.PodTemplateSpec, error)

func (*Options) GetRollbackFuncList

func (option *Options) GetRollbackFuncList() []func() error

func (*Options) InitClient added in v2.2.16

func (option *Options) InitClient(f cmdutil.Factory) (err error)

func (*Options) Main

func (option *Options) Main(ctx context.Context, sshConfig *pkgssh.SshConfig, flags *pflag.FlagSet, transferImage bool) error

type RunConfig

type RunConfig struct {
	Options RunOptions
	Copts   ContainerOptions
	// contains filtered or unexported fields
}

type RunOptions

type RunOptions struct {
	SigProxy   bool
	DetachKeys string
	Platform   string
	Pull       string // always, missing, never
}

Jump to

Keyboard shortcuts

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