api

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Implementation of Config feature from the Compose spec

Index

Constants

View Source
const (
	// DockerNetworkName is the name of the Docker network used by uncloud. Keep the value in sync with NetworkName
	// in internal/machine/docker/manager.go.
	DockerNetworkName = "uncloud"
	LabelManaged      = "uncloud.managed"
	LabelServiceID    = "uncloud.service.id"
	LabelServiceName  = "uncloud.service.name"
	LabelServiceMode  = "uncloud.service.mode"
	LabelServicePorts = "uncloud.service.ports"
)
View Source
const (
	PortModeIngress = "ingress"
	PortModeHost    = "host"

	ProtocolHTTP  = "http"
	ProtocolHTTPS = "https"
	ProtocolTCP   = "tcp"
	ProtocolUDP   = "udp"
)
View Source
const (
	MilliCore = 1_000_000
	Core      = 1000 * MilliCore
)
View Source
const (
	ServiceModeReplicated = "replicated"
	ServiceModeGlobal     = "global"

	// PullPolicyAlways means the image is always pulled from the registry.
	PullPolicyAlways = "always"
	// PullPolicyMissing means the image is pulled from the registry only if it's not available on the machine where
	// a container is started. This is the default pull policy.
	// TODO: make each machine aware of the images on other machines and it possible to pull from them.
	// 	Pull from the registry only if the image is missing on all machines.
	PullPolicyMissing = "missing"
	// PullPolicyNever means the image is never pulled from the registry. A service with this pull policy can only be
	// deployed to machines where the image is already available.
	// TODO: see the TODO above for PullPolicyMissing. Pull from other machines in the cluster if available.
	PullPolicyNever = "never"
)
View Source
const (
	// VolumeTypeBind is the type for mounting a host path.
	VolumeTypeBind = "bind"
	// VolumeTypeVolume is the type for mounting a named Docker volume.
	VolumeTypeVolume = "volume"
	// VolumeTypeTmpfs is the type for mounting a temporary file system stored in the host memory.
	VolumeTypeTmpfs = "tmpfs"

	// VolumeDriverLocal is the default volume driver for local named Docker volumes.
	VolumeDriverLocal = "local"
)

Variables

View Source
var ErrLogStreamStalled = errors.New("log stream stopped responding")

ErrLogStreamStalled indicates that a log stream stopped sending data and may be unresponsive.

View Source
var ErrNotFound = errors.New("not found")

Functions

func LogStreamTypeToProto added in v0.15.0

func LogStreamTypeToProto(s LogStreamType) pb.ContainerLogEntry_StreamType

LogStreamTypeToProto converts LogStreamType to protobuf ContainerLogEntry.StreamType.

func PortsEqual

func PortsEqual(a, b []PortSpec) bool

PortsEqual returns true if the two port sets are equal. The order of the ports is not important.

func ValidateConfigsAndMounts added in v0.13.0

func ValidateConfigsAndMounts(configs []ConfigSpec, mounts []ConfigMount) error

ValidateConfigsAndMounts takes config specs and config mounts and validates that all mounts refer to existing specs

func ValidateServiceID

func ValidateServiceID(id string) bool

Types

type BindOptions added in v0.6.0

type BindOptions struct {
	// HostPath is the absolute path on the host filesystem.
	HostPath string
	// CreateHostPath indicates whether the host path should be created if it doesn't exist.
	// If false, deployment will fail if the path doesn't exist.
	CreateHostPath bool              `json:",omitempty"`
	Propagation    mount.Propagation `json:",omitempty"`
	Recursive      string            `json:",omitempty"`
}

BindOptions represents options for a bind volume.

type CaddySpec added in v0.11.1

type CaddySpec struct {
	// Config contains the Caddy config (Caddyfile) content. It must not conflict with the Caddy configs
	// of other services.
	Config string
}

CaddySpec is the Caddy reverse proxy configuration for a service.

func (*CaddySpec) Equals added in v0.11.1

func (c *CaddySpec) Equals(other *CaddySpec) bool

type ConfigMount added in v0.13.0

type ConfigMount struct {
	// ConfigName references a config defined in ServiceSpec.Configs by its Name field
	ConfigName string
	// ContainerPath is the absolute path where the config is mounted in the container
	ContainerPath string `json:",omitempty"`
	// Uid for the mounted config file
	Uid string `json:",omitempty"`
	// Gid for the mounted config file
	Gid string `json:",omitempty"`
	// Mode (file permissions) for the mounted config file
	Mode *os.FileMode `json:",omitempty"`
}

