federation

package module
v0.0.0-...-019e069 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: Apache-2.0 Imports: 13 Imported by: 1

README

federation

Name

federation - enables federated queries to be resolved via the kubernetes plugin.

Description

Enabling this plugin allows Federated queries to be resolved via the kubernetes plugin.

Enabling federation without also having kubernetes is a noop.

Syntax

federation [ZONES...] {
    NAME DOMAIN
}
  • Each NAME and DOMAIN defines federation membership. One entry for each. A duplicate NAME will silently overwrite any previous value.

Examples

Here we handle all service requests in the prod and stage federations.

. {
    kubernetes cluster.local
    federation cluster.local {
        prod prod.feddomain.com
        staging staging.feddomain.com
    }
    forward . 192.168.1.12
}

Note

This plugin was from github.com/coredns/coredns/plugin/federation through the following command so that commit history could be preserved:

git filter-branch --subdirectory-filter plugin/federation -- --all

Documentation

Overview

Package federation implements kubernetes federation. It checks if the qname matches a possible federation. If this is the case and the captured answer is an NXDOMAIN, federation is performed. If this is not the case the original answer is returned.

The federation label is always the 2nd to last once the zone is chopped of. For instance "nginx.mynamespace.myfederation.svc.example.com" has "myfederation" as the federation label. For federation to work we do a normal k8s lookup *without* that label, if that comes back with NXDOMAIN or NODATA(??) we create a federation record and return that.

Federation is only useful in conjunction with the kubernetes plugin, without it is a noop.

Index

Constants

View Source
const (
	LabelZone   = "failure-domain.beta.kubernetes.io/zone"
	LabelRegion = "failure-domain.beta.kubernetes.io/region"
)

The federation node.Labels keys used.

View Source
const (
	// Svc is the DNS schema for kubernetes services
	Svc = "svc"
	// Pod is the DNS schema for kubernetes pods
	Pod = "pod"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Federation

type Federation struct {
	Upstream *upstream.Upstream

	Next        plugin.Handler
	Federations Func
	// contains filtered or unexported fields
}

Federation contains the name to zone mapping used for federation in kubernetes.

func New

func New() *Federation

New returns a new federation.

func (*Federation) FederationsFunc

func (f *Federation) FederationsFunc(state request.Request, fname, fzone string) (msg.Service, error)

Federations is used from the federations plugin to return the service that should be returned as a CNAME for federation(s) to work.

func (*Federation) Name

func (f *Federation) Name() string

Name implements the plugin.Handle interface.

func (*Federation) ServeDNS

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

ServeDNS implements the plugin.Handle interface.

type Func

type Func func(state request.Request, fname, fzone string) (msg.Service, error)

Func needs to be implemented by any plugin that implements federation. Right now this is only the kubernetes plugin.

Jump to

Keyboard shortcuts

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