dns

package
v1.22.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2021 License: Apache-2.0 Imports: 11 Imported by: 309

Documentation

Index

Constants

View Source
const (
	// RecordTypeAlias is unusual: the controller will try to resolve the target locally
	RecordTypeAlias = "_alias"

	RecordTypeA     = "A"
	RecordTypeAAAA  = "AAAA"
	RecordTypeCNAME = "CNAME"

	RoleTypeExternal = "external"
	RoleTypeInternal = "internal"
)
View Source
const DefaultTTL = time.Minute
View Source
const MaxFailures = 5

Variables

This section is empty.

Functions

func AliasForNodesInRole added in v1.10.0

func AliasForNodesInRole(role, roleType string) string

AliasForNodesInRole returns the alias for nodes in the given role

func EnsureDotSuffix

func EnsureDotSuffix(s string) string

func FixWildcards added in v1.10.0

func FixWildcards(s string) string

Types

type Context

type Context interface {
	// CreateScope creates a new scope, which holds a set of records.
	// MarkReady must be called on every scope before any changes will be applied.
	// Records from all the scopes will be merged
	CreateScope(name string) (Scope, error)
}

Context represents a state of the world for DNS. It is grouped by scopes & named keys, and controllers will replace those groups The DNS controller will then merge all those record sets, resolve aliases etc, and then call into a dns backend to match the desired state of the world.

type DNSController

type DNSController struct {
	util.Stoppable
	// contains filtered or unexported fields
}

DNSController applies the desired DNS state to the DNS backend

func NewDNSController

func NewDNSController(dnsProviders []dnsprovider.Interface, zoneRules *ZoneRules, updateInterval int) (*DNSController, error)

NewDNSController creates a DnsController

func (*DNSController) CreateScope

func (c *DNSController) CreateScope(scopeName string) (Scope, error)

CreateScope creates a scope object.

func (*DNSController) RemoveRecordsImmediate added in v1.15.1

func (c *DNSController) RemoveRecordsImmediate(records []Record) error

func (*DNSController) Run

func (c *DNSController) Run()

Run starts the DnsController.

type DNSControllerScope

type DNSControllerScope struct {
	// ScopeName is the string id for this scope
	ScopeName string

	// Ready is set if the populating controller has performed an initial synchronization of records
	Ready bool

	// Records is the map of actual records for this scope
	Records map[string][]Record
	// contains filtered or unexported fields
}

DNSControllerScope is a group of record objects

func (*DNSControllerScope) AllKeys added in v1.10.0

func (s *DNSControllerScope) AllKeys() []string

AllKeys implements Scope::AllKeys, returns all the keys in the current scope

func (*DNSControllerScope) MarkReady

func (s *DNSControllerScope) MarkReady()

func (*DNSControllerScope) Replace

func (s *DNSControllerScope) Replace(recordName string, records []Record)

type Record

type Record struct {
	RecordType RecordType
	FQDN       string
	Value      string

	// If AliasTarget is set, this entry will not actually be set in DNS,
	// but will be used as an expansion for Records with type=RecordTypeAlias,
	// where the referring record has Value = our FQDN
	AliasTarget bool
}

func (*Record) String added in v1.10.0

func (r *Record) String() string

type RecordType

type RecordType string

type Scope

type Scope interface {
	// Replace sets the records for recordName to the provided set of records.
	Replace(recordName string, records []Record)

	// MarkReady should be called when a controller has populated all the records for a particular scope
	MarkReady()

	// AllKeys gets the set of all keys currently in the scope
	AllKeys() []string
}

type ZoneRules added in v1.4.1

type ZoneRules struct {
	// We don't use a map so we can support e.g. *.example.com later
	Zones    []*ZoneSpec
	Wildcard bool
}

func ParseZoneRules added in v1.4.1

func ParseZoneRules(zones []string) (*ZoneRules, error)

func (*ZoneRules) MatchesExplicitly added in v1.4.1

func (r *ZoneRules) MatchesExplicitly(zone dnsprovider.Zone) bool

MatchesExplicitly returns true if this matches an explicit rule (not a wildcard)

type ZoneSpec added in v1.4.1

type ZoneSpec struct {
	Name string
	ID   string
}

func ParseZoneSpec added in v1.4.1

func ParseZoneSpec(s string) (*ZoneSpec, error)

Jump to

Keyboard shortcuts

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