juju: github.com/juju/juju/container Index | Files | Directories

package container

import "github.com/juju/juju/container"

Index

Package Files

directory.go interface.go network.go storage.go test_interface.go utils.go

Constants

const (
    ConfigModelUUID        = "model-uuid"
    ConfigLogDir           = "log-dir"
    ConfigAvailabilityZone = "availability-zone"
)
const (
    // BridgeNetwork will have the container use the network bridge.
    BridgeNetwork = "bridge"
)

Variables

var (
    ContainerDir        = "/var/lib/juju/containers"
    RemovedContainerDir = "/var/lib/juju/removed-containers"
)
var RunningInContainer = func() bool {
    if runtime.GOOS != "linux" {
        return false
    }

    cmd := exec.Command("running-in-container")
    return cmd.Run() == nil
}

func ContainersSupported Uses

func ContainersSupported() bool

func FallbackInterfaceInfo Uses

func FallbackInterfaceInfo() []network.InterfaceInfo

FallbackInterfaceInfo returns a single "eth0" interface configured with DHCP.

func NewDirectory Uses

func NewDirectory(containerName string) (directory string, err error)

NewDirectory creates a new directory for the container name in the directory identified by `ContainerDir`.

func RemoveDirectory Uses

func RemoveDirectory(containerName string) error

RemoveDirectory moves the container directory from `ContainerDir` to `RemovedContainerDir` and makes sure that the names don't clash.

type Initialiser Uses

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 LXDProfileManager Uses

type LXDProfileManager interface {
    // AssignLXDProfiles assigns the given profile names to the lxd instance
    // provided.  The slice of ProfilePosts provides details for adding to
    // and removing profiles from the lxd server.
    AssignLXDProfiles(instId string, profilesNames []string, profilePosts []lxdprofile.ProfilePost) ([]string, error)

    // MaybeWriteLXDProfile, write given LXDProfile to machine if not already
    // there.
    MaybeWriteLXDProfile(pName string, put *charm.LXDProfile) error
}

LXDProfileManager defines an interface for dealing with lxd profiles used to deploy juju containers.

type LXDProfileNameRetriever Uses

type LXDProfileNameRetriever interface {
    // LXDProfileNames returns the list of available LXDProfile names from the
    // manager.
    LXDProfileNames(string) ([]string, error)
}

LXDProfileNameRetriever defines an interface for dealing with lxd profile names used to deploy juju containers.

type Manager Uses

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 environs.StatusCallbackFunc) (instances.Instance, *instance.HardwareCharacteristics, error)

    // DestroyContainer stops and destroys the container identified by
    // instance id.
    DestroyContainer(instance.Id) error

    // ListContainers return a list of containers that have been started by
    // this manager.
    ListContainers() ([]instances.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 Uses

type ManagerConfig map[string]string

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 Uses

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 Uses

func (m ManagerConfig) WarnAboutUnused()

WarnAboutUnused emits a warning about each value in the map.

type NetworkConfig Uses

type NetworkConfig struct {
    NetworkType string
    Device      string
    MTU         int

    Interfaces []network.InterfaceInfo
}

NetworkConfig defines how the container network will be configured.

func BridgeNetworkConfig Uses

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

type StorageConfig Uses

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.

type TestLXDManager Uses

type TestLXDManager interface {
    Manager
    LXDProfileManager
    LXDProfileNameRetriever
}

TestLXDManager for use in worker/provisioner tests

Directories

PathSynopsis
broker
broker/mocksPackage mocks is a generated GoMock package.
factory
kvmPackage kvm provides the facilities to deploy to kvm instances.
kvm/libvirt
kvm/mock
kvm/testing
lxd
lxd/mocksPackage mocks is a generated GoMock package.
lxd/testingPackage testing is a generated GoMock package.
testingPackage testing is a generated GoMock package.

Package container imports 14 packages (graph) and is imported by 521 packages. Updated 2019-09-24. Refresh now. Tools for package owners.