kawasaki

package
v0.0.0-...-cf22b21 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPortMapping

func AddPortMapping(logger lager.Logger, configStore ConfigStore, handle string, newMapping garden.PortMapping) error

func New

func New(
	specParser SpecParser,
	subnetPool subnets.Pool,
	configCreator ConfigCreator,
	configStore ConfigStore,
	configurer Configurer,
	portPool PortPool,
	portForwarder PortForwarder,
	firewallOpener FirewallOpener,
) *networker

func NewConfigurer

func NewConfigurer(resolvConfigurer DnsResolvConfigurer, hostConfigurer HostConfigurer, containerConfigurer ContainerConfigurer, instanceChainCreator InstanceChainCreator) *configurer

Types

type ConfigCreator

type ConfigCreator interface {
	Create(log lager.Logger, handle string, subnet *net.IPNet, ip net.IP) (NetworkConfig, error)
}

type ConfigStore

type ConfigStore interface {
	Set(handle string, name string, value string)
	Get(handle string, name string) (string, bool)
}

type Configurer

type Configurer interface {
	Apply(log lager.Logger, cfg NetworkConfig, pid int) error
	DestroyBridge(log lager.Logger, cfg NetworkConfig) error
	DestroyIPTablesRules(log lager.Logger, cfg NetworkConfig) error
}

type ContainerConfigurer

type ContainerConfigurer interface {
	Apply(logger lager.Logger, cfg NetworkConfig, pid int) error
}

type Creator

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

func NewConfigCreator

func NewConfigCreator(idGenerator IDGenerator, interfacePrefix, chainPrefix string, externalIP net.IP, operatorNameservers, additionalNameservers []net.IP, additionalHostEntries []string, mtu int) *Creator

func (*Creator) Create

func (c *Creator) Create(log lager.Logger, handle string, subnet *net.IPNet, ip net.IP) (NetworkConfig, error)

type DnsResolvConfigurer

type DnsResolvConfigurer interface {
	Configure(log lager.Logger, cfg NetworkConfig, pid int) error
}

type FirewallOpener

type FirewallOpener interface {
	Open(log lager.Logger, instance, handle string, rule garden.NetOutRule) error
	BulkOpen(log lager.Logger, instance, handle string, rule []garden.NetOutRule) error
}

type HostConfigurer

type HostConfigurer interface {
	Apply(logger lager.Logger, cfg NetworkConfig, pid int) error
	Destroy(cfg NetworkConfig) error
}

type HostFileCompiler

type HostFileCompiler interface {
	Compile(log lager.Logger, ip net.IP, handle string, additionalHostEntries []string) ([]byte, error)
}

type IDGenerator

type IDGenerator interface {
	Generate() string
}

func NewSequentialIDGenerator

func NewSequentialIDGenerator(seed int64) IDGenerator

type InstanceChainCreator

type InstanceChainCreator interface {
	Create(logger lager.Logger, handle, instanceChain, bridgeName string, ip net.IP, network *net.IPNet) error
	Destroy(logger lager.Logger, instanceChain string) error
}

type NetnsExecer

type NetnsExecer interface {
	Exec(netnsFD *os.File, cb func() error) error
}

type NetworkConfig

type NetworkConfig struct {
	ContainerHandle       string
	HostIntf              string
	ContainerIntf         string
	IPTablePrefix         string
	IPTableInstance       string
	BridgeName            string
	BridgeIP              net.IP
	ContainerIP           net.IP
	ExternalIP            net.IP
	Subnet                *net.IPNet
	Mtu                   int
	PluginNameservers     []net.IP
	OperatorNameservers   []net.IP
	AdditionalNameservers []net.IP
	AdditionalHostEntries []string
	PluginSearchDomains   []string
}

type Networker

type Networker interface {
	Capacity() uint64
	Network(log lager.Logger, spec garden.ContainerSpec, pid int) error
	Destroy(log lager.Logger, handle string) error
	NetIn(log lager.Logger, handle string, externalPort, containerPort uint32) (uint32, uint32, error)
	NetOut(log lager.Logger, handle string, rule garden.NetOutRule) error
	BulkNetOut(log lager.Logger, handle string, rules []garden.NetOutRule) error
	Restore(log lager.Logger, handle string) error
}

type PortForwarder

type PortForwarder interface {
	Forward(spec PortForwarderSpec) error
}

type PortForwarderSpec

type PortForwarderSpec struct {
	InstanceID  string
	Handle      string
	FromPort    uint32
	ToPort      uint32
	ContainerIP net.IP
	ExternalIP  net.IP
}

type PortPool

type PortPool interface {
	Acquire() (uint32, error)
	Release(uint32)
	Remove(uint32) error
}

type ResolvCompiler

type ResolvCompiler interface {
	Determine(resolvContents string, hostIP net.IP, pluginNameservers, operatorNameservers, additionalNameservers []net.IP, pluginSearchDomains []string) []string
}

type ResolvConfigurer

type ResolvConfigurer struct {
	HostsFileCompiler HostFileCompiler
	ResolvCompiler    ResolvCompiler
	ResolvFilePath    string
	DepotDir          string
}

func (*ResolvConfigurer) Configure

func (d *ResolvConfigurer) Configure(log lager.Logger, cfg NetworkConfig, pid int) error

type SpecParser

type SpecParser interface {
	Parse(log lager.Logger, spec string) (subnets.SubnetSelector, subnets.IPSelector, error)
}

type SpecParserFunc

type SpecParserFunc func(spec string) (subnets.SubnetSelector, subnets.IPSelector, error)

func (SpecParserFunc) Parse

Directories

Path Synopsis
iptablesfakes
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
Code generated by counterfeiter.
The subnets package provides a subnet pool from which networks may be dynamically acquired or statically reserved.
The subnets package provides a subnet pool from which networks may be dynamically acquired or statically reserved.
fake_subnet_pool
Code generated by counterfeiter.
Code generated by counterfeiter.
subnetsfakes
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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