consul

package
v1.12.0-beta28 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: Apache-2.0 Imports: 34 Imported by: 3

Documentation

Index

Constants

View Source
const (
	ExtensionName             = "consul"
	DefaultDnsAddress         = "127.0.0.1:8600"
	DefaultDnsPollingInterval = 5 * time.Second
	DefaultTlsTagName         = "glooUseTls"
)

Variables

View Source
var (
	UnformattedErrorMsg = "Consul settings specify automatic detection of TLS services, " +
		"but the rootCA resource's name/namespace are not properly specified: {%s}"
	ConsulTlsInputError = func(nsString string) error {
		return eris.Errorf(UnformattedErrorMsg, nsString)
	}
)
View Source
var (
	InvalidSpecTypeError = func(us *v1.Upstream, name string) error {
		return eris.Errorf("internal error: invalid %s spec, "+
			"expected *v1.Upstream_Consul, got  %T", name, us)
	}
)

Functions

func BuildDataCenterMetadata added in v0.17.4

func BuildDataCenterMetadata(dataCenters []string, upstreams []*v1.Upstream) map[string]string

Similarly to what we do with tags, create a label for each data center and set it to "1" if the service instance is running in that data center.

func BuildTagMetadata added in v0.17.4

func BuildTagMetadata(tags []string, upstreams []*v1.Upstream) map[string]string

The ServiceTags on the Consul Upstream(s) represent all tags for Consul services with the given ServiceName across data centers. We create an endpoint label for each tag from the gloo upstreams, where the label key is the name of the tag and the label value is "1" if the current service contains the same tag, and "0" otherwise.

func NewConsulQueryOptions added in v1.12.0

func NewConsulQueryOptions(dataCenter string, cm glooConsul.UpstreamSpec_ConsulConsistencyModes) *consulapi.QueryOptions

NewConsulQueryOptions returns a QueryOptions configuration that's used for Consul queries.

func NewDnsResolverWithFallback added in v1.9.13

func NewDnsResolverWithFallback(resolver DnsResolver) *dnsResolverWithFallback

func NewPlugin

func NewPlugin(client consul.ConsulWatcher, resolver DnsResolver, dnsPollingInterval *time.Duration) *plugin

Types

type DnsResolver added in v1.3.7

type DnsResolver interface {
	Resolve(ctx context.Context, address string) ([]net.IPAddr, error)
}

func NewConsulDnsResolver added in v1.9.13

func NewConsulDnsResolver(address string) DnsResolver

Directories

Path Synopsis
Package mock_consul is a generated GoMock package.
Package mock_consul is a generated GoMock package.

Jump to

Keyboard shortcuts

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