ConfigMount defines how a config is mounted into a container

func (*ConfigMount) GetNumericGid added in v0.13.0

func (c *ConfigMount) GetNumericGid() (*uint64, error)

func (*ConfigMount) GetNumericUid added in v0.13.0

func (c *ConfigMount) GetNumericUid() (*uint64, error)

func (*ConfigMount) Validate added in v0.13.0

func (c *ConfigMount) Validate() error

type ConfigSpec added in v0.13.0

type ConfigSpec struct {
	Name string

	// Content of the config when specified inline
	Content []byte `json:",omitempty"`
}

ConfigSpec defines a configuration object that can be mounted into containers

func (*ConfigSpec) Equals added in v0.13.0

func (c *ConfigSpec) Equals(other ConfigSpec) bool

Equals compares two ConfigSpec instances

func (*ConfigSpec) Validate added in v0.13.0

func (c *ConfigSpec) Validate() error

type Container

type Container struct {
	container.InspectResponse
	// contains filtered or unexported fields
}

func (*Container) CreatedTime added in v0.12.0

func (c *Container) CreatedTime() time.Time

CreatedTime returns the time when the container was created parsed from the Created field.

func (*Container) Healthy

func (c *Container) Healthy() bool

Healthy determines if the container is running and healthy. A running container with no health check configured is considered healthy.

func (*Container) HumanState

func (c *Container) HumanState() (string, error)

HumanState returns a human-readable description of the container's state. Based on the Docker implementation: https://github.com/moby/moby/blob/b343d235a0a1f30c8f05b1d651238e72158dc25d/container/state.go#L79-L113

func (*Container) UncloudNetworkIP added in v0.7.0

func (c *Container) UncloudNetworkIP() netip.Addr

UncloudNetworkIP returns the IP address of the container in the uncloud Docker network.

func (*Container) UnmarshalJSON

func (c *Container) UnmarshalJSON(data []byte) error

type ContainerClient

type ContainerClient interface {
	CreateContainer(
		ctx context.Context, serviceID string, spec ServiceSpec, machineID string,
	) (container.CreateResponse, error)
	InspectContainer(ctx context.Context, serviceNameOrID, containerNameOrID string) (MachineServiceContainer, error)
	RemoveContainer(ctx context.Context, serviceNameOrID, containerNameOrID string, opts container.RemoveOptions) error
	StartContainer(ctx context.Context, serviceNameOrID, containerNameOrID string) error
	StopContainer(ctx context.Context, serviceNameOrID, containerNameOrID string, opts container.StopOptions) error
	ExecContainer(ctx context.Context, serviceNameOrID, containerNameOrID string, config ExecOptions) (int, error)
}

type ContainerLogEntry added in v0.15.0

type ContainerLogEntry struct {
	Stream    LogStreamType
	Timestamp time.Time
	Message   []byte
	// Err indicates that an error occurred while streaming logs from a container.
	// Other fields are not set if Err is not nil.
	Err error
}

ContainerLogEntry represents a single log entry from a container.

type ContainerResources added in v0.7.0

type ContainerResources struct {
	// CPU is the maximum amount of CPU nanocores (1000000000 = 1 CPU core) the container can use.
	CPU int64
	// Memory is the maximum amount of memory (in bytes) the container can use.
	Memory int64
	// MemoryReservation is the minimum amount of memory (in bytes) the container needs to run efficiently.
	// TODO: implement a placement constraint that checks available memory on machines.
	MemoryReservation int64
	// Device reservations/requests for access to things like GPUs
	DeviceReservations []container.DeviceRequest
}

type ContainerSpec

type ContainerSpec struct {
	// Command overrides the default CMD of the image to be executed when running a container.
	Command []string
	// Entrypoint overrides the default ENTRYPOINT of the image.
	Entrypoint []string
	// Env defines the environment variables to set inside the container.
	Env   EnvVars
	Image string
	// Run a custom init inside the container. If nil, use the daemon's configured settings.
	Init *bool
	// LogDriver overrides the default logging driver for the container. Each Docker daemon can have its own default.
	LogDriver *LogDriver
	// Privileged gives extended privileges to the container. This is a security risk and should be used with caution.
	Privileged bool
	// PullPolicy determines when to pull the image from the registry or use the image already available in the cluster.
	// Default is PullPolicyMissing if empty.
	PullPolicy string
	// Resource allocation for the container.
	Resources ContainerResources
	// User overrides the default user of the image used to run the container. Format: user|UID[:group|GID].
	User string
	// VolumeMounts specifies how volumes are mounted into the container filesystem.
	// Each mount references a volume defined in ServiceSpec.Volumes.
	VolumeMounts []VolumeMount
	// ConfigMounts specifies how configs are mounted into the container filesystem.
	// Each mount references a config defined in ServiceSpec.Configs.
	ConfigMounts []ConfigMount
	// Volumes is list of data volumes to mount into the container.
	// TODO(lhf): delete all usage, has been replaced with []VolumeMounts.
	Volumes []string
}

