routingtable

package
v0.0.0-...-7ae5cf4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActualLRPData

func ActualLRPData(actualLRP *models.ActualLRP) lager.Data

func DesiredLRPData

func DesiredLRPData(lrp *models.DesiredLRP) lager.Data

Types

type Address

type Address struct {
	Host string
	Port uint32
}

type Endpoint

type Endpoint struct {
	InstanceGUID          string
	Index                 int32
	Host                  string
	ContainerIP           string
	Port                  uint32
	ContainerPort         uint32
	TlsProxyPort          uint32
	ContainerTlsProxyPort uint32
	Presence              models.ActualLRP_Presence
	IsolationSegment      string
	Since                 int64
	ModificationTag       *models.ModificationTag
	PreferredAddress      models.ActualLRPNetInfo_PreferredAddress
	AvailabilityZone      string
}

func NewEndpoint

func NewEndpoint(
	instanceGUID string, presence models.ActualLRP_Presence,
	host, containerIP string,
	port, containerPort uint32,
	preferredAddress models.ActualLRPNetInfo_PreferredAddress,
	modificationTag *models.ModificationTag,
	availabiltiyZone string,
) Endpoint

func NewEndpointsFromActual

func NewEndpointsFromActual(actualLRP *models.ActualLRP) []Endpoint

func (Endpoint) IsDirectInstanceRoute

func (e Endpoint) IsDirectInstanceRoute(defaultIsDirectInstanceRoute bool) bool

type EndpointKey

type EndpointKey struct {
	InstanceGUID string
	Evacuating   bool
}

func NewEndpointKey

func NewEndpointKey(instanceGUID string, evacuating bool) EndpointKey

func (*EndpointKey) String

func (key *EndpointKey) String() string

type ExternalEndpointInfo

type ExternalEndpointInfo struct {
	RouterGroupGUID string
	Port            uint32
}

func NewExternalEndpointInfo

func NewExternalEndpointInfo(routerGroupGUID string, port uint32) ExternalEndpointInfo

func (ExternalEndpointInfo) Hash

func (info ExternalEndpointInfo) Hash() interface{}

func (ExternalEndpointInfo) MessageFor

func (info ExternalEndpointInfo) MessageFor(e Endpoint, directInstanceRoute, _ bool) (*RegistryMessage, *tcpmodels.TcpRouteMapping, *RegistryMessage)

type ExternalEndpointInfos

type ExternalEndpointInfos []ExternalEndpointInfo

func (ExternalEndpointInfos) ContainsExternalPort

func (e ExternalEndpointInfos) ContainsExternalPort(port uint32) bool

func (ExternalEndpointInfos) HasNoExternalPorts

func (e ExternalEndpointInfos) HasNoExternalPorts(logger lager.Logger) bool

type ExternalServiceGreetingMessage

type ExternalServiceGreetingMessage struct {
	MinimumRegisterInterval int `json:"minimumRegisterIntervalInSeconds"`
	PruneThresholdInSeconds int `json:"pruneThresholdInSeconds"`
}

type InternalRoutableEndpoints

type InternalRoutableEndpoints struct {
	Routes           []InternalRoute
	Endpoints        map[EndpointKey]Endpoint
	DesiredInstances int32
	ModificationTag  *models.ModificationTag
}

type InternalRoute

type InternalRoute struct {
	Hostname    string
	ContainerIP string
	LogGUID     string
}

func (InternalRoute) Hash

func (r InternalRoute) Hash() interface{}

func (InternalRoute) MessageFor

func (r InternalRoute) MessageFor(endpoint Endpoint, _, emitEndpointUpdatedAt bool) (*RegistryMessage, *tcpmodels.TcpRouteMapping, *RegistryMessage)

type MessagesToEmit

type MessagesToEmit struct {
	RegistrationMessages           []RegistryMessage
	UnregistrationMessages         []RegistryMessage
	InternalRegistrationMessages   []RegistryMessage
	InternalUnregistrationMessages []RegistryMessage
}

func (MessagesToEmit) InternalRouteRegistrationCount

func (m MessagesToEmit) InternalRouteRegistrationCount() uint64

func (MessagesToEmit) InternalRouteUnregistrationCount

func (m MessagesToEmit) InternalRouteUnregistrationCount() uint64

func (MessagesToEmit) Merge

func (MessagesToEmit) RouteRegistrationCount

func (m MessagesToEmit) RouteRegistrationCount() uint64

func (MessagesToEmit) RouteUnregistrationCount

func (m MessagesToEmit) RouteUnregistrationCount() uint64

type RegistryMessage

