switchboard

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

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

Factory is a type which simplifies the creation of Kubernetes resources.

func NewFactory

func NewFactory(client client.Client, scheme *runtime.Scheme) *Factory

NewFactory returns a factory to create Kubernetes resources.

func (Factory) UpsertCertificate

func (f Factory) UpsertCertificate(
	ctx context.Context,
	owner metav1.Object,
	issuer cmmeta.ObjectReference,
	secretName string,
	hosts []string,
) error

UpsertCertificate creates a new certificate resource (or updates it if it exists), copies the ingress annotation from the provided resource and sets the provided resource as owner.

func (Factory) UpsertDNSEndpoint

func (f Factory) UpsertDNSEndpoint(
	ctx context.Context, owner metav1.Object, endpoints []*endpoint.Endpoint,
) error

UpsertDNSEndpoint creates a new DNS endpoint resource (or updates it if it exists), copies the ingress annotation from the provided resource and sets the provided resource as owner.

type HostAggregator

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

HostAggregator allows to aggregate the hosts from ingress resources.

func NewHostAggregator

func NewHostAggregator() *HostAggregator

NewHostAggregator returns a new "empty" host aggregator.

func (*HostAggregator) DNSEndpoints

func (a *HostAggregator) DNSEndpoints(target string, ttl endpoint.TTL) []*endpoint.Endpoint

DNSEndpoints returns a list of DNS endpoints with the DNS names set to the aggregator's managed hosts and the target set to the provided IP. Record ttl is set as passed.

func (*HostAggregator) Hosts

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

Hosts returns all hosts managed by this aggregator.

func (*HostAggregator) Len

func (a *HostAggregator) Len() int

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

func (*HostAggregator) ParseRouteHostsIfRequired

func (a *HostAggregator) ParseRouteHostsIfRequired(routes []traefik.Route)

ParseRouteHostsIfRequired 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 (*HostAggregator) ParseTLSHosts

func (a *HostAggregator) ParseTLSHosts(config *traefik.TLS)

ParseTLSHosts 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 struct {
	// contains filtered or unexported fields
}

Target represents a service whose external/internal IP should be used as target for DNS records.

func NewTarget

func NewTarget(client client.Client, name, namespace string) Target

NewTarget creates a new target from the service with the specified name in the given namespace.

func (Target) IP

func (t Target) IP(ctx context.Context) (string, error)

IP returns the IP that should be used as target or an error if querying the IP fails.

func (Target) Matches

func (t Target) Matches(service client.Object) bool

Matches returns whether the provided service is referenced by this target.

Jump to

Keyboard shortcuts

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