ContainerSpec defines the desired state of a container in a service. ATTENTION: after changing this struct, verify if deploy.EvalContainerSpecChange needs to be updated.

func (*ContainerSpec) Clone

func (s *ContainerSpec) Clone() ContainerSpec

func (*ContainerSpec) Equals

func (s *ContainerSpec) Equals(spec ContainerSpec) bool

func (*ContainerSpec) SetDefaults

func (s *ContainerSpec) SetDefaults() ContainerSpec

SetDefaults returns a copy of the container spec with default values set.

func (*ContainerSpec) Validate

func (s *ContainerSpec) Validate() error

type DNSClient

type DNSClient interface {
	GetDomain(ctx context.Context) (string, error)
}

type EnvVars added in v0.6.0

type EnvVars map[string]string

func (EnvVars) ToSlice added in v0.6.0

func (e EnvVars) ToSlice() []string

ToSlice converts the environment variables to a slice of strings in the format "key=value".

type ExecOptions added in v0.14.0

type ExecOptions struct {
	// Command is the command to run in the container.
	Command []string
	// AttachStdin attaches the stdin stream to the exec session.
	AttachStdin bool
	// AttachStdout attaches the stdout stream to the exec session.
	AttachStdout bool
	// AttachStderr attaches the stderr stream to the exec session.
	AttachStderr bool
	// Tty allocates a pseudo-TTY for the exec session.
	Tty bool
	// Detach runs the command in the background without attaching to streams.
	Detach bool

	//// Not yet implemented fields
	// User specifies the user to run the command as.
	User string
	// Privileged runs the command in privileged mode.
	Privileged bool
	// WorkingDir sets the working directory for the command.
	WorkingDir string
	// Env sets environment variables for the command.
	Env []string

	// Client-side only fields (not serialized, not sent to server)
	// Stdin is the input stream. Defaults to os.Stdin if nil.
	Stdin io.Reader `json:"-"`
	// Stdout is the output stream. Defaults to os.Stdout if nil.
	Stdout io.Writer `json:"-"`
	// Stderr is the error stream. Defaults to os.Stderr if nil.
	Stderr io.Writer `json:"-"`
}

ExecOptions contains configuration for executing a command in a container.

type ImageClient

type ImageClient interface {
	InspectImage(ctx context.Context, id string) ([]MachineImage, error)
	InspectRemoteImage(ctx context.Context, id string) ([]MachineRemoteImage, error)
}

type ImageFilter added in v0.13.0

type ImageFilter struct {
	// Machines filters images to those present on the specified machines (names or IDs).
	// If empty, it matches images on all machines.
	Machines []string
	// Name filters images by name (with or without tag). Accepts a wildcard pattern.
	// If empty, it matches all image names.
	Name string
}

ImageFilter defines criteria to filter images in ListImages.

type LogDriver added in v0.7.0

type LogDriver struct {
	// Name of the logging driver to use.
	Name string
	// Options is the configuration options to pass to the logging driver.
	Options map[string]string
}

type LogStreamType added in v0.15.0

type LogStreamType int
const (
	LogStreamUnknown LogStreamType = iota
	LogStreamStdout
	LogStreamStderr
	// LogStreamHeartbeat represents a heartbeat log entry with a timestamp indicating that
	// there are no older logs than this timestamp.
	LogStreamHeartbeat
)

func LogStreamTypeFromProto added in v0.15.0

func LogStreamTypeFromProto(s pb.ContainerLogEntry_StreamType) LogStreamType

LogStreamTypeFromProto converts a protobuf ContainerLogEntry.StreamType to the internal LogStreamType.

type MachineClient