type RegistryMessage struct {
	Host                 string            `json:"host"`
	Port                 uint32            `json:"port"`
	TlsPort              uint32            `json:"tls_port,omitempty"`
	URIs                 []string          `json:"uris"`
	Protocol             string            `json:"protocol,omitempty"`
	App                  string            `json:"app,omitempty" hash:"ignore"`
	RouteServiceUrl      string            `json:"route_service_url,omitempty" hash:"ignore"`
	PrivateInstanceId    string            `json:"private_instance_id,omitempty" hash:"ignore"`
	PrivateInstanceIndex string            `json:"private_instance_index,omitempty" hash:"ignore"`
	ServerCertDomainSAN  string            `json:"server_cert_domain_san,omitempty" hash:"ignore"`
	IsolationSegment     string            `json:"isolation_segment,omitempty" hash:"ignore"`
	EndpointUpdatedAtNs  int64             `json:"endpoint_updated_at_ns,omitempty" hash:"ignore"`
	Tags                 map[string]string `json:"tags,omitempty" hash:"ignore"`
	AvailabilityZone     string            `json:"availability_zone,omitempty" hash:"ignore"`
}

func InternalAddressRegistryMessageFor

func InternalAddressRegistryMessageFor(endpoint Endpoint, route Route, emitEndpointUpdatedAt bool) RegistryMessage

This is used when RE is emitting container ip addr/port as opposed to host ip add/port

func InternalEndpointRegistryMessageFor

func InternalEndpointRegistryMessageFor(endpoint Endpoint, route InternalRoute, emitEndpointUpdatedAt bool) RegistryMessage

This is used to generate registry messages for Internal routes

func RegistryMessageFor

func RegistryMessageFor(endpoint Endpoint, route Route, emitEndpointUpdatedAt bool) RegistryMessage

type RoutableEndpoints

type RoutableEndpoints struct {
	Domain           string
	Routes           []routeMapping
	Endpoints        map[EndpointKey]Endpoint
	DesiredInstances int32
	ModificationTag  *models.ModificationTag
}

type Route

type Route struct {
	Hostname         string
	RouteServiceUrl  string
	IsolationSegment string
	LogGUID          string
	Protocol         string
	MetricTags       map[string]*models.MetricTagValue
}

func (Route) Hash

func (r Route) Hash() interface{}

route hash is used to find route differences it needs to be dereferenced so that it can be used as a key in a hash map

func (Route) MessageFor

func (r Route) MessageFor(endpoint Endpoint, directInstanceAddress, emitEndpointUpdatedAt bool) (*RegistryMessage, *tcpmodels.TcpRouteMapping, *RegistryMessage)

type RoutingKey

type RoutingKey struct {
	ProcessGUID   string
	ContainerPort uint32
}

func NewRoutingKey

func NewRoutingKey(processGUID string, containerPort uint32) RoutingKey

type RoutingKeys

type RoutingKeys []RoutingKey

func NewRoutingKeysFromActual

func NewRoutingKeysFromActual(actualLRP *models.ActualLRP) RoutingKeys

func NewRoutingKeysFromDesired

func NewRoutingKeysFromDesired(desired *models.DesiredLRP) RoutingKeys

func (RoutingKeys) Remove

func (lhs RoutingKeys) Remove(rhs RoutingKeys) RoutingKeys

type RoutingTable

type RoutingTable interface {
	// table modification
	SetRoutes(logger lager.Logger, beforeLRP, afterLRP *models.DesiredLRP) (TCPRouteMappings, MessagesToEmit)
	RemoveRoutes(logger lager.Logger, desiredLRP *models.DesiredLRP) (TCPRouteMappings, MessagesToEmit)
	AddEndpoint(logger lager.Logger, actualLRP *models.ActualLRP) (TCPRouteMappings, MessagesToEmit)
	RemoveEndpoint(logger lager.Logger, actualLRP *models.ActualLRP) (TCPRouteMappings, MessagesToEmit)
	Swap(logger lager.Logger, t RoutingTable, domains models.DomainSet) (TCPRouteMappings, MessagesToEmit)
	GetInternalRoutingEvents() (TCPRouteMappings, MessagesToEmit)
	GetExternalRoutingEvents() (TCPRouteMappings, MessagesToEmit)

	HasExternalRoutes(actualLRP *models.ActualLRP) bool
	HTTPAssociationsCount() int     // return number of associations desired-lrp-http-routes * actual-lrps
	InternalAssociationsCount() int // return number of associations desired-lrp-internal-routes * 2 * actual-lrps
	TCPAssociationsCount() int      // return number of associations desired-lrp-tcp-routes * actual-lrps
	TableSize() int
}

func NewRoutingTable

func NewRoutingTable(directInstanceRoute bool, metronClient loggingclient.IngressClient) RoutingTable

type TCPRouteMappings

type TCPRouteMappings struct {
	Registrations   []tcpmodels.TcpRouteMapping
	Unregistrations []tcpmodels.TcpRouteMapping
}

func (TCPRouteMappings) Merge

func (mappings TCPRouteMappings) Merge(other TCPRouteMappings) TCPRouteMappings

Directories

Path Synopsis
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