Documentation ¶
Index ¶
- type Controller
- func (c *Controller) AppendInstanceHandler(f func(*model.ServiceInstance, model.Event)) error
- func (c *Controller) AppendServiceHandler(f func(*model.Service, model.Event)) error
- func (c *Controller) GetIstioServiceAccounts(hostname string, ports []string) []string
- func (c *Controller) GetService(hostname string) (*model.Service, bool)
- func (c *Controller) HostInstances(addrs map[string]bool) []*model.ServiceInstance
- func (c *Controller) Instances(hostname string, ports []string, labels model.LabelsCollection) []*model.ServiceInstance
- func (c *Controller) ManagementPorts(addr string) model.PortList
- func (c *Controller) Run(stop <-chan struct{})
- func (c *Controller) Services() []*model.Service
- type InstanceHandler
- type Monitor
- type ServiceHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller communicates with Consul and monitors for changes
func NewController ¶
func NewController(addr, datacenter string, interval time.Duration) (*Controller, error)
NewController creates a new Consul controller
func (*Controller) AppendInstanceHandler ¶
func (c *Controller) AppendInstanceHandler(f func(*model.ServiceInstance, model.Event)) error
AppendInstanceHandler implements a service catalog operation
func (*Controller) AppendServiceHandler ¶
AppendServiceHandler implements a service catalog operation
func (*Controller) GetIstioServiceAccounts ¶
func (c *Controller) GetIstioServiceAccounts(hostname string, ports []string) []string
GetIstioServiceAccounts implements model.ServiceAccounts operation TODO
func (*Controller) GetService ¶
func (c *Controller) GetService(hostname string) (*model.Service, bool)
GetService retrieves a service by host name if it exists
func (*Controller) HostInstances ¶
func (c *Controller) HostInstances(addrs map[string]bool) []*model.ServiceInstance
HostInstances lists service instances for a given set of IPv4 addresses.
func (*Controller) Instances ¶
func (c *Controller) Instances(hostname string, ports []string, labels model.LabelsCollection) []*model.ServiceInstance
Instances retrieves instances for a service and its ports that match any of the supplied labels. All instances match an empty tag list.
func (*Controller) ManagementPorts ¶
func (c *Controller) ManagementPorts(addr string) model.PortList
ManagementPorts retries set of health check ports by instance IP. This does not apply to Consul service registry, as Consul does not manage the service instances. In future, when we integrate Nomad, we might revisit this function.
func (*Controller) Run ¶
func (c *Controller) Run(stop <-chan struct{})
Run all controllers until a signal is received
func (*Controller) Services ¶
func (c *Controller) Services() []*model.Service
Services list declarations of all services in the system
type InstanceHandler ¶
type InstanceHandler func(instance *api.CatalogService, event model.Event) error
InstanceHandler processes service instance change events
type Monitor ¶
type Monitor interface { Start(<-chan struct{}) AppendServiceHandler(ServiceHandler) AppendInstanceHandler(InstanceHandler) }
Monitor handles service and instance changes
type ServiceHandler ¶
type ServiceHandler func(instances []*api.CatalogService, event model.Event) error
ServiceHandler processes service change events