kawasaki

package
v0.0.0-...-d02b2c3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 13 Imported by: 18

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 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 NetworkDepot

type NetworkDepot interface {
	SetupBindMounts(log lager.Logger, handle string, privileged bool, rootfsPath string) ([]garden.BindMount, error)
	Destroy(log lager.Logger, handle string) error
}

type Networker

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

func New

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

func (*Networker) BulkNetOut

func (n *Networker) BulkNetOut(log lager.Logger, handle string, rules []garden.NetOutRule) error

func (*Networker) Capacity

func (n *Networker) Capacity() uint64

Capacity returns the number of subnets this network can host

func (*Networker) Destroy

func (n *Networker) Destroy(log lager.Logger, handle string) error

func (*Networker) NetIn

func (n *Networker) NetIn(log lager.Logger, handle string, externalPort, containerPort uint32) (uint32, uint32, error)

func (*Networker) NetOut

func (n *Networker) NetOut(log lager.Logger, handle string, rule garden.NetOutRule) error

func (*Networker) Network

func (n *Networker) Network(log lager.Logger, containerSpec garden.ContainerSpec, pid int) error

func (*Networker) Restore

func (n *Networker) Restore(log lager.Logger, handle string) error

func (*Networker) SetupBindMounts

func (n *Networker) SetupBindMounts(log lager.Logger, handle string, privileged bool, rootfsPath string) ([]garden.BindMount, 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

func (fn SpecParserFunc) Parse(log lager.Logger, spec string) (subnets.SubnetSelector, subnets.IPSelector, error)

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