hostport

package
v1.3.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// maps a Container.HostPort to the same exact offered host port, ignores .HostPort = 0
	StrategyFixed = Strategy("fixed")
	// same as MappingFixed, except that .HostPort of 0 are mapped to any port offered
	StrategyWildcard = Strategy("wildcard")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DuplicateError

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

func (*DuplicateError) Error

func (err *DuplicateError) Error() string

type Mapper

type Mapper interface {
	// Map maps the given pod and the given mesos offer and returns a
	// slice of port mappings or an error if the mapping failed
	Map(pod *api.Pod, roles []string, offer *mesos.Offer) ([]Mapping, error)
}

Objects implementing the Mapper interface generate port mappings from k8s container ports to ports offered by mesos

type MapperFunc

type MapperFunc func(*api.Pod, []string, *mesos.Offer) ([]Mapping, error)

MapperFunc is a function adapter to the Mapper interface

func (MapperFunc) Map

func (f MapperFunc) Map(pod *api.Pod, roles []string, offer *mesos.Offer) ([]Mapping, error)

Map calls f(t, offer)

type Mapping

type Mapping struct {
	ContainerIdx int    // index of the container in the pod spec
	PortIdx      int    // index of the port in a container's port spec
	OfferPort    uint64 // the port offered by mesos
	Role         string // the role asssociated with the offered port
}

A Mapping represents the mapping between k8s container ports ports offered by mesos. It references the k8s' container and port and specifies the offered mesos port and the offered port's role

func FixedMapper

func FixedMapper(pod *api.Pod, roles []string, offer *mesos.Offer) ([]Mapping, error)

FixedMapper maps k8s host ports to offered ports ignoring hostPorts == 0 (remaining pod-private)

func WildcardMapper

func WildcardMapper(pod *api.Pod, roles []string, offer *mesos.Offer) ([]Mapping, error)

WildcardMapper maps k8s wildcard ports (hostPort == 0) to any available offer port

type PortAllocationError

type PortAllocationError struct {
	PodID string
	Ports []uint64
}

func (*PortAllocationError) Error

func (err *PortAllocationError) Error() string

type Strategy

type Strategy string

func (Strategy) NewMapper

func (defaultStrategy Strategy) NewMapper(pod *api.Pod) Mapper

NewMapper returns a new mapper based on the port mapping key value

Jump to

Keyboard shortcuts

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