containers

package
v0.0.0-...-21cfbab Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0, Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextContainerIndex

func NextContainerIndex() int

func UniqueName

func UniqueName(namePrefix string) string

Types

type Container

type Container struct {
	Name           string
	IP             string
	ExtraSourceIPs []string
	IPPrefix       string
	IPv6           string
	IPv6Prefix     string
	Hostname       string

	Stdin io.WriteCloser
	// contains filtered or unexported fields
}

func Run

func Run(namePrefix string, opts RunOpts, args ...string) (c *Container)

func RunWithFixedName

func RunWithFixedName(name string, opts RunOpts, args ...string) (c *Container)

func (*Container) AttachTCPDump

func (c *Container) AttachTCPDump(iface string) *tcpdump.TCPDump

AttachTCPDump returns tcpdump attached to the container

func (*Container) BPFNATDump

func (c *Container) BPFNATDump() map[string][]string

BPFNATDump returns parsed out NAT maps keyed by "<ip> port <port> proto <proto>". Each value is list of "<ip>:<port>".

func (*Container) BPFNATHasBackendForService

func (c *Container) BPFNATHasBackendForService(svcIP string, svcPort, proto int, ip string, port int) bool

BPFNATHasBackendForService returns true is the given service has the given backend programmed in NAT tables

func (*Container) BPFRoutes

func (c *Container) BPFRoutes() string

BPFRoutes returns the output of calico-bpf routes dump, trimmed of whitespace and sorted.

func (*Container) CanConnectTo

func (c *Container) CanConnectTo(ip, port, protocol string, opts ...connectivity.CheckOption) *connectivity.Result

func (*Container) CopyFileIntoContainer

func (c *Container) CopyFileIntoContainer(hostPath, containerPath string) error

func (*Container) DataRaces

func (c *Container) DataRaces() []string

func (*Container) DockerInspect

func (c *Container) DockerInspect(format string) string

func (*Container) Exec

func (c *Container) Exec(cmd ...string)

func (*Container) ExecCombinedOutput

func (c *Container) ExecCombinedOutput(args ...string) (string, error)

func (*Container) ExecMayFail

func (c *Container) ExecMayFail(cmd ...string) error

func (*Container) ExecOutput

func (c *Container) ExecOutput(args ...string) (string, error)

func (*Container) ExecOutputFn

func (c *Container) ExecOutputFn(args ...string) func() (string, error)

func (*Container) ExecWithInput

func (c *Container) ExecWithInput(input []byte, cmd ...string)

func (*Container) FileExists

func (c *Container) FileExists(path string) bool

func (*Container) GetHostname

func (c *Container) GetHostname() string

func (*Container) GetID

func (c *Container) GetID() string

func (*Container) GetIP

func (c *Container) GetIP() string

func (*Container) GetIPPrefix

func (c *Container) GetIPPrefix() string

func (*Container) GetIPv6

func (c *Container) GetIPv6() string

func (*Container) GetIPv6Prefix

func (c *Container) GetIPv6Prefix() string

func (*Container) GetPIDs

func (c *Container) GetPIDs(processName string) []int

func (*Container) GetProcInfo

func (c *Container) GetProcInfo(processName string) []ProcInfo

func (*Container) GetSinglePID

func (c *Container) GetSinglePID(processName string) int

func (*Container) ListedInDockerPS

func (c *Container) ListedInDockerPS() bool

func (*Container) NumTCBPFProgs

func (c *Container) NumTCBPFProgs(ifaceName string) int

NumTCBPFProgs Returns the number of TC BPF programs attached to the given interface. Only direct-action programs are listed (i.e. the type that we use).

func (*Container) NumTCBPFProgsEth0

func (c *Container) NumTCBPFProgsEth0() int

NumTCBPFProgs Returns the number of TC BPF programs attached to eth0. Only direct-action programs are listed (i.e. the type that we use).

func (*Container) NumTCBPFProgsFn

func (c *Container) NumTCBPFProgsFn(ifaceName string) func() int

func (*Container) PreRetryCleanup

func (c *Container) PreRetryCleanup(ip, port, protocol string, opts ...connectivity.CheckOption)

func (*Container) Remove

func (c *Container) Remove()

Remove deletes a container. Should be manually called after a non-auto-removed container is stopped.

func (*Container) Signal

func (c *Container) Signal(sig os.Signal)

func (*Container) SourceIPs

func (c *Container) SourceIPs() []string

func (*Container) SourceName

func (c *Container) SourceName() string

func (*Container) Start

func (c *Container) Start()

Start executes "docker start" on a container. Useful when used after Stop() to restart a container.

func (*Container) Stop

func (c *Container) Stop()

func (*Container) StopLogs

func (c *Container) StopLogs()

func (*Container) Stopped

func (c *Container) Stopped() bool

func (*Container) WaitNotRunning

func (c *Container) WaitNotRunning(timeout time.Duration)

func (*Container) WaitUntilRunning

func (c *Container) WaitUntilRunning()

func (*Container) WatchStderrFor

func (c *Container) WatchStderrFor(re *regexp.Regexp) chan struct{}

func (*Container) WatchStdoutFor

func (c *Container) WatchStdoutFor(re *regexp.Regexp) chan struct{}

type ProcInfo

type ProcInfo struct {
	PID  int
	PPID int
}

type RunOpts

type RunOpts struct {
	AutoRemove       bool
	WithStdinPipe    bool
	IgnoreEmptyLines bool
	SameNamespace    *Container
	StopTimeoutSecs  int
	StopSignal       string
}

Jump to

Keyboard shortcuts

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