volumes

package
v0.0.0-...-a0e73d3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	OsCommandRunner  OsCommandRunner
	MetadataProvider metadata.Provider
}

Environment struct for dependency injection.

func (Env) PrepareVolumesAndGetBindings

func (env Env) PrepareVolumesAndGetBindings(spec api.ContainerSpecStruct) (map[string][]HostPathBindConfiguration, error)

PrepareVolumesAndGetBindings does 3 things:

  • Verifies if the container specification passed to it is correct in terms of volumes it references.
  • Creates/mounts/formats all the necessary volumes.
  • Outputs the binding map, which will be used by the container runtime to bind the volumes containers.

The function takes a container specification struct. It operates in context of its environment (the receiver), which consist of two parts:

  • OsCommandRunner: it executes the commands issued during execution of the function.
  • MetadataProvider: it is the source of additional information coming from the metadata, used in processing persistent disks.

The function returns a map, its keys are container names (currently this should be a single name) and values are slices of hostPath binds. These corresponds to files and directories that are mounted in a container. Currently all supported types of volumes (EmptyDir, HostPath and PersistentDisk) are ultimately handled using a Docker's hostPath bind.

The caller should not expect the function to be idempotent. Errors are to be considered non-retryable.

func (Env) UnmountExistingVolumes

func (env Env) UnmountExistingVolumes() error

UnmountExistingVolumes unmounts all volumes mounted under the directory managed by konlet. The function continues even if some unmounting operations fail and reports errors, if any, at the end.

type HostPathBindConfiguration

type HostPathBindConfiguration struct {
	HostPath      string
	ContainerPath string
	ReadOnly      bool
}

type OsCommandRunner

type OsCommandRunner interface {
	Run(...string) (string, error)
	MkdirAll(path string, perm os.FileMode) error
	Stat(name string) (os.FileInfo, error)
}

type VolumeHostPathAndMode

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

Jump to

Keyboard shortcuts

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