options

package
v0.0.0-...-8882cbc Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package options provides options that can be used by container orchestration implementation.

Index

Constants

View Source
const (

	// Image filters for containers based on this image.
	Image FilterKey = "image"

	// Container filters by container name.
	Container = "container"

	// State filters by container state.
	State = "state"

	// Volume filters by volume name.
	Volume = "volume"
)

Variables

This section is empty.

Functions

func ApplyOptions

func ApplyOptions(opts ...Option) *options

ApplyOptions sets the passed options.

func ParseCPUs

func ParseCPUs(value float64) (int64, error)

ParseCPUs takes a float returns an integer value of nano cpus

Types

type FilterKey

type FilterKey string

FilterKey represents a key for a filter.

type ListContainerStreamer

type ListContainerStreamer interface {
	Send(msg *cpb.ListContainerResponse) error
}

ListContainerStreamer is an entity capable of streaming container information.

type ListImageStreamer

type ListImageStreamer interface {
	Send(msg *cpb.ListImageResponse) error
}

ListImageStreamer is an entity capable of streaming container information.

type ListVolumeStreamer

type ListVolumeStreamer interface {
	Send(msg *cpb.ListVolumeResponse) error
}

ListVolumeStreamer is an entity capable of streaming volume information.

type LogStreamer

type LogStreamer interface {
	Send(msg *cpb.LogResponse) error
}

LogStreamer is an entity capable of streaming logs.

type Option

type Option func(*options)

Option takes an option and applies it to the set of options when the function is called.

func Follow

func Follow() Option

Follow specifies whether logs should be followed.

func Force

func Force() Option

Force sets the force operation field in the image options. Supported by: ContainerRemove, ContainerStop

func WithCPUs

func WithCPUs(cpus float64) Option

WithCPUs provides the CPU limit for the container. Supported by: ContainerStart, ContainerUpdate

func WithCapabilities

func WithCapabilities(opts proto.Message) Option

WithCapabilities provides optional lists of added/removed container capabilities. Supported by: ContainerStart, ContainerUpdate

func WithDevices

func WithDevices(devices []*cpb.Device) Option

WithDevices sets the devices to attach to a container. Supported by: ContainerStart

func WithEnv

func WithEnv(envMapping map[string]string) Option

WithEnv specifies the set environment variables to set in the container. Supported by: ContainerStart

func WithFilter

func WithFilter(filter map[FilterKey][]string) Option

WithFilter provides the filter option. Supported by: ContainerList, VolumeList

func WithHardLimit

func WithHardLimit(mem int64) Option

WithHardLimit provides the hard memory limit (in bytes) for the container. Supported by: ContainerStart, ContainerUpdate

func WithInstanceName

func WithInstanceName(instance string) Option

WithInstanceName sets the name of the instance of a container. Supported by: ContainerStart

func WithLabels

func WithLabels(labels map[string]string) Option

WithLabels provides an optional set of labels to attach to the container. Supported by: ContainerStart, ContainerUpdate

func WithNetwork

func WithNetwork(network string) Option

WithNetwork provides the network to attach this container to. Supported by: ContainerStart, ContainerUpdate

func WithPorts

func WithPorts(portMappings map[uint32]uint32) Option

WithPorts specifies the set of exposed ports for a container. Supported by: ContainerStart

func WithRegistryAuth

func WithRegistryAuth(creds *tpb.Credentials) Option

WithRegistryAuth sets the credentials to use for this pull operation. Supported by: ImagePull

func WithRestartPolicy

func WithRestartPolicy(opts proto.Message) Option

WithRestartPolicy provides an optional restart policy for the container. Supported by: ContainerStart, ContainerUpdate

func WithRunAs

func WithRunAs(opts proto.Message) Option

WithRunAs provides an optional user (and potentially group) to run the container as. Supported by: ContainerStart, ContainerUpdate

func WithSince

func WithSince(t time.Duration) Option

WithSince specifies from when to collect logs.

func WithSoftLimit

func WithSoftLimit(mem int64) Option

WithSoftLimit provides the soft memory limit (in bytes) for the container. Supported by: ContainerStart, ContainerUpdate

func WithStream

func WithStream(client Stream) Option

WithStream sets the stream to use to return results to the caller. Supported by: ImagePull

func WithTarget

func WithTarget(image, tag string) Option

WithTarget sets the target image name and tag option for this pull operation. Supported by: ImagePush, ImagePull

func WithUntil

func WithUntil(t time.Duration) Option

WithUntil specifies until when to collect logs.

func WithVolumeDriverOpts

func WithVolumeDriverOpts(opts proto.Message) Option

WithVolumeDriverOpts provides the volume driver options. Supported by: CreateVolume

func WithVolumeLabels

func WithVolumeLabels(labels map[string]string) Option

WithVolumeLabels provides the volume labels. Supported by: CreateVolume

func WithVolumes

func WithVolumes(volumes []*cpb.Volume) Option

WithVolumes sets the volumes to attach to a container. Supported by: ContainerStart

type Stream

type Stream interface {
	Send(*cpb.DeployResponse) error
}

Stream represents an entity capable of sending responses to the client.

Directories

Path Synopsis
Package docker implements a container manager for docker orchestration.
Package docker implements a container manager for docker orchestration.

Jump to

Keyboard shortcuts

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