type MachineClient interface {
	InspectMachine(ctx context.Context, id string) (*pb.MachineMember, error)
	ListMachines(ctx context.Context, filter *MachineFilter) (MachineMembersList, error)
	UpdateMachine(ctx context.Context, req *pb.UpdateMachineRequest) (*pb.MachineInfo, error)
	RenameMachine(ctx context.Context, nameOrID, newName string) (*pb.MachineInfo, error)
}

type MachineFilter added in v0.6.0

type MachineFilter struct {
	// Available filters machines that are not DOWN.
	Available bool
	// NamesOrIDs filters machines by their names or IDs.
	NamesOrIDs []string
}

MachineFilter defines criteria to filter machines in ListMachines.

type MachineImage

type MachineImage struct {
	Metadata *pb.Metadata
	Image    image.InspectResponse
}

type MachineImages added in v0.13.0

type MachineImages struct {
	Metadata *pb.Metadata
	// Images is a list of images present on the machine.
	Images []image.Summary
	// ContainerdStore indicates whether Docker on the machine uses the containerd image store
	// (containerd-snapshotter feature).
	ContainerdStore bool
}

MachineImages represents images present on a particular machine.

type MachineMembersList added in v0.6.0

type MachineMembersList []*pb.MachineMember

func (MachineMembersList) FindByManagementIP added in v0.6.0

func (m MachineMembersList) FindByManagementIP(ip string) *pb.MachineMember

func (MachineMembersList) FindByNameOrID added in v0.6.0

func (m MachineMembersList) FindByNameOrID(nameOrID string) *pb.MachineMember

type MachineRemoteImage

type MachineRemoteImage struct {
	Metadata *pb.Metadata
	Image    RemoteImage
}

MachineRemoteImage represents an image in a remote registry fetched by a particular machine.

type MachineServiceContainer

type MachineServiceContainer struct {
	MachineID string
	Container ServiceContainer
}

type MachineVolume added in v0.6.0

type MachineVolume struct {
	// MachineID is the ID of the machine where the volume exists.
	MachineID string
	// MachineName is the name of the machine where the volume exists.
	MachineName string
	// Volume is the Docker volume model.
	Volume volume.Volume
}

MachineVolume represents a volume on a specific machine.

func (*MachineVolume) MatchesFilter added in v0.6.0

func (v *MachineVolume) MatchesFilter(filter *VolumeFilter) bool

MatchesFilter checks if a volume matches the specified filter criteria.

type Placement added in v0.6.0

type Placement struct {
	// Machines is a list of machine names or IDs where service containers are allowed to be deployed.
	// If empty, containers can be deployed to any available machine in the cluster.
	Machines []string `json:",omitempty"`
}

Placement defines the placement constraints for service containers.

type PortSpec

type PortSpec struct {
	// Hostname specifies the DNS name that will route to this service. Only valid in ingress mode.
	Hostname string
	// HostIP is the host IP to bind the PublishedPort to. Only valid in host mode.
	HostIP netip.Addr
	// PublishedPort is the port number exposed outside the container.
	// In ingress mode, this is the load balancer port. In host mode, this is the port bound on the host.
	PublishedPort uint16
	// ContainerPort is the port inside the container that the service listens on.
	ContainerPort uint16
	// Protocol specifies the network protocol.
	Protocol string
	// Mode specifies how the port is published.
	Mode string
}

func ParsePortSpec

func ParsePortSpec(port string) (PortSpec, error)

func (*PortSpec) String

func (p *PortSpec) String() (string, error)

String returns the port specification in the -p/--publish flag format. Format: [hostname:][load_balancer_port:]container_port/protocol for ingress mode (default) or [host_ip:]:host_port:container_port/protocol@host for host mode.

func (*PortSpec) Validate

func (p *PortSpec) Validate() error

type RemoteImage

type RemoteImage struct {
	Reference     reference.Canonical
	IndexManifest *v1.Index
	ImageManifest *v1.Manifest
}

RemoteImage represents an image in a remote registry. The canonical reference includes the image digest. Either IndexManifest or ImageManifest must be set depending on whether the reference points to an index (multi-platform image) or a single-platform image.

type RunServiceResponse added in v0.6.0

type RunServiceResponse struct {
	ID   string
	Name string
}

type Service

type Service struct {
	ID         string
	Name       string
	Mode       string
	Containers []MachineServiceContainer
}

func ServiceFromProto

func ServiceFromProto(s *pb.Service) (Service, error)

func (*Service) Endpoints

func (s *Service) Endpoints() []string

