model

package
v0.0.0-...-0296ce8 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventAdd is sent when an object is added
	EventAdd Event = iota

	// EventUpdate is sent when an object is modified
	// Captures the modified object
	EventUpdate

	// EventDelete is sent when an object is deleted
	// Captures the object at the last known state
	EventDelete

	DefaultTaskDelay = 1 * time.Second

	DefaultResyncInterval = 0

	DefaultNacosEndpointWeight = 100

	MaxRetry = 3

	ToNacos Direction = "to-nacos"

	ToK8s Direction = "to-k8s"

	Both Direction = "both"
)

Variables

This section is empty.

Functions

func ConvertToNacosClientParam

func ConvertToNacosClientParam(options NacosOptions) vo.NacosClientParam

func ShouldServiceSync

func ShouldServiceSync(svc *v1.Service) bool

Types

type Address

type Address struct {
	IP   string `json:"ip"`
	Port uint64 `json:"port"`
}

func ConvertToAddresses

func ConvertToAddresses(realPort uint64, endpoints *v1.Endpoints) []Address

type Controller

type Controller interface {
	Run(<-chan struct{})
	HasSynced() bool
}

type Direction

type Direction string

type Event

type Event int

Event represents a registry update event

type KubeClient

type KubeClient interface {
	// KubeInformer returns an informer factory for kube client
	InformerFactory() informers.SharedInformerFactory

	Run(<-chan struct{})
}

func NewKubeClient

func NewKubeClient(option KubeOptions) (KubeClient, error)

type KubeOptions

type KubeOptions struct {
	KubeConfig string

	WatchedNamespace string
}

type NacosClient

type NacosClient interface {
	RegisterService(ServiceInfo, []Address)

	UnregisterService(ServiceInfo)

	RegisterServiceInstances(serviceInfo ServiceInfo, addresses []Address)

	UnregisterServiceInstances(serviceInfo ServiceInfo, addresses []Address)
}

func NewNacosClient

func NewNacosClient(options NacosOptions) (NacosClient, error)

type NacosOptions

type NacosOptions struct {
	Namespace string

	// ServersIP are explicitly specified to be connected to nacos by client.
	ServersIP []string

	// ServerPort are explicitly specified to be used when the client connects to nacos.
	ServerPort uint64
}

type ServiceInfo

type ServiceInfo struct {
	ServiceKey

	Port uint64

	Metadata map[string]string
}

func GenerateServiceInfo

func GenerateServiceInfo(svc *v1.Service) (ServiceInfo, error)

type ServiceKey

type ServiceKey struct {
	ServiceName string

	Group string
}

type Task

type Task struct {
	Handler func() error
}

Jump to

Keyboard shortcuts

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