Documentation ¶
Index ¶
- Constants
- Variables
- func ContainersSupported() bool
- func FallbackInterfaceInfo() []network.InterfaceInfo
- func NewDirectory(containerName string) (directory string, err error)
- func RemoveDirectory(containerName string) error
- type Initialiser
- type Manager
- type ManagerConfig
- type NetworkConfig
- type StatusCallback
- type StorageConfig
Constants ¶
const ( ConfigModelUUID = "model-uuid" ConfigLogDir = "log-dir" )
const ( // BridgeNetwork will have the container use the network bridge. BridgeNetwork = "bridge" // PhyscialNetwork will have the container use a specified network device. PhysicalNetwork = "physical" // DefaultLxdBridge is the default name for the lxd bridge. DefaultLxdBridge = "lxdbr0" // DefaultLxcBridge is the package created container bridge. DefaultLxcBridge = "lxcbr0" // DefaultKvmBridge is the default bridge for KVM instances. DefaultKvmBridge = "virbr0" )
Variables ¶
var ( ContainerDir = "/var/lib/juju/containers" RemovedContainerDir = "/var/lib/juju/removed-containers" )
Functions ¶
func ContainersSupported ¶
func ContainersSupported() bool
func FallbackInterfaceInfo ¶
func FallbackInterfaceInfo() []network.InterfaceInfo
FallbackInterfaceInfo returns a single "eth0" interface configured with DHCP.
func NewDirectory ¶
NewDirectory creates a new directory for the container name in the directory identified by `ContainerDir`.
func RemoveDirectory ¶
RemoveDirectory moves the container directory from `ContainerDir` to `RemovedContainerDir` and makes sure that the names don't clash.
Types ¶
type Initialiser ¶
type Initialiser interface { // Initialise installs all required packages, sync any images etc so // that the host machine can run containers. Initialise() error }
Initialiser is responsible for performing the steps required to initialise a host machine so it can run containers.
type Manager ¶
type Manager interface { // CreateContainer creates and starts a new container for the specified // machine. CreateContainer( instanceConfig *instancecfg.InstanceConfig, cons constraints.Value, series string, network *NetworkConfig, storage *StorageConfig, callback StatusCallback) (instance.Instance, *instance.HardwareCharacteristics, error) // DestroyContainer stops and destroyes the container identified by // instance id. DestroyContainer(instance.Id) error // ListContainers return a list of containers that have been started by // this manager. ListContainers() ([]instance.Instance, error) // IsInitialized check whether or not required packages have been installed // to support this manager. IsInitialized() bool // Namespace returns the namespace of the manager. This namespace defines the // prefix of all the hostnames. Namespace() instance.Namespace }
Manager is responsible for starting containers, and stopping and listing containers that it has started.
type ManagerConfig ¶
ManagerConfig contains the initialization parameters for the ContainerManager. The name of the manager is used to namespace the containers on the machine.
func (ManagerConfig) PopValue ¶
func (m ManagerConfig) PopValue(key string) string
PopValue returns the requested key from the config map. If the value doesn't exist, the function returns the empty string. If the value does exist, the value is returned, and the element removed from the map.
func (ManagerConfig) WarnAboutUnused ¶
func (m ManagerConfig) WarnAboutUnused()
WarnAboutUnused emits a warning about each value in the map.
type NetworkConfig ¶
type NetworkConfig struct { NetworkType string Device string MTU int Interfaces []network.InterfaceInfo }
NetworkConfig defines how the container network will be configured.
func BridgeNetworkConfig ¶
func BridgeNetworkConfig(device string, mtu int, interfaces []network.InterfaceInfo) *NetworkConfig
BridgeNetworkConfig returns a valid NetworkConfig to use the specified device as a network bridge for the container. It also allows passing in specific configuration for the container's network interfaces and default MTU to use. If interfaces is empty, FallbackInterfaceInfo() is used to get the a sane default
func PhysicalNetworkConfig ¶
func PhysicalNetworkConfig(device string, mtu int, interfaces []network.InterfaceInfo) *NetworkConfig
PhysicalNetworkConfig returns a valid NetworkConfig to use the specified device as the network device for the container. It also allows passing in specific configuration for the container's network interfaces and default MTU to use. If interfaces is nil the default configuration is used for the respective container type.
type StatusCallback ¶
type StorageConfig ¶
type StorageConfig struct { // AllowMount is true is the container is required to allow // mounting block devices. AllowMount bool }
StorageConfig defines how the container will be configured to support storage requirements.