registry

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProtocolMap = map[string]Protocol{
	"http":  HTTP,
	"https": HTTPS,
	"grpc":  GRPC,
	"http2": HTTP2,
	"mongo": MONGO,
	"tcp":   TCP,
	"tls":   TLS,
}

Functions

func AddRegistryFactory

func AddRegistryFactory(name string, factory RegistryFactory)

AddRegistryFactory will be used by the user to register a new registry

func FakeServiceEntryStore

func FakeServiceEntryStore() *fakeServiceEntryStore

Types

type Protocol

type Protocol string

The protocol defined here should match the protocol field in istio's ServicePort See https://github.com/istio/api/issues/3056

const (
	HTTP        Protocol = "HTTP"
	HTTPS       Protocol = "HTTPS"
	GRPC        Protocol = "GRPC"
	HTTP2       Protocol = "HTTP2"
	MONGO       Protocol = "MONGO"
	TCP         Protocol = "TCP"
	TLS         Protocol = "TLS"
	Unsupported Protocol = "Unsupported"
)

func ParseProtocol

func ParseProtocol(s string) Protocol

type Registry

type Registry interface {
	Start(config RegistryConfig) error
	Stop() error
	// Reload provides an effective way to update the configuration than Start & Stop
	Reload(config RegistryConfig) error
	Config() RegistryConfig
}

Registry is the interface that all registries must implement

func CreateRegistry

func CreateRegistry(name string, store ServiceEntryStore, om metav1.ObjectMeta) (Registry, error)

CreateRegistry is called by HTNN to create a new registry

type RegistryConfig

type RegistryConfig interface {
	// The configuration is defined as a protobuf message
	ProtoReflect() protoreflect.Message
	// This method is generated by protoc-gen-validate. We can override it to provide custom validation
	Validate() error
}

RegistryConfig represents the configuration used by the registry

func ParseConfig

func ParseConfig(reg Registry, data []byte) (RegistryConfig, error)

ParseConfig parses the given data and returns the configuration according to the registry

type RegistryFactory

type RegistryFactory func(store ServiceEntryStore, om metav1.ObjectMeta) (Registry, error)

RegistryFactory provides methods to prepare configuration & create registry

type ServiceEntryStore

type ServiceEntryStore interface {
	Update(service string, se *ServiceEntryWrapper)
	Delete(service string)
}

ServiceEntryStore is the store of ServiceEntryWrapper. The service must be a valid k8s service name. It will be used as both the name of the ServiceEntry used by Istio (the unique key in control plane), and the domain of the cluster used by Envoy (the unique key in data plane).

type ServiceEntryWrapper

type ServiceEntryWrapper struct {
	istioapi.ServiceEntry
	Source string
}

ServiceEntryWrapper is a wrapper around the istio's ServiceEntry

Jump to

Keyboard shortcuts

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