Documentation ¶
Overview ¶
Package records contains functions to generate resource records from mesos master states to serve through a dns server
Index ¶
Constants ¶
const ( // A record types A rrsKind = "A" // PTR record types PTR = "PTR" // AAAA record types AAAA rrsKind = "AAAA" // SRV record types SRV = "SRV" )
Variables ¶
This section is empty.
Functions ¶
func GetLocalDNS ¶
func GetLocalDNS() []string
GetLocalDNS returns the first nameserver in /etc/resolv.conf Used for non-Mesos queries.
Types ¶
type Config ¶
type Config struct { // Refresh frequency: the frequency in seconds of regenerating records (default 60) RefreshSeconds int // Resolver port: port used to listen for slave requests (default 53) Port int // Timeout is the default connect/read/write timeout for outbound // queries Timeout int // Timeout in seconds waiting for the master to return data from StateJson StateTimeoutSeconds int // Zookeeper Detection Timeout: how long in seconds to wait for Zookeeper to // be initially responsive. Default is 30 and 0 means no timeout. ZkDetectionTimeout int // NOTE(tsenart): HTTPPort, DNSOn and HTTPOn have defined JSON keys for // backwards compatibility with external API clients. HTTPPort int `json:"HttpPort"` // TTL: the TTL value used for SRV and A records (default 60) TTL int32 // SRVRecordDefaultWeight: default weight for SRV records SRVRecordDefaultWeight uint16 // SOA record fields (see http://tools.ietf.org/html/rfc1035#page-18) SOASerial uint32 // initial version number (incremented on refresh) SOARefresh uint32 // refresh interval SOARetry uint32 // retry interval SOAExpire uint32 // expiration time SOAMinttl uint32 // minimum TTL SOAMname string // primary name server SOARname string // email of admin esponsible // Mesos master(s): a list of IP:port pairs for one or more Mesos masters Masters []string // DNS server: IP address of the DNS server for forwarded accesses ZoneResolvers map[string][]string // DNS server: a list of IP addresses or IP:port pairs for DNS servers for forwarded accesses Resolvers []string // IPSources is the prioritized list of task IP sources IPSources []string // e.g. ["host", "docker", "mesos", "rkt"] // Zookeeper: a single Zk url Zk string // Domain: name of the domain used (default "mesos", ie .mesos domain) Domain string // File is the location of the config.json file File string // Listen is the server DNS listener IP address Listener string // HTTPListen is the server HTTP listener IP address HTTPListener string // Value of RecursionAvailable for responses in Mesos domain RecurseOn bool // Enable serving DSN and HTTP requests DNSOn bool `json:"DnsOn"` ReverseDNSOn bool `json:"ReverseDnsOn"` HTTPOn bool `json:"HttpOn"` // Enable replies for external requests ExternalOn bool // EnforceRFC952 will enforce an older, more strict set of rules for DNS labels EnforceRFC952 bool // SetTruncateBit when `false` ensures responses never have the Truncate bit set even // if they were truncated. When `true` any message that gets truncated will have the // Truncate bit set. // Compliant clients that receive truncated responses will retry the request // over TCP. Some non-compliant clients simply cannot handle truncated responses at all. // Disabling this option causes mesos-dns to behave in a non-compliant way. It exists // only as a workaround for non-compliant clients and users who cannot tolerate the // latency added by the standard TCP fallback. SetTruncateBit bool // Enumeration enabled via the API enumeration endpoint EnumerationOn bool // Communicate with Mesos using HTTPS if set to true MesosHTTPSOn bool // CA certificate to use to verify Mesos Master certificate CACertFile string // Client certificate to use. CertFile string // Client certificate key to use. KeyFile string MesosCredentials basic.Credentials // IAM Config File IAMConfigFile string MesosAuthentication httpcli.AuthMechanism // contains filtered or unexported fields }
Config holds mesos dns configuration
type EnumerableFramework ¶
type EnumerableFramework struct { Tasks []*EnumerableTask `json:"tasks"` Name string `json:"name"` }
EnumerableFramework is consistent of enumerable tasks, and include the name of the framework
type EnumerableRecord ¶
type EnumerableRecord struct { Name string `json:"name"` Host string `json:"host"` Rtype string `json:"rtype"` }
EnumerableRecord is the lowest level object, and should map 1:1 with DNS records
type EnumerableTask ¶
type EnumerableTask struct { Name string `json:"name"` ID string `json:"id"` Records []EnumerableRecord `json:"records"` }
EnumerableTask consists of the records derived from a task
type EnumerationData ¶
type EnumerationData struct {
Frameworks []*EnumerableFramework `json:"frameworks"`
}
EnumerationData is the top level container pointing to the enumerable frameworks containing enumerable tasks
type Option ¶
type Option func(*RecordGenerator)
Option is a functional configuration type that mutates a RecordGenerator
func WithConfig ¶
WithConfig generates and returns an option that applies some configuration to a RecordGenerator. The internal HTTP transport/client is generated upon invocation of this func so that the returned Option may be reused by generators that want to share the same transport/client.
type RecordGenerator ¶
type RecordGenerator struct { As rrs AAAAs rrs SRVs rrs PTRs rrs SlaveIPs map[string][]string EnumData EnumerationData // contains filtered or unexported fields }
RecordGenerator contains DNS records and methods to access and manipulate them. TODO(kozyraki): Refactor when discovery id is available.
func NewRecordGenerator ¶
func NewRecordGenerator(options ...Option) *RecordGenerator
NewRecordGenerator returns a RecordGenerator that's been configured with a timeout.
func (*RecordGenerator) InsertState ¶
func (rg *RecordGenerator) InsertState(sj state.State, domain, ns, listener string, masters, ipSources []string, spec labels.Func) error
InsertState transforms a StateJSON into RecordGenerator RRs
func (*RecordGenerator) ParseState ¶
func (rg *RecordGenerator) ParseState(c Config, masters ...string) error
ParseState retrieves and parses the Mesos master /state and converts it into DNS records.