package shim
import "github.com/containerd/containerd/runtime/v2/shim"
Index ¶
- Variables
- func AdjustOOMScore(pid int) error
- func AnonDialer(address string, timeout time.Duration) (net.Conn, error)
- func AnonReconnectDialer(address string, timeout time.Duration) (net.Conn, error)
- func BinaryName(runtime string) string
- func CanConnect(address string) bool
- func Command(ctx context.Context, runtime, containerdAddress, containerdTTRPCAddress, path string, opts *types.Any, cmdArgs ...string) (*exec.Cmd, error)
- func Connect(address string, d func(string, time.Duration) (net.Conn, error)) (net.Conn, error)
- func NewSocket(address string) (*net.UnixListener, error)
- func ReadAddress(path string) (string, error)
- func RemoveSocket(address string) error
- func Run(id string, initFunc Init, opts ...BinaryOpts)
- func SetScore(pid int) error
- func SocketAddress(ctx context.Context, socketPath, id string) (string, error)
- func SocketEaddrinuse(err error) bool
- func WriteAddress(path, address string) error
- func WritePidFile(path string, pid int) error
- type BinaryOpts
- type Client
- func NewShimClient(ctx context.Context, svc shimapi.TaskService, signals chan os.Signal) *Client
- func (s *Client) Serve() error
- type Config
- type Init
- type Opts
- type OptsKey
- type Publisher
- type RemoteEventsPublisher
- func NewPublisher(address string) (*RemoteEventsPublisher, error)
- func (l *RemoteEventsPublisher) Close() (err error)
- func (l *RemoteEventsPublisher) Done() <-chan struct{}
- func (l *RemoteEventsPublisher) Publish(ctx context.Context, topic string, event events.Event) error
- type Shim
Variables ¶
ErrNoAddress is returned when the address file has no content
Functions ¶
func AdjustOOMScore ¶
AdjustOOMScore sets the OOM score for the process to the parents OOM score +1 to ensure that they parent has a lower* score than the shim if not already at the maximum OOM Score
func AnonDialer ¶
AnonDialer returns a dialer for a socket
func AnonReconnectDialer ¶
func BinaryName ¶
BinaryName returns the shim binary name from the runtime name, empty string returns means runtime name is invalid
func CanConnect ¶
CanConnect returns true if the socket provided at the address is accepting new connections
func Command ¶
func Command(ctx context.Context, runtime, containerdAddress, containerdTTRPCAddress, path string, opts *types.Any, cmdArgs ...string) (*exec.Cmd, error)
Command returns the shim command with the provided args and configuration
func Connect ¶
Connect to the provided address
func NewSocket ¶
func NewSocket(address string) (*net.UnixListener, error)
NewSocket returns a new socket
func ReadAddress ¶
ReadAddress returns the shim's socket address from the path
func RemoveSocket ¶
RemoveSocket removes the socket at the specified address if it exists on the filesystem
func Run ¶
func Run(id string, initFunc Init, opts ...BinaryOpts)
Run initializes and runs a shim server
func SetScore ¶
SetScore sets the oom score for a process
func SocketAddress ¶
SocketAddress returns a socket address
func SocketEaddrinuse ¶
SocketEaddrinuse returns true if the provided error is caused by the EADDRINUSE error number
func WriteAddress ¶
WriteAddress writes a address file atomically
func WritePidFile ¶
WritePidFile writes a pid file atomically
Types ¶
type BinaryOpts ¶
type BinaryOpts func(*Config)
BinaryOpts allows the configuration of a shims binary setup
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for a shim server
func NewShimClient ¶
NewShimClient creates a new shim server client
func (*Client) Serve ¶
Serve the shim server
type Config ¶
type Config struct { // NoSubreaper disables setting the shim as a child subreaper NoSubreaper bool // NoReaper disables the shim binary from reaping any child process implicitly NoReaper bool // NoSetupLogger disables automatic configuration of logrus to use the shim FIFO NoSetupLogger bool }
Config of shim binary options provided by shim implementations
type Init ¶
Init func for the creation of a shim server
type Opts ¶
Opts are context options associated with the shim invocation.
type OptsKey ¶
type OptsKey struct{}
OptsKey is the context key for the Opts value.
type Publisher ¶
Publisher for events
type RemoteEventsPublisher ¶
type RemoteEventsPublisher struct {
// contains filtered or unexported fields
}
func NewPublisher ¶
func NewPublisher(address string) (*RemoteEventsPublisher, error)
func (*RemoteEventsPublisher) Close ¶
func (l *RemoteEventsPublisher) Close() (err error)
func (*RemoteEventsPublisher) Done ¶
func (l *RemoteEventsPublisher) Done() <-chan struct{}
func (*RemoteEventsPublisher) Publish ¶
func (l *RemoteEventsPublisher) Publish(ctx context.Context, topic string, event events.Event) error
type Shim ¶
type Shim interface { shimapi.TaskService Cleanup(ctx context.Context) (*shimapi.DeleteResponse, error) StartShim(ctx context.Context, id, containerdBinary, containerdAddress, containerdTTRPCAddress string) (string, error) }
Shim server interface
Source Files ¶
publisher.go shim.go shim_unix.go util.go util_unix.go
- Version
- v1.4.11
- Published
- Oct 4, 2021
- Platform
- js/wasm
- Imports
- 36 packages
- Last checked
- 16 minutes ago –
Tools for package owners.