adaptor

package
v1.4.8 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name                 = "Kubernetes"
	TypeService  K8sType = "Service"
	TypeEndpoint K8sType = "Endpoints"
	TypeNode     K8sType = "Node"
	TypePod      K8sType = "Pod"

	SchemaTCP   = "TCP"
	SchemaHTTP  = "HTTP"
	SchemaHTTPS = "HTTPS"

	// k8s labels
	LabelApp         = "app"
	LabelVersion     = "version"
	LabelEnvironment = "environment"
	LabelNodeRegion  = "failure-domain.beta.kubernetes.io/region"
	LabelNodeAZ      = "failure-domain.beta.kubernetes.io/zone"

	// register annotations
	AnnotationRegister = "service-center.servicecomb.io/register"

	// properties
	PropNamespace    = "namespace"
	PropExternalName = "externalName"
	PropServiceType  = "type"
	PropNodeIP       = "nodeIP"
)

Variables

This section is empty.

Functions

func AsKeyValue

func AsKeyValue(key string, v interface{}, resourceVersion string) *discovery.KeyValue

func BuildCacher

func BuildCacher(t discovery.Type, cfg *discovery.Config, cache discovery.Cache) discovery.Cacher

func FromK8sService

func FromK8sService(domainProject string, svc *v1.Service) (ms *pb.MicroService)

func Queue

func Queue(t K8sType) *queue.TaskQueue

func ShouldRegisterService

func ShouldRegisterService(service *v1.Service) bool

func UUID

func UUID(id types.UID) string

Types

type InstanceCacher

type InstanceCacher struct {
	*discovery.CommonCacher
}

func NewInstanceCacher

func NewInstanceCacher(c *discovery.CommonCacher) (i *InstanceCacher)

type K8sAdaptor

type K8sAdaptor struct {
	discovery.Cacher
	discovery.Indexer
}

K8sAdaptor implements discovery.Adaptor. K8sAdaptor does service discovery with kubernetes as it's registry.

func NewK8sAdaptor

func NewK8sAdaptor(t discovery.Type, cfg *discovery.Config) *K8sAdaptor

func (*K8sAdaptor) Ready

func (se *K8sAdaptor) Ready() <-chan struct{}

func (*K8sAdaptor) Run

func (se *K8sAdaptor) Run()

func (*K8sAdaptor) Stop

func (se *K8sAdaptor) Stop()

type K8sClient

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

func Kubernetes

func Kubernetes() *K8sClient

func (*K8sClient) AppendEventFunc

func (c *K8sClient) AppendEventFunc(t K8sType, f OnEventFunc)

unsafe

func (*K8sClient) Endpoints

func (c *K8sClient) Endpoints() ListWatcher

func (*K8sClient) GetDomainProject

func (c *K8sClient) GetDomainProject() string

func (*K8sClient) GetEndpoints

func (c *K8sClient) GetEndpoints(namespace, name string) (ep *v1.Endpoints)

func (*K8sClient) GetNodeByPod

func (c *K8sClient) GetNodeByPod(pod *v1.Pod) (node *v1.Node)

func (*K8sClient) GetPodByIP

func (c *K8sClient) GetPodByIP(ip string) (pod *v1.Pod)

func (*K8sClient) GetService

func (c *K8sClient) GetService(namespace, name string) (svc *v1.Service)

func (*K8sClient) Nodes

func (c *K8sClient) Nodes() ListWatcher

func (*K8sClient) Pods

func (c *K8sClient) Pods() ListWatcher

func (*K8sClient) Ready

func (c *K8sClient) Ready() <-chan struct{}

func (*K8sClient) Run

func (c *K8sClient) Run()

func (*K8sClient) Services

func (c *K8sClient) Services() ListWatcher

func (*K8sClient) Stop

func (c *K8sClient) Stop()

type K8sEvent

type K8sEvent struct {
	EventType  types.EventType
	Object     interface{}
	PrevObject interface{}
}

type K8sType

type K8sType string

type ListWatcher

type ListWatcher interface {
	cache.SharedIndexInformer
	queue.Worker
}

func NewListWatcher

func NewListWatcher(t K8sType, lister cache.SharedIndexInformer, f OnEventFunc) (lw ListWatcher)

type OnEventFunc

type OnEventFunc func(evt K8sEvent)

type ServiceCacher

type ServiceCacher struct {
	*discovery.CommonCacher
}

func NewServiceCacher

func NewServiceCacher(c *discovery.CommonCacher) (s *ServiceCacher)

type ServiceIndexCacher

type ServiceIndexCacher struct {
	*discovery.CommonCacher
}

func NewServiceIndexCacher

func NewServiceIndexCacher(c *discovery.CommonCacher) (si *ServiceIndexCacher)

type Watcher

type Watcher interface {
	queue.Worker
	OnEvent(evt K8sEvent)
}

Jump to

Keyboard shortcuts

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