Documentation ¶
Index ¶
- Constants
- Variables
- func ToMicroService(scs *Service) *registry.MicroService
- func ToMicroServiceInstance(ins *Host, tags map[string]string) *registry.MicroServiceInstance
- type CacheManager
- type EnvoyDSClient
- func (c *EnvoyDSClient) Close() error
- func (c *EnvoyDSClient) GetAllServices() ([]*Service, error)
- func (c *EnvoyDSClient) GetHostsByKey(serviceKey string, tags map[string]string) (*Hosts, error)
- func (c *EnvoyDSClient) GetServiceHosts(serviceName string) (*Hosts, error)
- func (c *EnvoyDSClient) Initialize(options Options) (err error)
- type Host
- type Hosts
- type Next
- type Options
- type Registrator
- type Service
- type ServiceDiscovery
- func (r *ServiceDiscovery) AutoSync()
- func (r *ServiceDiscovery) Close() error
- func (r *ServiceDiscovery) FindMicroServiceInstances(consumerID, microServiceName string, tags utiltags.Tags) ([]*registry.MicroServiceInstance, error)
- func (r *ServiceDiscovery) GetAllMicroServices() ([]*registry.MicroService, error)
- func (r *ServiceDiscovery) GetMicroService(microServiceID string) (*registry.MicroService, error)
- func (r *ServiceDiscovery) GetMicroServiceID(appID, microServiceName, version, env string) (string, error)
- func (r *ServiceDiscovery) GetMicroServiceInstances(consumerID, providerID string) ([]*registry.MicroServiceInstance, error)
- type Tags
Constants ¶
const ( DefaultExpireTime = 0 DefaultRefreshInterval = time.Second * 30 )
constant values for default expiration time, and refresh interval
const ( // Istio is the constant string of framework name Istio = "Istio" // DefaultLevel is the constant string of default microservice level DefaultLevel = "BACK" // DefaultStatus is the constant string of default microservice status DefaultStatus = "UP" )
const ( // BaseRoot is the root path of pilot API BaseRoot = "/v1/registration" // DefaultAddr is the default endpoint of pilot-discovery DefaultAddr = "istio-pilot.istio-system:8080" )
const ( // PODNAMESPACE means pod's namespace PODNAMESPACE = "POD_NAMESPACE" // DefaultSuffix means suffix of service key of api v1 DefaultSuffix = "svc.cluster.local|http" )
const PilotPlugin = "pilot"
PilotPlugin is the constant string of the plugin name
Variables ¶
var ErrNoneAvailable = errors.New("No available")
ErrNoneAvailable create a new error with Message No available
Functions ¶
func ToMicroService ¶
func ToMicroService(scs *Service) *registry.MicroService
ToMicroService assign pilot micro-service to go chassis micro-service
func ToMicroServiceInstance ¶
func ToMicroServiceInstance(ins *Host, tags map[string]string) *registry.MicroServiceInstance
ToMicroServiceInstance assign pilot host parameters to registry micro-service instance parameters
Types ¶
type CacheManager ¶
type CacheManager struct {
// contains filtered or unexported fields
}
CacheManager cache manager
func (*CacheManager) AutoSync ¶
func (c *CacheManager) AutoSync()
AutoSync automatically syncing with the running instances
func (*CacheManager) MakeIPIndex ¶
func (c *CacheManager) MakeIPIndex() error
MakeIPIndex make ip index
type EnvoyDSClient ¶
type EnvoyDSClient struct { Options Options // contains filtered or unexported fields }
EnvoyDSClient is the client implements istio/pilot v1 API See https://www.envoyproxy.io/docs/envoy/v1.6.0/api-v1/cluster_manager/sds#rest-api
func (*EnvoyDSClient) Close ¶
func (c *EnvoyDSClient) Close() error
Close is the function clean up client resources
func (*EnvoyDSClient) GetAllServices ¶
func (c *EnvoyDSClient) GetAllServices() ([]*Service, error)
GetAllServices returns a list of Service registered by istio
func (*EnvoyDSClient) GetHostsByKey ¶ added in v0.7.1
GetHostsByKey returns Hosts using servicekey and tags
func (*EnvoyDSClient) GetServiceHosts ¶
func (c *EnvoyDSClient) GetServiceHosts(serviceName string) (*Hosts, error)
GetServiceHosts returns Hosts using serviceName
func (*EnvoyDSClient) Initialize ¶
func (c *EnvoyDSClient) Initialize(options Options) (err error)
Initialize is the func initialize the EnvoyDSClient
type Host ¶
type Host struct { Address string `json:"ip_address"` Port int `json:"port"` Tags *Tags `json:"tags,omitempty"` }
Host contains upstream ip address, port and tags
type Hosts ¶
type Hosts struct {
Hosts []*Host `json:"hosts"`
}
Hosts is the struct which contains a list of Host
type Options ¶
Options is the list of parameters which passed to the EnvoyDSClient while creating a new client
type Registrator ¶
type Registrator struct { Name string // contains filtered or unexported fields }
Registrator is the struct to do service discovery from istio pilot server
type ServiceDiscovery ¶
type ServiceDiscovery struct { Name string // contains filtered or unexported fields }
ServiceDiscovery is the struct to do service discovery from istio pilot server
func (*ServiceDiscovery) AutoSync ¶
func (r *ServiceDiscovery) AutoSync()
AutoSync updating the cache manager
func (*ServiceDiscovery) Close ¶
func (r *ServiceDiscovery) Close() error
Close : Close all connection.
func (*ServiceDiscovery) FindMicroServiceInstances ¶
func (r *ServiceDiscovery) FindMicroServiceInstances(consumerID, microServiceName string, tags utiltags.Tags) ([]*registry.MicroServiceInstance, error)
FindMicroServiceInstances find micro-service instances
func (*ServiceDiscovery) GetAllMicroServices ¶
func (r *ServiceDiscovery) GetAllMicroServices() ([]*registry.MicroService, error)
GetAllMicroServices : Get all MicroService information.
func (*ServiceDiscovery) GetMicroService ¶
func (r *ServiceDiscovery) GetMicroService(microServiceID string) (*registry.MicroService, error)
GetMicroService : 根据microServiceID获取对应的微服务信息
func (*ServiceDiscovery) GetMicroServiceID ¶
func (r *ServiceDiscovery) GetMicroServiceID(appID, microServiceName, version, env string) (string, error)
GetMicroServiceID : 获取指定微服务的MicroServiceID
func (*ServiceDiscovery) GetMicroServiceInstances ¶
func (r *ServiceDiscovery) GetMicroServiceInstances(consumerID, providerID string) ([]*registry.MicroServiceInstance, error)
GetMicroServiceInstances : 获取指定微服务的所有实例