provider

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WildcardNamespace = "*"
	DefaultNamespace  = "default"
)
View Source
const (
	EUREKA_METADATA_GRPC_PORT = "gRPC__port"
	EUREKA_METADATA_MGMT_PORT = "management.port"
)
View Source
const (
	// HealthAny is special, and is used as a wild card,
	// not as a specific state.
	HealthAny      = "any"
	HealthPassing  = "passing"
	HealthWarning  = "warning"
	HealthCritical = "critical"
	HealthMaint    = "maintenance"
)

Variables

This section is empty.

Functions

func CloudNamespace

func CloudNamespace(kubeNS string, enableCloudNamespaces bool, cloudDestNS string, enableMirroring bool, mirroringPrefix string) string

CloudNamespace returns the cloud namespace that a service should be registered in based on the namespace options. It returns an empty string if namespaces aren't enabled.

Types

type AgentCheck

type AgentCheck struct {
	CheckID   string
	ServiceID string
	Name      string
	Namespace string
	Type      string
	Status    string
	Output    string
}

AgentCheck represents a check known to the agent

type AgentService

type AgentService struct {
	ID         string
	Service    string
	InstanceId string
	Namespace  string
	Address    string
	HTTPPort   int
	GRPCPort   int
	Weights    AgentWeights
	Tags       []string
	Meta       map[string]interface{}
}

AgentService represents a service known to the agent

type AgentWeights

type AgentWeights struct {
	Passing int
	Warning int
}

type CatalogDeregistration

type CatalogDeregistration struct {
	Node      string
	ServiceID string
	Service   string
	Namespace string
}

type CatalogNodeServiceList

type CatalogNodeServiceList struct {
	Services []*AgentService
}

type CatalogRegistration

type CatalogRegistration struct {
	Node           string
	Address        string
	NodeMeta       map[string]string
	Service        *AgentService
	Check          *AgentCheck
	SkipNodeUpdate bool
}

type CatalogService

type CatalogService struct {
	Node        string
	ServiceID   string
	ServiceName string
}

type ConsulDiscoveryClient

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

func GetConsulDiscoveryClient

func GetConsulDiscoveryClient(address string, isInternalServices bool) (*ConsulDiscoveryClient, error)

func (*ConsulDiscoveryClient) CatalogService

func (dc *ConsulDiscoveryClient) CatalogService(service, tag string, q *QueryOptions) ([]*CatalogService, error)

CatalogService is used to query catalog entries for a given service

func (*ConsulDiscoveryClient) CatalogServices

func (dc *ConsulDiscoveryClient) CatalogServices(q *QueryOptions) (map[string][]string, error)

func (*ConsulDiscoveryClient) Deregister

func (dc *ConsulDiscoveryClient) Deregister(dereg *CatalogDeregistration) error

func (*ConsulDiscoveryClient) EnsureNamespaceExists

func (dc *ConsulDiscoveryClient) EnsureNamespaceExists(ns string, crossNSAClPolicy string) (bool, error)

EnsureNamespaceExists ensures a Consul namespace with name ns exists. If it doesn't, it will create it and set crossNSACLPolicy as a policy default. Boolean return value indicates if the namespace was created by this call.

func (*ConsulDiscoveryClient) HealthService

func (dc *ConsulDiscoveryClient) HealthService(service, tag string, q *QueryOptions, passingOnly bool) ([]*AgentService, error)

HealthService is used to query catalog entries for a given service

func (*ConsulDiscoveryClient) IsInternalServices

func (dc *ConsulDiscoveryClient) IsInternalServices() bool

func (*ConsulDiscoveryClient) MicroServiceProvider

func (dc *ConsulDiscoveryClient) MicroServiceProvider() string

func (*ConsulDiscoveryClient) NodeServiceList

func (dc *ConsulDiscoveryClient) NodeServiceList(node string, q *QueryOptions) (*CatalogNodeServiceList, error)

func (*ConsulDiscoveryClient) Register

func (dc *ConsulDiscoveryClient) Register(reg *CatalogRegistration) error

type EurekaDiscoveryClient

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

func GetEurekaDiscoveryClient

func GetEurekaDiscoveryClient(address string, isInternalServices bool) (*EurekaDiscoveryClient, error)

func (*EurekaDiscoveryClient) CatalogService

func (dc *EurekaDiscoveryClient) CatalogService(service, tag string, q *QueryOptions) ([]*CatalogService, error)

CatalogService is used to query catalog entries for a given service

func (*EurekaDiscoveryClient) CatalogServices

func (dc *EurekaDiscoveryClient) CatalogServices(q *QueryOptions) (map[string][]string, error)

func (*EurekaDiscoveryClient) Deregister

func (dc *EurekaDiscoveryClient) Deregister(dereg *CatalogDeregistration) error

func (*EurekaDiscoveryClient) EnsureNamespaceExists