Endpoints returns the exposed HTTP and HTTPS endpoints of the service.

func (*Service) Images added in v0.13.0

func (s *Service) Images() []string

Images returns a sorted list of unique images used by the service containers.

func (*Service) MachineIDs added in v0.15.0

func (s *Service) MachineIDs() []string

MachineIDs returns a list of unique machine IDs where the service containers are running.

type ServiceClient

type ServiceClient interface {
	RunService(ctx context.Context, spec ServiceSpec) (RunServiceResponse, error)
	InspectService(ctx context.Context, id string) (Service, error)
	RemoveService(ctx context.Context, id string) error
	StopService(ctx context.Context, id string, opts container.StopOptions) error
	StartService(ctx context.Context, id string) error
}

type ServiceContainer

type ServiceContainer struct {
	Container
	ServiceSpec ServiceSpec
}

func (*ServiceContainer) ConflictingServicePorts

func (c *ServiceContainer) ConflictingServicePorts(ports []PortSpec) ([]PortSpec, error)

ConflictingServicePorts returns a list of service ports that conflict with the given ports.

func (*ServiceContainer) ServiceID

func (c *ServiceContainer) ServiceID() string

ServiceID returns the ID of the service this container belongs to.

func (*ServiceContainer) ServiceMode

func (c *ServiceContainer) ServiceMode() string

ServiceMode returns the replication mode of the service this container belongs to.

func (*ServiceContainer) ServiceName

func (c *ServiceContainer) ServiceName() string

ServiceName returns the name of the service this container belongs to.

func (*ServiceContainer) ServicePorts

func (c *ServiceContainer) ServicePorts() ([]PortSpec, error)

ServicePorts returns the ports this container publishes as part of its service.

func (*ServiceContainer) ShortID added in v0.14.0

func (c *ServiceContainer) ShortID() string

ShortID returns the truncated ID of the container (12 characters).

func (*ServiceContainer) UnmarshalJSON added in v0.12.0

func (c *ServiceContainer) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for ServiceContainer to override the custom unmarshaler of the embedded Container field.

type ServiceLogEntry added in v0.15.0

type ServiceLogEntry struct {
	// Metadata may not be set if an error occurred (Err is not nil).
	Metadata ServiceLogEntryMetadata
	ContainerLogEntry
}

ServiceLogEntry represents a single log entry from a service container.

type ServiceLogEntryMetadata added in v0.15.0

type ServiceLogEntryMetadata struct {
	ServiceID   string
	ServiceName string
	ContainerID string
	MachineID   string
	MachineName string
}

ServiceLogEntryMetadata contains metadata about the source of a log entry.

type ServiceLogsOptions added in v0.15.0

type ServiceLogsOptions struct {
	Follow bool
	Tail   int
	Since  string
	Until  string
	// Machines filters logs to only include containers running on the specified machines (names or IDs).
	// If empty, logs from all machines are included.
	Machines []string
}

ServiceLogsOptions specifies parameters for ServiceLogs.

type ServiceSpec

type ServiceSpec struct {
	// Caddy is the optional Caddy reverse proxy configuration for the service.
	// Caddy and Ports cannot be specified simultaneously.
	Caddy *CaddySpec `json:",omitempty"`
	// Container defines the desired state of each container in the service.
	Container ContainerSpec
	// Mode is the replication mode of the service. Default is ServiceModeReplicated if empty.
	Mode string
	Name string
	// Placement defines the placement constraints for the service.
	Placement Placement
	// Ports defines what service ports to publish to make the service accessible outside the cluster.
	// Caddy and Ports cannot be specified simultaneously.
	Ports []PortSpec
	// Replicas is the number of containers to run for the service. Only valid for a replicated service.
	Replicas uint `json:",omitempty"`
	// Volumes is list of data volumes that can be mounted into the container.
	Volumes []VolumeSpec
	// Configs is list of configuration objects that can be mounted into the container.
	Configs []ConfigSpec
}

ServiceSpec defines the desired state of a service. ATTENTION: after changing this struct, verify if deploy.EvalContainerSpecChange needs to be updated.

func (*ServiceSpec) CaddyConfig added in v0.12.0

func (s *ServiceSpec) CaddyConfig() string

CaddyConfig returns the Caddy reverse proxy configuration for the service or an empty string if it's not defined.

func (*ServiceSpec) Clone

func (s *ServiceSpec) Clone() ServiceSpec

func (*ServiceSpec) Config added in v0.13.0

