operate

package
v0.0.0-...-1c77d03 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RetryPolicy

type RetryPolicy struct {
	MaxAttempts  int
	InitialDelay time.Duration
	MaxDelay     time.Duration
	Multiplier   float64
}

RetryPolicy describes a capped exponential backoff with jitter.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime is the long-lived handle to whichever container engine is in use. Clients are cached so each RPC reuses the same daemon connection.

func NewRuntime

func NewRuntime(opts RuntimeOptions) (*Runtime, error)

NewRuntime determines which runtime to talk to and validates the choice. Construction is eager but the underlying daemon client is created lazily on first use.

func (*Runtime) Commit

func (r *Runtime) Commit(ctx context.Context, containerID, image string) (string, error)

Commit takes a snapshot of the named container and tags it as `image`.

func (*Runtime) Kind

func (r *Runtime) Kind() RuntimeKind

Kind returns the resolved runtime kind. Useful for diagnostics.

func (*Runtime) Push

func (r *Runtime) Push(ctx context.Context, image, username, password string) (string, error)

Push uploads the local image to its remote registry, authenticating with the supplied credentials. The push is retried with capped exponential backoff if the underlying registry returns a transient error.

type RuntimeKind

type RuntimeKind string

RuntimeKind enumerates the supported container runtimes.

const (
	RuntimeDocker     RuntimeKind = "docker"
	RuntimeContainerd RuntimeKind = "containerd"
)

type RuntimeOptions

type RuntimeOptions struct {
	// Override forces a specific runtime ("docker" or "containerd"). When
	// empty, the package picks based on the presence of host sockets and the
	// CONTAINER_RUNTIME environment variable.
	Override string
	// ContainerdNamespace is the namespace used to look up containers in
	// containerd. Default "k8s.io".
	ContainerdNamespace string
	// PushRetry tunes the retry policy for push operations. Zero values use
	// sensible defaults; set MaxAttempts=1 to disable retries.
	PushRetry RetryPolicy
	// DockerSocket / ContainerdSocket override the auto-detection paths,
	// primarily for tests.
	DockerSocket     string
	ContainerdSocket string
}

RuntimeOptions controls how the runtime singleton is constructed.

Jump to

Keyboard shortcuts

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