Documentation ¶
Overview ¶
Package volume provides volumes like Docker and Amazon ECS. Volumes are specicial directories that could be shared by multiple containers.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#volumes
Index ¶
- type GuestVolumeImageInput
- type GuestVolumeImageOutput
- type GuestVolumeImageProvider
- type ImageOpt
- type Mount
- type Provider
- type Set
- func (vs *Set) Add(v *Volume)
- func (vs *Set) AddFrom(ctx context.Context, vp Provider) error
- func (vs *Set) PrepareDirectory(ctx context.Context) (retErr error)
- func (vs *Set) PrepareDriveMount(ctx context.Context, size int64) (dm *proto.FirecrackerDriveMount, retErr error)
- func (vs *Set) PrepareInGuest(ctx context.Context, container string) error
- func (vs *Set) WithMounts(mountpoints []Mount) (oci.SpecOpts, error)
- func (vs *Set) WithMountsFromProvider(name string) (oci.SpecOpts, error)
- type Volume
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GuestVolumeImageInput ¶
GuestVolumeImageInput is volume-init command's input.
type GuestVolumeImageOutput ¶
type GuestVolumeImageOutput struct {
Error string
}
GuestVolumeImageOutput is volume-init command's output.
type GuestVolumeImageProvider ¶
type GuestVolumeImageProvider struct {
// contains filtered or unexported fields
}
GuestVolumeImageProvider expose volumes from in-VM snapshotters.
func FromGuestImage ¶
func FromGuestImage(client *containerd.Client, vmID, image, snapshot string, volumes []string, opts ...ImageOpt) *GuestVolumeImageProvider
FromGuestImage returns a new provider to that expose the volumes on the given image.
func (*GuestVolumeImageProvider) CreateVolumesUnder ¶
func (p *GuestVolumeImageProvider) CreateVolumesUnder(ctx context.Context, tempDir string) ([]*Volume, error)
CreateVolumesUnder creates volumes under the given directory.
func (*GuestVolumeImageProvider) Delete ¶
func (*GuestVolumeImageProvider) Delete(ctx context.Context) error
Delete all resources made by the provider.
func (*GuestVolumeImageProvider) Name ¶
func (p *GuestVolumeImageProvider) Name() string
Name of the provider.
type ImageOpt ¶
type ImageOpt func(*imageProviderConfig)
ImageOpt allows setting optional properties of the provider.
func WithPullOptions ¶
func WithPullOptions(opts ...containerd.RemoteOpt) ImageOpt
WithPullOptions sets the snapshotter's pull options.
func WithSnapshotter ¶
WithSnapshotter sets the snapshotter to pull images.
type Mount ¶
type Mount struct { // Source is the name of a volume. Source string // Destination is the path inside the container where the volume is mounted. Destination string // ReadOnly is true if the volume is mounted as read-only. ReadOnly bool // contains filtered or unexported fields }
Mount is used to expose volumes to containers.
type Provider ¶
type Provider interface { // Name of the provider. Name() string // CreateVolumesUnder creates volumes under the given directory. CreateVolumesUnder(ctx context.Context, tempDir string) ([]*Volume, error) // Delete all resources made by the provider. Delete(ctx context.Context) error }
Provider provides volumes from different sources.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is a set of volumes.
func NewSetWithTempDir ¶
NewSetWithTempDir returns a new volume set and creates all temporary files under the tempDir.
func (*Set) PrepareDirectory ¶
PrepareDirectory creates a directory that have volumes.
func (*Set) PrepareDriveMount ¶
func (vs *Set) PrepareDriveMount(ctx context.Context, size int64) (dm *proto.FirecrackerDriveMount, retErr error)
PrepareDriveMount returns a FirecrackerDriveMount that could be used with CreateVM.
func (*Set) PrepareInGuest ¶
PrepareInGuest prepares volumes inside the VM.
func (*Set) WithMounts ¶
WithMounts expose given volumes to the container.