discovery

package
v1.0.0-alpha.test.10b Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2017 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RoutingDiscovery

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

Routing Discovery allows to get fresh director and backendpool configuration filled with autogenerated routings based on service annotations. It watches every services (from whatever namespace) that have label named by 'discovery_label_annotation_prefix'/kedge-exposed. It goes through every service's spec port's and generates routing->backend pair.

For each spec in form like:

  Port: 1234
	 Name: "http-something"
  TargetPort: "pods-port"

It generates:

host_matcher: "<service-name>.<discovery_external_domain_suffix>"
port_matcher: 1234

backend_name:  "<service-name>_<namespace>_pods-port"
domainPort for k8s lookup: "<service-name>.<namespace>:http-port"

Similar for GRPC if name starts is "grpc" or starts from "grpc-"

If you wish to override host_matcher or service_name_matcher use annotations:

`discovery_label_annotation_prefix`host-matcher = <domain>
`discovery_label_annotation_prefix`service-name-matcher = <domain>

NOTE: - backend name is always in form of <service>_<namespace>_<port-name> - if no name is provided or name is not in form of grpc- or http- it is silently ignored (!) - TargetPort can be in both port name or port number form. - no check for duplicated host_matchers in annotations or between autogenerated & base ones (!) - no check if the target port inside service actually exists.

func NewFromFlags

func NewFromFlags(logger logrus.FieldLogger, baseDirector *pb_config.DirectorConfig, baseBackendpool *pb_config.BackendPoolConfig) (*RoutingDiscovery, error)

func NewWithClient

func NewWithClient(logger logrus.FieldLogger, baseDirector *pb_config.DirectorConfig, baseBackendpool *pb_config.BackendPoolConfig, serviceClient ServiceClient) *RoutingDiscovery

NewWithClient returns a new Kubernetes RoutingDiscovery using given k8s.APIClient configured to be used against kube-apiserver.

func (*RoutingDiscovery) DiscoverAndSetFlags

func (d *RoutingDiscovery) DiscoverAndSetFlags(
	ctx context.Context,
	directorFlagz *protoflagz.DynProto3Value,
	backendpoolFlagz *protoflagz.DynProto3Value,
) error

func (*RoutingDiscovery) DiscoverOnce

DiscoverOnce returns director & backendpool configs filled with mix of persistent routes & backends given in base configs and dynamically discovered ones.

type ServiceClient

type ServiceClient interface {
	StartChangeStream(ctx context.Context, labelSelector string) (io.ReadCloser, error)
}

Jump to

Keyboard shortcuts

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