records

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2015 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package records contains functions to generate resource records from mesos master states to serve through a dns server

Index

Constants

This section is empty.

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 {

	// Mesos master(s): a list of IP:port pairs for one or more Mesos masters
	Masters []string

	// Zookeeper: a single Zk url
	Zk string

	// Zookeeper Detection Timeout: how long in seconds to wait for Zookeeper to be initially responsive (default 30)
	ZkDetectionTimeout int

	// Refresh frequency: the frequency in seconds of regenerating records (default 60)
	RefreshSeconds int

	// TTL: the TTL value used for SRV and A records (default 60)
	TTL int32

	// Resolver port: port used to listen for slave requests (default 53)
	Port int

	//  Domain: name of the domain used (default "mesos", ie .mesos domain)
	Domain string

	// DNS server: IP address of the DNS server for forwarded accesses
	Resolvers []string

	// Timeout is the default connect/read/write timeout for outbound
	// queries
	Timeout int

	// File is the location of the config.json file
	File string

	// SOA record fields (see http://tools.ietf.org/html/rfc1035#page-18)
	SOAMname   string // primary name server
	SOARname   string // email of admin esponsible
	SOASerial  uint32 // initial version number (incremented on refresh)
	SOARefresh uint32 // refresh interval
	SOARetry   uint32 // retry interval
	SOAExpire  uint32 // expiration time
	SOAMinttl  uint32 // minimum TTL

	// Value of RecursionAvailable for responses in Mesos domain
	RecurseOn bool

	// ListenAddr is the server listener address
	Listener string

	// NOTE(tsenart): HTTPPort, DNSOn and HTTPOn have defined JSON keys for
	// backwards compatibility with external API clients.
	HTTPPort int `json:"HttpPort"`

	// Enable serving DSN and HTTP requests
	DNSOn  bool `json:"DnsOn"`
	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

	// IPSources is the prioritized list of task IP sources
	IPSources []string // e.g. ["host", "docker", "mesos", "rkt"]
}

Config holds mesos dns configuration

func NewConfig added in v0.2.0

func NewConfig() Config

NewConfig return the default config of the resolver

func SetConfig

func SetConfig(cjson string) Config

SetConfig instantiates a Config struct read in from config.json

type RecordGenerator

type RecordGenerator struct {
	As       rrs
	SRVs     rrs
	SlaveIPs map[string]string
}

RecordGenerator contains DNS records and methods to access and manipulate them. TODO(kozyraki): Refactor when discovery id is available.

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.json and converts it into DNS records.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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