func (dc *EurekaDiscoveryClient) EnsureNamespaceExists(ns string, crossNSAClPolicy string) (bool, error)

EnsureNamespaceExists ensures a Consul namespace with name ns exists. If it doesn't, it will create it and set crossNSACLPolicy as a policy default. Boolean return value indicates if the namespace was created by this call.

func (*EurekaDiscoveryClient) HealthService

func (dc *EurekaDiscoveryClient) HealthService(service, tag string, q *QueryOptions, passingOnly bool) ([]*AgentService, error)

HealthService is used to query catalog entries for a given service

func (*EurekaDiscoveryClient) IsInternalServices

func (dc *EurekaDiscoveryClient) IsInternalServices() bool

func (*EurekaDiscoveryClient) MicroServiceProvider

func (dc *EurekaDiscoveryClient) MicroServiceProvider() string

func (*EurekaDiscoveryClient) NodeServiceList

func (dc *EurekaDiscoveryClient) NodeServiceList(node string, q *QueryOptions) (*CatalogNodeServiceList, error)

func (*EurekaDiscoveryClient) Register

func (dc *EurekaDiscoveryClient) Register(reg *CatalogRegistration) error

type MachineDiscoveryClient

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

func GetMachineDiscoveryClient

func GetMachineDiscoveryClient(machineClient machineClientset.Interface, isInternalServices bool) (*MachineDiscoveryClient, error)

func (*MachineDiscoveryClient) CatalogService

func (dc *MachineDiscoveryClient) CatalogService(service, tag string, q *QueryOptions) ([]*CatalogService, error)

CatalogService is used to query catalog entries for a given service

func (*MachineDiscoveryClient) CatalogServices

func (dc *MachineDiscoveryClient) CatalogServices(q *QueryOptions) (map[string][]string, error)

func (*MachineDiscoveryClient) Deregister

func (dc *MachineDiscoveryClient) Deregister(dereg *CatalogDeregistration) error

func (*MachineDiscoveryClient) EnsureNamespaceExists

func (dc *MachineDiscoveryClient) EnsureNamespaceExists(ns string, crossNSAClPolicy string) (bool, error)

EnsureNamespaceExists ensures a Consul namespace with name ns exists. If it doesn't, it will create it and set crossNSACLPolicy as a policy default. Boolean return value indicates if the namespace was created by this call.

func (*MachineDiscoveryClient) HealthService

func (dc *MachineDiscoveryClient) HealthService(service, _ string, _ *QueryOptions, _ bool) ([]*AgentService, error)

HealthService is used to query catalog entries for a given service

func (*MachineDiscoveryClient) IsInternalServices

func (dc *MachineDiscoveryClient) IsInternalServices() bool

func (*MachineDiscoveryClient) MicroServiceProvider

func (dc *MachineDiscoveryClient) MicroServiceProvider() string

func (*MachineDiscoveryClient) NodeServiceList

func (dc *MachineDiscoveryClient) NodeServiceList(node string, q *QueryOptions) (*CatalogNodeServiceList, error)

func (*MachineDiscoveryClient) Register

type QueryOptions

type QueryOptions struct {
	// AllowStale allows any Consul server (non-leader) to service
	// a read. This allows for lower latency and higher throughput
	AllowStale bool

	// Namespace overrides the `default` namespace
	// Note: Namespaces are available only in Consul Enterprise
	Namespace string

	// WaitIndex is used to enable a blocking query. Waits
	// until the timeout or the next index is reached
	WaitIndex uint64

	// WaitTime is used to bound the duration of a wait.
	// Defaults to that of the Config, but can be overridden.
	WaitTime time.Duration

	// Providing a peer name in the query option
	Peer string

	// Filter requests filtering data prior to it being returned. The string
	// is a go-bexpr compatible expression.
	Filter string
	// contains filtered or unexported fields
}

QueryOptions are used to parameterize a query

func (*QueryOptions) Context

func (o *QueryOptions) Context() context.Context

func (*QueryOptions) WithContext

func (o *QueryOptions) WithContext(ctx context.Context) *QueryOptions

type ServiceDiscoveryClient

type ServiceDiscoveryClient interface {
	NodeServiceList(node string, q *QueryOptions) (*CatalogNodeServiceList, error)
	CatalogServices(q *QueryOptions) (map[string][]string, error)
	CatalogService(service, tag string, q *QueryOptions) ([]*CatalogService, error)
	HealthService(service, tag string, q *QueryOptions, passingOnly bool) ([]*AgentService, error)
	Register(reg *CatalogRegistration) error
	Deregister(dereg *CatalogDeregistration) error
	EnsureNamespaceExists(ns string, crossNSAClPolicy string) (bool, error)
	MicroServiceProvider() string
	IsInternalServices() bool
}

Jump to

Keyboard shortcuts

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