v1alpha1

package
v0.0.0-...-c7e85b4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Endpoint

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

func ConvertKubeAPIV1EndpointsToEndpoints

func ConvertKubeAPIV1EndpointsToEndpoints(kubeEndpoints *api.Endpoints) (endpoints []*Endpoint, err error)

ConvertKubeAPIV1EndpointsToEndpoints translates kubernetes endpoints objects to balanced endpoints

func NewEndpoint

func NewEndpoint(kubeEndpoints *api.Endpoints, kubeEndpointAddress *api.EndpointAddress, kubeEndpointPort *api.EndpointPort, opts ...EndpointOption) (*Endpoint, error)

func (*Endpoint) Address

func (e *Endpoint) Address() net.IP

func (*Endpoint) Equals

func (e *Endpoint) Equals(endpoint *Endpoint) bool

func (*Endpoint) ID

func (e *Endpoint) ID() string

func (*Endpoint) IsTargetPod

func (e *Endpoint) IsTargetPod() bool

func (*Endpoint) KubeAPIV1Endpoints

func (e *Endpoint) KubeAPIV1Endpoints() *api.Endpoints

func (*Endpoint) KubeAPIV1EndpointsName

func (e *Endpoint) KubeAPIV1EndpointsName() string

func (*Endpoint) NodeName

func (e *Endpoint) NodeName() *string

func (*Endpoint) Port

func (e *Endpoint) Port() uint16

func (*Endpoint) PortName

func (e *Endpoint) PortName() string

func (*Endpoint) Ready

func (e *Endpoint) Ready() bool

func (*Endpoint) Service

func (e *Endpoint) Service() *Service

func (*Endpoint) SetService

func (e *Endpoint) SetService(svc *Service)

func (*Endpoint) TargetRef

func (e *Endpoint) TargetRef() *api.ObjectReference

func (*Endpoint) TargetRefString

func (e *Endpoint) TargetRefString() string

type EndpointOnChangeHandler

type EndpointOnChangeHandler func(prevE *Endpoint, updatedE *Endpoint)

type EndpointOption

type EndpointOption func(*Endpoint) error

func Readiness

func Readiness(ready bool) EndpointOption

type MapServiceManager

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

func NewMapServiceManager

func NewMapServiceManager(logger util.Logger) *MapServiceManager

func (*MapServiceManager) Add

func (sm *MapServiceManager) Add(svc *Service, handlers ...ServiceOnChangeHandler) (err error)

func (*MapServiceManager) Exists

func (sm *MapServiceManager) Exists(svc *Service) bool

func (*MapServiceManager) Get

func (sm *MapServiceManager) Get(svcID string) (svc *Service, err error)

func (*MapServiceManager) List

func (sm *MapServiceManager) List() (list []*Service)

func (*MapServiceManager) ListServicesWithAddress

func (sm *MapServiceManager) ListServicesWithAddress() (list []*Service)

func (*MapServiceManager) Remove

func (sm *MapServiceManager) Remove(svc *Service, handlers ...ServiceOnChangeHandler) (err error)

func (*MapServiceManager) RemoveByID

func (sm *MapServiceManager) RemoveByID(svcID string, handlers ...ServiceOnChangeHandler) (err error)

func (*MapServiceManager) RemoveExistingServicesNoLongerCurrent

func (sm *MapServiceManager) RemoveExistingServicesNoLongerCurrent(currentServices []*Service, existingServices []*Service, handlers ...ServiceOnChangeHandler) (err error)

RemoveExistingServicesNoLongerCurrent removes existing services that are managed by the MapServiceManager that are no longer in existence in the real world

func (*MapServiceManager) RemoveServicesRecursively

func (sm *MapServiceManager) RemoveServicesRecursively(svcs []*Service, svcOnChangeHandler []ServiceOnChangeHandler, eOnChangeHandler []EndpointOnChangeHandler) error

RemoveServicesRecursively remove Endpoints of a Service first before removal

func (*MapServiceManager) ResolveByKubeMetaNamespaceKey

func (sm *MapServiceManager) ResolveByKubeMetaNamespaceKey(key string) (svcs []*Service, err error)

ResolveByKubeMetaNamespaceKey : finds all Services with the same Kubernetes Service Object Key

func (*MapServiceManager) Update

func (sm *MapServiceManager) Update(svc *Service, handlers ...ServiceOnChangeHandler) (updated bool, prevSvc *Service, err error)

func (*MapServiceManager) UpdateServicesRecursively

func (sm *MapServiceManager) UpdateServicesRecursively(svcs []*Service, endpoints []*Endpoint, svcOnChangeHandler []ServiceOnChangeHandler, eOnChangeHandler []EndpointOnChangeHandler) error

UpdateServicesRecursively will add Service to SM if not already exist and its Endpoints, otherwise, it will update the existing Service in the SM along with its Endpoints

