Documentation ¶
Index ¶
- Constants
- func AsKeyValue(key string, v interface{}, resourceVersion string) *discovery.KeyValue
- func BuildCacher(t discovery.Type, cfg *discovery.Config, cache discovery.Cache) discovery.Cacher
- func FromK8sService(domainProject string, svc *v1.Service) (ms *pb.MicroService)
- func Queue(t K8sType) *queue.TaskQueue
- func ShouldRegisterService(service *v1.Service) bool
- func UUID(id types.UID) string
- type InstanceCacher
- type K8sAdaptor
- type K8sClient
- func (c *K8sClient) AppendEventFunc(t K8sType, f OnEventFunc)
- func (c *K8sClient) Endpoints() ListWatcher
- func (c *K8sClient) GetDomainProject() string
- func (c *K8sClient) GetEndpoints(namespace, name string) (ep *v1.Endpoints)
- func (c *K8sClient) GetNodeByPod(pod *v1.Pod) (node *v1.Node)
- func (c *K8sClient) GetPodByIP(ip string) (pod *v1.Pod)
- func (c *K8sClient) GetService(namespace, name string) (svc *v1.Service)
- func (c *K8sClient) Nodes() ListWatcher
- func (c *K8sClient) Pods() ListWatcher
- func (c *K8sClient) Ready() <-chan struct{}
- func (c *K8sClient) Run()
- func (c *K8sClient) Services() ListWatcher
- func (c *K8sClient) Stop()
- type K8sEvent
- type K8sType
- type ListWatcher
- type OnEventFunc
- type ServiceCacher
- type ServiceIndexCacher
- type Watcher
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 BuildCacher ¶
func FromK8sService ¶
func FromK8sService(domainProject string, svc *v1.Service) (ms *pb.MicroService)
func ShouldRegisterService ¶
Types ¶
type InstanceCacher ¶
type InstanceCacher struct {
*discovery.CommonCacher
}
func NewInstanceCacher ¶
func NewInstanceCacher(c *discovery.CommonCacher) (i *InstanceCacher)
type K8sAdaptor ¶
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 (*K8sClient) GetEndpoints ¶
func (*K8sClient) GetService ¶
func (*K8sClient) Nodes ¶
func (c *K8sClient) Nodes() ListWatcher
func (*K8sClient) Pods ¶
func (c *K8sClient) Pods() ListWatcher
func (*K8sClient) Services ¶
func (c *K8sClient) Services() ListWatcher
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)
Click to show internal directories.
Click to hide internal directories.