records

package
v0.0.0-...-b3a11db Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2015 License: Apache-2.0 Imports: 19 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 out of mesos domain queries

func ZKdetect

func ZKdetect(c *Config) (<-chan struct{}, error)

Start a Zookeeper listener to track leading master, returns a signal chan that closes upon the first leader detection notification (and c.leader is meaningfully readable).

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

	// 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 int

	// 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

	// Email is the rname for a SOA
	Email string

	// Mname is the mname for a SOA
	Mname string

	// ListenAddr is the server listener address
	Listener string
	// contains filtered or unexported fields
}

Config holds mesos dns configuration

func SetConfig

func SetConfig(cjson string) (c Config)

SetConfig instantiates a Config struct read in from config.json

type Frameworks

type Frameworks []struct {
	Tasks `json:"tasks"`
	Name  string `json:"name"`
}

Frameworks holds mesos frameworks information read in from state.json

type RecordGenerator

type RecordGenerator struct {
	As   rrs
	SRVs rrs
	Slaves
}

RecordGenerator is a tmp mapping of resource records and slaves maybe de-dupe prob. want to break apart refactor me - prob. not needed

func (*RecordGenerator) InsertState

func (rg *RecordGenerator) InsertState(sj StateJSON, domain string, mname string,
	listener string, masters []string) error

InsertState transforms a StateJSON into RecordGenerator RRs

func (*RecordGenerator) ParseState

func (rg *RecordGenerator) ParseState(config *Config) error

ParseState parses a state.json from a mesos master it sets the resource records map for the resolver with the following format

_<tag>.<service>.<framework>._<protocol>..mesos

it also tries different mesos masters if one is not up this will shudown if it can't connect to a mesos master

type Resources

type Resources struct {
	Ports string `json:"ports"`
}

Resources holds our SRV ports

type Slaves

type Slaves []slave

Slaves is a mapping of id to hostname read in from state.json

type StateJSON

type StateJSON struct {
	Frameworks `json:"frameworks"`
	Slaves     `json:"slaves"`
	Leader     string `json:"leader"`
}

StateJSON is a representation of mesos master state.json

type Tasks

type Tasks []struct {
	FrameworkId string `json:"framework_id"`
	Id          string `json:"id"`
	Name        string `json:"name"`
	SlaveId     string `json:"slave_id"`
	State       string `json:"state"`
	Resources   `json:"resources"`
}

Tasks holds mesos task information read in from state.json

Jump to

Keyboard shortcuts

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