juju: github.com/juju/juju/network/containerizer Index | Files

package containerizer

import "github.com/juju/juju/network/containerizer"

Index

Package Files

bridgepolicy.go shim.go

func BridgeNameForDevice Uses

func BridgeNameForDevice(device string) string

The general policy is to: 1. Add br- to device name (to keep current behaviour),

if it does not fit in 15 characters then:

2. Add b- to device name, if it doesn't fit in 15 characters then: 3a. For devices starting in 'en' remove 'en' and add 'b-' 3b. For all other devices

'b-' + 6-char hash of name + '-' + last 6 chars of name

4. If using the device name directly always replace '.' with '-'

to make sure that bridges from VLANs won't break

type Address Uses

type Address interface {
    Subnet() (Subnet, error)
    DeviceName() string
}

Address is an indirection for state.Address.

func NewAddress Uses

func NewAddress(a *state.Address) Address

NewAddress wraps the given state.Address in an addressShim.

type BridgePolicy Uses

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

BridgePolicy defines functionality that helps us create and define bridges for guests inside of a host machine, along with the creation of network devices on those bridges for the containers to use.

func NewBridgePolicy Uses

func NewBridgePolicy(cfgGetter environs.ConfigGetter, st SpaceBacking) (*BridgePolicy, error)

NewBridgePolicy returns a new BridgePolicy for the input environ config getter and state indirection.

func (*BridgePolicy) FindMissingBridgesForContainer Uses

func (p *BridgePolicy) FindMissingBridgesForContainer(
    host Machine, guest Container,
) ([]network.DeviceToBridge, int, error)

FindMissingBridgesForContainer looks at the spaces that the container should have access to, and returns any host devices need to be bridged for use as the container network. This will return an Error if the container requires a space that the host machine cannot provide.

func (*BridgePolicy) PopulateContainerLinkLayerDevices Uses

func (p *BridgePolicy) PopulateContainerLinkLayerDevices(host Machine, guest Container) error

PopulateContainerLinkLayerDevices sets the link-layer devices of the input guest, setting each device to be a child of the corresponding bridge on the host machine. It also records when one of the desired spaces is available on the host machine, but not currently bridged.

type Container Uses

type Container interface {
    Machine
    ContainerType() instance.ContainerType
    Constraints() (constraints.Value, error)
}

Container is an indirection for state.Machine, describing a container.

type LinkLayerDevice Uses

type LinkLayerDevice interface {
    Name() string
    Type() network.LinkLayerDeviceType
    MACAddress() string
    ParentName() string
    ParentDevice() (LinkLayerDevice, error)
    EthernetDeviceForBridge(name string) (state.LinkLayerDeviceArgs, error)
    Addresses() ([]*state.Address, error)

    // These are recruited in tests. See comment on Machine below.
    MTU() uint
    IsUp() bool
    IsAutoStart() bool
}

LinkLayerDevice is an indirection for state.LinkLayerDevice. It facilitates testing the provisioner's use of this package.

func NewLinkLayerDevice Uses

func NewLinkLayerDevice(dev *state.LinkLayerDevice) LinkLayerDevice

NewLinkLayerDevice wraps the given state.LinkLayerDevice in a linkLayerDevice.

type Machine Uses

type Machine interface {
    Id() string
    AllAddresses() ([]Address, error)
    AllSpaces() (set.Strings, error)
    SetLinkLayerDevices(devicesArgs ...state.LinkLayerDeviceArgs) (err error)
    AllLinkLayerDevices() ([]LinkLayerDevice, error)

    // TODO (manadart 2018-10-10) These methods are used in tests, which rely
    // on the StateSuite. Some of them are recruited via the Container
    // interface below, but they are all located here for simplicity.
    // A better approach could be sought that does not require their
    // presence here.
    SetDevicesAddresses(devicesAddresses ...state.LinkLayerDeviceAddress) (err error)
    SetParentLinkLayerDevicesBeforeTheirChildren(devicesArgs []state.LinkLayerDeviceArgs) error
    SetConstraints(cons constraints.Value) (err error)
    RemoveAllAddresses() error
    Raw() *state.Machine
}

Machine is an indirection for state.Machine, describing a machine that is to host containers.

type MachineShim Uses

type MachineShim struct {
    *state.Machine
}

MachineShim implements Machine. It is required to mock the return of LinkLayerDevicesForSpaces, which includes raw state.LinkLayerDevice references.

func NewMachine Uses

func NewMachine(m *state.Machine) *MachineShim

NewMachine wraps the given state.machine in a MachineShim.

func (*MachineShim) AllAddresses Uses

func (m *MachineShim) AllAddresses() ([]Address, error)

AllAddresses implements Machine by wrapping each state.Address reference in returned collection with the local Address implementation.

func (*MachineShim) AllLinkLayerDevices Uses

func (m *MachineShim) AllLinkLayerDevices() ([]LinkLayerDevice, error)

AllLinkLayerDevices implements Machine by wrapping each state.LinkLayerDevice reference in returned collection with the local LinkLayerDevice implementation.

func (*MachineShim) Raw Uses

func (m *MachineShim) Raw() *state.Machine

Raw returns the inner state.Machine reference.

type SpaceBacking Uses

type SpaceBacking interface {
    AllSpaceInfos() (network.SpaceInfos, error)
}

SpaceBacking describes the retrieval of all spaces from the DB.

type Subnet Uses

type Subnet interface {
    SpaceID() string
}

Subnet is an indirection for state.Subnet.

Package containerizer imports 13 packages (graph) and is imported by 5 packages. Updated 2020-01-09. Refresh now. Tools for package owners.