switchboard

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HostCollection

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

HostCollection allows to aggregate the hosts from ingress resources.

func NewHostCollection

func NewHostCollection() *HostCollection

NewHostCollection returns a new "empty" host collection.

func (*HostCollection) Hosts

func (a *HostCollection) Hosts() []string

Hosts returns all hosts managed by this aggregator.

func (*HostCollection) Len

func (a *HostCollection) Len() int

Len returns the number of hosts that the aggregator currently manages.

func (*HostCollection) WithRouteHostsIfRequired

func (a *HostCollection) WithRouteHostsIfRequired(routes []traefik.Route) *HostCollection

WithRouteHostsIfRequired aggregates all (unique) hosts found in the provided routes. If the aggregator already manages at least one host, this method is a noop, regardless of the routes passed as parameters.

func (*HostCollection) WithTLSHostsIfAvailable

func (a *HostCollection) WithTLSHostsIfAvailable(config *traefik.TLS) *HostCollection

WithTLSHostsIfAvailable aggregates all hosts found in the provided TLS configuration. If the TLS configuration is empty (i.e. `nil`), no hosts are extracted. This method should only be called on a freshly initialized aggregator.

type Selector

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

Selector allows to easily determine if a resource with a set of annotations should be processed.

func NewSelector

func NewSelector(ingressClass *string) Selector

NewSelector creates a new selector which selects resources with the `kubernetes.io/ingress.class` set to the specified value if it is not `nil`.

func (Selector) Matches

func (s Selector) Matches(annotations map[string]string) bool

Matches determines whether the provided set of annotation match the selector. If the method returns `true`, the resource from which the annotations were obtained should be processed.

type Target

type Target interface {
	// Targets returns the IPv4/IPv6 addresses or hostnames that should be used as targets or an
	// error if the addresses/hostnames cannot be retrieved.
	Targets(ctx context.Context, client client.Client) ([]string, error)
	// NamespacedName returns the namespaced name of the dynamic target service or none if the IP
	// is not retrieved dynamically.
	NamespacedName() *types.NamespacedName
}

Target is a type which allows to retrieve a potentially dynamically changing IP from Kubernetes.

func NewServiceTarget added in v0.4.0

func NewServiceTarget(name, namespace string) Target

NewServiceTarget creates a new target which dynamically sources the IP from the provided Kubernetes service.

func NewStaticTarget added in v0.4.0

func NewStaticTarget(ips ...string) Target

NewStaticTarget creates a new target which provides the given static IPs. IPs may be IPv4 or IPv6 addresses (and any combination thereof).

Jump to

Keyboard shortcuts

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