type Service

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

func ConvertKubeAPIV1ServiceToServices

func ConvertKubeAPIV1ServiceToServices(kubeService *api.Service, opts ...ServiceOption) ([]*Service, error)

ConvertKubeAPIV1ServiceToServices assumes a kubeService with Service Type: LoadBalancer

func NewService

func NewService(kubeService *api.Service, portSpec api.ServicePort, opts ...ServiceOption) (*Service, error)

func (*Service) Add

func (s *Service) Add(e *Endpoint, handlers ...EndpointOnChangeHandler) (err error)

func (*Service) Address

func (s *Service) Address() *net.IP

func (*Service) Annotations

func (s *Service) Annotations() map[string]string

func (*Service) Equals

func (s *Service) Equals(svc *Service) bool

func (*Service) Exists

func (s *Service) Exists(e *Endpoint) (exists bool)

func (*Service) Get

func (s *Service) Get(endpointID string) (e *Endpoint, err error)

func (*Service) ID

func (s *Service) ID() string

func (*Service) IsChildEndpoint

func (s *Service) IsChildEndpoint(e *Endpoint) bool

func (*Service) KubeAPIV1Service

func (s *Service) KubeAPIV1Service() *api.Service

func (*Service) KubeAPIV1ServiceName

func (s *Service) KubeAPIV1ServiceName() string

func (*Service) List

func (s *Service) List() (endpoints []*Endpoint)

func (*Service) Port

func (s *Service) Port() uint16

func (*Service) PortName

func (s *Service) PortName() string

func (*Service) ProtoNumber

func (s *Service) ProtoNumber() uint16

func (*Service) Protocol

func (s *Service) Protocol() api.Protocol

func (*Service) Remove

func (s *Service) Remove(e *Endpoint, handlers ...EndpointOnChangeHandler) (err error)

func (*Service) TargetPort

func (s *Service) TargetPort() *uint16

TargetPort resolves target port using endpoint information

func (*Service) Update

func (s *Service) Update(e *Endpoint, handlers ...EndpointOnChangeHandler) (err error)

func (*Service) UpdateEndpoints

func (s *Service) UpdateEndpoints(endpoints []*Endpoint, handlers ...EndpointOnChangeHandler) (result *ServiceUpdateRecord, err error)

UpdateEndpoints : will insert or update endpoints similarly to UpsertEndpoints, but will remove children that do not exist in endpoints slice

func (*Service) UpsertEndpoints

func (s *Service) UpsertEndpoints(endpoints []*Endpoint, handlers ...EndpointOnChangeHandler) (result *ServiceUpdateRecord, err error)

UpsertEndpoints : will only insert or update endpoints that are a child of this Service, ignore the rest

type ServiceManager

type ServiceManager interface {
	Exists(svc *Service) bool
	// ResolveByKubeMetaNamespaceKey : finds all Services with the same Kubernetes Service Object Key
	ResolveByKubeMetaNamespaceKey(key string) (svcs []*Service, err error)
	// RemoveExistingServicesNoLongerCurrent removes existing services that are managed by the MapServiceManager that are no longer in existence in the real world
	RemoveExistingServicesNoLongerCurrent(currentServices []*Service, existingServices []*Service, handlers ...ServiceOnChangeHandler) (err error)
	Get(svcID string) (svc *Service, err error)
	List() (list []*Service)
	ListServicesWithAddress() (list []*Service)
	Add(svc *Service, handlers ...ServiceOnChangeHandler) (err error)
	Update(svc *Service, handlers ...ServiceOnChangeHandler) (updated bool, prevSvc *Service, err error)
	Remove(svc *Service, handlers ...ServiceOnChangeHandler) (err error)
	RemoveByID(svcID string, handlers ...ServiceOnChangeHandler) (err error)
	// RemoveServicesRecursively remove Endpoints of a Service first before removal
	RemoveServicesRecursively(svcs []*Service, svcOnChangeHandler []ServiceOnChangeHandler, eOnChangeHandler []EndpointOnChangeHandler) error
	// UpdateServicesRecursively will add Service to SM if not already exist and its Endpoints,
	// otherwise, it will update the existing Service in the SM along with its Endpoints
	UpdateServicesRecursively(svcs []*Service, endpoints []*Endpoint, svcOnChangeHandler []ServiceOnChangeHandler, eOnChangeHandler []EndpointOnChangeHandler) error
}

ServiceManager manages balanced Service objects

type ServiceOnChangeHandler

type ServiceOnChangeHandler func(prevSvc *Service, updatedSvc *Service)

type ServiceOption

type ServiceOption func(*Service) error

type ServiceUpdateRecord

type ServiceUpdateRecord struct {
	Added   []*Endpoint
	Updated []*Endpoint
	Removed []*Endpoint
	Ignored []*Endpoint
}

Jump to

Keyboard shortcuts

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