dns

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetTypeHost = "HOST"
	TargetTypeIP   = "IP"
)
View Source
const ANNOTATION_HEALTH_CHECK_PREFIX = "kuadrant.experimental/health-"

Variables

View Source
var (
	NoSuchHost = errors.New("no such host")
)

Functions

func DefaultInterval

func DefaultInterval(ttl time.Duration) time.Duration

func IsNoSuchHostError

func IsNoSuchHostError(err error) bool

func NewVerifier

func NewVerifier(resolver resolver) *verifier

Types

type ConditionStatus

type ConditionStatus string
const (
	DNSRecordFinalizer = "kuadrant.dev/dns-record"

	ConditionTrue    ConditionStatus = "True"
	ConditionFalse   ConditionStatus = "False"
	ConditionUnknown ConditionStatus = "Unknown"
)

type ConfigMapHostResolver

type ConfigMapHostResolver struct {
	Client kubernetes.Interface

	Name, Namespace string
}

ConfigMapHostResolver is a HostResolver that looks up the IP address of a host from a ConfigMap. Used for testing purposes

func (*ConfigMapHostResolver) LookupIPAddr

func (r *ConfigMapHostResolver) LookupIPAddr(ctx context.Context, host string) ([]HostAddress, error)

func (*ConfigMapHostResolver) TxtRecordExists

func (r *ConfigMapHostResolver) TxtRecordExists(ctx context.Context, domain string, value string) (bool, error)

type Controller

type Controller struct {
	*reconciler.Controller
	// contains filtered or unexported fields
}

func NewController

func NewController(config *ControllerConfig) (*Controller, error)

NewController returns a new Controller which reconciles DNSRecord.

func (*Controller) ReconcileHealthChecks

func (c *Controller) ReconcileHealthChecks(ctx context.Context, dnsRecord *v1.DNSRecord) error

type ControllerConfig

type ControllerConfig struct {
	*reconciler.ControllerConfig
	DnsRecordClient       kuadrantv1.ClusterInterface
	SharedInformerFactory externalversions.SharedInformerFactory
	DNSProvider           string
}

type DefaultHostResolver

type DefaultHostResolver struct {
	Client dns.Client
}

func NewDefaultHostResolver

func NewDefaultHostResolver() *DefaultHostResolver

func (*DefaultHostResolver) LookupIPAddr

func (hr *DefaultHostResolver) LookupIPAddr(ctx context.Context, host string) ([]HostAddress, error)

type FakeProvider

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

func (*FakeProvider) Delete

func (_ *FakeProvider) Delete(record *v1.DNSRecord, zone v1.DNSZone) error

func (FakeProvider) DeleteHealthCheck

func (FakeProvider) DeleteHealthCheck(ctx context.Context, _ *v1.Endpoint) error

func (*FakeProvider) Ensure

func (_ *FakeProvider) Ensure(record *v1.DNSRecord, zone v1.DNSZone) error

func (FakeProvider) ReconcileHealthCheck

func (FakeProvider) ReconcileHealthCheck(ctx context.Context, _ v1.HealthCheck, _ *v1.Endpoint) error

type HealthCheckReconciler

type HealthCheckReconciler interface {
	ReconcileHealthCheck(ctx context.Context, hc v1.HealthCheck, endpoint *v1.Endpoint) error

	DeleteHealthCheck(ctx context.Context, endpoint *v1.Endpoint) error
}

TODO once we have a specific Health Check API this should have its own controller rather than piggy backing on the DNSRecord

type HostAddress

type HostAddress struct {
	Host string
	IP   gonet.IP
	TTL  time.Duration
	TXT  string
}

type HostResolver

type HostResolver interface {
	LookupIPAddr(ctx context.Context, host string) ([]HostAddress, error)
}

type HostsWatcher

type HostsWatcher struct {
	Resolver      HostResolver
	Records       []RecordWatcher
	OnChange      func(interface{})
	WatchInterval func(ttl time.Duration) time.Duration
	// contains filtered or unexported fields
}

HostsWatcher keeps track of changes in host addresses in the background. It associates a host with a key that is passed to the `OnChange` callback whenever a change is detected

func NewHostsWatcher

func NewHostsWatcher(l *logr.Logger, resolver HostResolver, watchInterval func(ttl time.Duration) time.Duration) *HostsWatcher

func (*HostsWatcher) ListHostRecordWatchers

func (w *HostsWatcher) ListHostRecordWatchers(obj interface{}) []RecordWatcher

func (*HostsWatcher) StartWatching

func (w *HostsWatcher) StartWatching(ctx context.Context, obj interface{}, host string) bool

StartWatching begins tracking changes in the addresses for host

func (*HostsWatcher) StopWatching

func (w *HostsWatcher) StopWatching(obj interface{}, host string)

StopWatching stops tracking changes in the addresses associated to obj

type Provider

type Provider interface {
	// Ensure will create or update record.
	Ensure(record *v1.DNSRecord, zone v1.DNSZone) error

	// Delete will delete record.
	Delete(record *v1.DNSRecord, zone v1.DNSZone) error
	// Get a health check reconciler for this provider
	HealthCheckReconciler
}

Provider knows how to manage DNS zones only as pertains to routing.

func DNSProvider

func DNSProvider(dnsProviderName string) (Provider, error)

type RecordWatcher

type RecordWatcher struct {
	Host string
	// contains filtered or unexported fields
}

type SafeHostResolver

type SafeHostResolver struct {
	HostResolver
	// contains filtered or unexported fields
}

func NewSafeHostResolver

func NewSafeHostResolver(inner HostResolver) *SafeHostResolver

func (*SafeHostResolver) LookupIPAddr

func (r *SafeHostResolver) LookupIPAddr(ctx context.Context, host string) ([]HostAddress, error)

type Target

type Target struct {
	TargetType string
	Value      []string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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