Documentation ¶
Index ¶
- Constants
- Variables
- func DestinationToUpstreamRef(consulDest *v1.ConsulServiceDestination) *core.ResourceRef
- func IsConsulUpstream(upstreamName string) bool
- func NewConsulUpstreamClient(consul ConsulWatcher) v1.UpstreamClient
- func ToUpstream(service *ServiceMeta) *v1.Upstream
- type ConsulClient
- type ConsulWatcher
- type ServiceMeta
Constants ¶
View Source
const UpstreamNamePrefix = "consul-svc:"
Variables ¶
View Source
var ForbiddenDataCenterErr = func(dataCenter string) error { return eris.Errorf("not allowed to query data center [%s]. "+ "Use the settings to configure the data centers Gloo is allowed to query", dataCenter) }
Functions ¶
func DestinationToUpstreamRef ¶
func DestinationToUpstreamRef(consulDest *v1.ConsulServiceDestination) *core.ResourceRef
func IsConsulUpstream ¶
func NewConsulUpstreamClient ¶
func NewConsulUpstreamClient(consul ConsulWatcher) v1.UpstreamClient
This client can list and watch Consul services. A Gloo upstream will be generated for each unique Consul service name. The Consul EDS will discover and characterize all endpoints for each one of these upstreams across the available data centers.
NOTE: any method except List and Watch will panic!
func ToUpstream ¶ added in v0.17.4
func ToUpstream(service *ServiceMeta) *v1.Upstream
Types ¶
type ConsulClient ¶
type ConsulClient interface { // DataCenters is used to query for all the known data centers. // Results will be filtered based on the data center whitelist provided in the Gloo settings. DataCenters() ([]string, error) // Services is used to query for all known services Services(q *consulapi.QueryOptions) (map[string][]string, *consulapi.QueryMeta, error) // Service is used to query catalog entries for a given service Service(service, tag string, q *consulapi.QueryOptions) ([]*consulapi.CatalogService, *consulapi.QueryMeta, error) // Connect is used to query catalog entries for a given Connect-enabled service Connect(service, tag string, q *consulapi.QueryOptions) ([]*consulapi.CatalogService, *consulapi.QueryMeta, error) }
TODO(marco): consider adding ctx to signatures instead on relying on caller to set it Wrap the Consul API in an interface to allow mocking
func NewConsulClient ¶
func NewConsulClient(client *consulapi.Client, dataCenters []string) (ConsulClient, error)
type ConsulWatcher ¶
type ConsulWatcher interface { ConsulClient WatchServices(ctx context.Context, dataCenters []string) (<-chan []*ServiceMeta, <-chan error) }
func NewConsulWatcher ¶
func NewConsulWatcher(client *consulapi.Client, dataCenters []string) (ConsulWatcher, error)
func NewConsulWatcherFromClient ¶
func NewConsulWatcherFromClient(client ConsulClient) ConsulWatcher
type ServiceMeta ¶
Click to show internal directories.
Click to hide internal directories.