zoneregistry

package module
v0.0.0-...-1258a76 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 19 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

zoneregistry

A CoreDNS plugin to handle service discovery across distributed kubernetes clusters

TODOs

  • Return A/AAAA instead of CNAMEs from the registry
  • Loadbalance the peers records
  • Add concurrency safety on the peers map
  • Add e2e test for standalone deployment
  • Add primary/secondary role for peers
  • Add prometheus metrics integration
  • Add CI + automated testing
  • Add support for multiple zoneregistry masters
  • Add e2e test for k8s deployment
  • Update README

Configure

Configuration options can be used to customize the behaviour of a plugin:

{
zoneregistry ZONE
    peers [PEERS...]
    interval INTERVAL
    ttl TTL
    fallthrough [ZONES...]
}
  • peers the subzones to run healthchecks against.
  • interval can be used to override the default INTERVAL value of 60 seconds.
  • ttl can be used to override the default TTL value of 300 seconds.
  • fallthrough if zone matches and no record can be generated, pass request to the next plugin. If [ZONES...] is omitted, then fallthrough happens for all zones for which the plugin is authoritative. If specific zones are listed (for example in-addr.arpa and ip6.arpa), then only queries for those zones will be subject to fallthrough.

Example

Configuring the zone registry to perform healthchecks on 3 k8s clusters

. {
  zoneregistry service.pinax.network {
    debug
    metrics
    interval 60
    timeout 10
    ttl 300

    peer riv-prod1.service.pinax.network {
        role primary
        labels cluster-env=prod
        IPv4 172.100.0.101
        IPv6 2001:db8:172:100::101
        protocol http
        path /health
        port 8080
    }
    peer riv-prod2.service.pinax.network {
        role primary
        labels cluster-env=prod
        IPv4 172.100.0.102
        IPv6 2001:db8:172:100::102
        protocol http
        path /health
        port 8080
    }
    peer mar-dev1.service.pinax.network {
        role secondary
        labels cluster-env=dev
        IPv4 172.100.0.1043
        IPv6 2001:db8:172:100::103
        protocol http
        path /health
        port 8080
    }
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Peer

type Peer struct {
	Host    string
	Role    string
	Healthy bool
	Labels  []string

	Protocol string
	Path     string
	Port     uint32

	IPv4 net.IP
	IPv6 net.IP
}

func NewPeer

func NewPeer() *Peer

type ZoneRegistry

type ZoneRegistry struct {
	Next     plugin.Handler
	Zones    []string
	TTL      uint32
	Interval uint32
	Timeout  uint32
	Fall     fall.F

	Peers []*Peer
	// contains filtered or unexported fields
}

func (*ZoneRegistry) GetHealthyPeers

func (zr *ZoneRegistry) GetHealthyPeers() []*Peer

func (*ZoneRegistry) Name

func (zr *ZoneRegistry) Name() string

func (*ZoneRegistry) ServeDNS

func (zr *ZoneRegistry) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS implements the plugin.Handler interface.

func (*ZoneRegistry) StartHealthChecks

func (zr *ZoneRegistry) StartHealthChecks()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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