func (s *ServiceSpec) Config(name string) (ConfigSpec, bool)

func (*ServiceSpec) MountedDockerVolumes added in v0.6.0

func (s *ServiceSpec) MountedDockerVolumes() []VolumeSpec

MountedDockerVolumes returns the list of volumes of VolumeTypeVolume type that are mounted into the container.

func (*ServiceSpec) SetDefaults

func (s *ServiceSpec) SetDefaults() ServiceSpec

func (*ServiceSpec) Validate

func (s *ServiceSpec) Validate() error

func (*ServiceSpec) Volume added in v0.6.0

func (s *ServiceSpec) Volume(name string) (VolumeSpec, bool)

type VolumeClient added in v0.6.0

type VolumeClient interface {
	CreateVolume(ctx context.Context, machineNameOrID string, opts volume.CreateOptions) (MachineVolume, error)
	ListVolumes(ctx context.Context, filter *VolumeFilter) ([]MachineVolume, error)
	RemoveVolume(ctx context.Context, machineNameOrID, volumeName string, force bool) error
}

type VolumeFilter added in v0.6.0

type VolumeFilter struct {
	// Driver filters volumes by storage driver name.
	Driver string
	// Labels filters volumes by label key-value pairs. Volumes must match all labels.
	Labels map[string]string
	// Machines filters volumes to those on the specified machines (names or IDs).
	Machines []string
	// Names filters volumes by name. Volumes must match one of the names.
	Names []string
}

VolumeFilter defines criteria to filter volumes in ListVolumes.

type VolumeMount added in v0.6.0

type VolumeMount struct {
	// VolumeName references a volume defined in ServiceSpec.Volumes by its Name field.
	VolumeName string
	// ContainerPath is the absolute path where the volume is mounted in the container.
	ContainerPath string
	// ReadOnly indicates whether the volume should be mounted read-only.
	// If false (default), the volume is mounted read-write.
	ReadOnly bool `json:",omitempty"`
}

VolumeMount defines how a volume is mounted into a container.

func (*VolumeMount) Validate added in v0.6.0

func (m *VolumeMount) Validate() error

type VolumeOptions added in v0.6.0

type VolumeOptions struct {
	// Driver specifies the volume driver and its options for volume creation.
	// TODO: It seems we don't really need Driver and Labels if we only support externally managed volumes.
	//  However we may need them in the future if we add support for isolated container-scoped volumes.
	Driver *mount.Driver `json:",omitempty"`
	// Labels are key-value metadata to apply to the volume if creating a new volume.
	Labels map[string]string `json:",omitempty"`
	// Name of the named Docker volume to use. If not specified, defaults to the VolumeSpec.Name.
	Name string `json:",omitempty"`
	// NoCopy prevents automatic copying of data from the container mount path to the volume.
	NoCopy bool `json:",omitempty"`
	// SubPath is the path within the volume to mount instead of its root.
	SubPath string `json:",omitempty"`
}

VolumeOptions represents options for a named Docker volume.

type VolumeSpec added in v0.6.0

type VolumeSpec struct {
	// Name is the volume name used to reference this volume in container mounts.
	Name          string
	Type          string
	BindOptions   *BindOptions        `json:",omitempty"`
	TmpfsOptions  *mount.TmpfsOptions `json:",omitempty"`
	VolumeOptions *VolumeOptions      `json:",omitempty"`
}

VolumeSpec defines a volume mount specification. As of April 2025, the volume must be created before deploying a service using it.

func (*VolumeSpec) Clone added in v0.6.0

func (v *VolumeSpec) Clone() VolumeSpec

func (*VolumeSpec) DockerVolumeName added in v0.6.0

func (v *VolumeSpec) DockerVolumeName() string

func (*VolumeSpec) Equals added in v0.6.0

func (v *VolumeSpec) Equals(other VolumeSpec) bool

func (*VolumeSpec) MatchesDockerVolume added in v0.6.0

func (v *VolumeSpec) MatchesDockerVolume(vol volume.Volume) bool

MatchesDockerVolume checks if this VolumeSpec is compatible with the given named Docker volume. In other words, it checks if the spec could be used to mount the volume.

func (*VolumeSpec) SetDefaults added in v0.6.0

func (v *VolumeSpec) SetDefaults() VolumeSpec

func (*VolumeSpec) Validate added in v0.6.0

func (v *VolumeSpec) Validate() error

Jump to

Keyboard shortcuts

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