pilot

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExpireTime      = 0
	DefaultRefreshInterval = time.Second * 30
)

constant values for default expiration time, and refresh interval

View Source
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"
)
View Source
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"
)
View Source
const (
	// PODNAMESPACE means pod's namespace
	PODNAMESPACE = "POD_NAMESPACE"
	// DefaultSuffix means suffix of service key of api v1
	DefaultSuffix = "svc.cluster.local|http"
)
View Source
const PilotPlugin = "pilot"

PilotPlugin is the constant string of the plugin name

Variables

View Source
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

func (c *EnvoyDSClient) GetHostsByKey(serviceKey string, tags map[string]string) (*Hosts, error)

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 Next

type Next func() (string, error)

Next gives the next object in the list

func RoundRobin

func RoundRobin(eps []string) Next

RoundRobin Gives the next object in sequence

type Options

type Options struct {
	Addrs     []string
	TLSConfig *tls.Config
}

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

func (*Registrator) Close

func (r *Registrator) Close() error

Close : Close all connection.

type Service

type Service struct {
	ServiceKey string  `json:"service-key"`
	Hosts      []*Host `json:"hosts"`
}

Service is the envoy service struct

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 : 获取指定微服务的所有实例

type Tags

type Tags struct {
	AZ     string `json:"az,omitempty"`
	Canary bool   `json:"canary,omitempty"`

	// Weight is an integer in the range [1, 100] or empty
	Weight int `json:"load_balancing_weight,omitempty"`
}

Tags contains az, canary and weight

Jump to

Keyboard shortcuts

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