Documentation ¶
Overview ¶
Package kubernetes provides the kubernetes backend.
Index ¶
- Constants
- type Kubernetes
- func (k *Kubernetes) AutoPath(state request.Request) []string
- func (k *Kubernetes) External(state request.Request, headless bool) ([]msg.Service, int)
- func (k *Kubernetes) ExternalAddress(state request.Request, headless bool) []dns.RR
- func (k *Kubernetes) ExternalReverse(ip string) ([]msg.Service, error)
- func (k *Kubernetes) ExternalSerial(string) uint32
- func (k *Kubernetes) ExternalServices(zone string, headless bool) (services []msg.Service, headlessServices map[string][]msg.Service)
- func (k *Kubernetes) InitKubeCache(ctx context.Context) (onStart func() error, onShut func() error, err error)
- func (k *Kubernetes) IsNameError(err error) bool
- func (k *Kubernetes) Lookup(ctx context.Context, state request.Request, name string, typ uint16) (*dns.Msg, error)
- func (k *Kubernetes) Metadata(ctx context.Context, state request.Request) context.Context
- func (k *Kubernetes) MinTTL(state request.Request) uint32
- func (k Kubernetes) Name() string
- func (k *Kubernetes) Ready() bool
- func (k *Kubernetes) Records(ctx context.Context, state request.Request, exact bool) ([]msg.Service, error)
- func (k *Kubernetes) Reverse(ctx context.Context, state request.Request, exact bool, opt plugin.Options) ([]msg.Service, error)
- func (k *Kubernetes) Serial(state request.Request) uint32
- func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)
- func (k *Kubernetes) Services(ctx context.Context, state request.Request, exact bool, opt plugin.Options) (svcs []msg.Service, err error)
- func (k *Kubernetes) Transfer(zone string, serial uint32) (<-chan []dns.RR, error)
- type Upstreamer
Constants ¶
const ( Endpoint = "endpoint" PortProtocol = "port.protocol" )
Those constants are used to distinguish between records in ExternalServices headless return values. They are always appendedn to key in a map which is either base service key eg. /com/example/namespace/service/endpoint or /com/example/namespace/service/_http/_tcp/port.protocol this will allow us to distinguish services in implementation of Transfer protocol see plugin/k8s_external/transfer.go
const ( // DNSSchemaVersion is the schema version: https://github.com/kubernetes/dns/blob/master/docs/specification.md DNSSchemaVersion = "1.1.0" // 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 Kubernetes ¶
type Kubernetes struct { Next plugin.Handler Zones []string Upstream Upstreamer APIServerList []string APICertAuth string APIClientCert string APIClientKey string ClientConfig clientcmd.ClientConfig APIConn dnsController Namespaces map[string]struct{} Fall fall.F // contains filtered or unexported fields }
Kubernetes implements a plugin that connects to a Kubernetes cluster.
func New ¶
func New(zones []string) *Kubernetes
New returns a initialized Kubernetes. It default interfaceAddrFunc to return 127.0.0.1. All other values default to their zero value, primaryZoneIndex will thus point to the first zone.
func ParseStanza ¶
func ParseStanza(c *caddy.Controller) (*Kubernetes, error)
ParseStanza parses a kubernetes stanza
func (*Kubernetes) AutoPath ¶
func (k *Kubernetes) AutoPath(state request.Request) []string
AutoPath implements the AutoPathFunc call from the autopath plugin. It returns a per-query search path or nil indicating no searchpathing should happen.
func (*Kubernetes) External ¶
External implements the ExternalFunc call from the external plugin. It returns any services matching in the services' ExternalIPs and if enabled, headless endpoints..
func (*Kubernetes) ExternalAddress ¶
ExternalAddress returns the external service address(es) for the CoreDNS service.
func (*Kubernetes) ExternalReverse ¶
func (k *Kubernetes) ExternalReverse(ip string) ([]msg.Service, error)
ExternalReverse does a reverse lookup for the external IPs
func (*Kubernetes) ExternalSerial ¶
func (k *Kubernetes) ExternalSerial(string) uint32
ExternalSerial returns the serial of the external zone
func (*Kubernetes) ExternalServices ¶
func (k *Kubernetes) ExternalServices(zone string, headless bool) (services []msg.Service, headlessServices map[string][]msg.Service)
ExternalServices returns all services with external IPs and if enabled headless services
func (*Kubernetes) InitKubeCache ¶
func (k *Kubernetes) InitKubeCache(ctx context.Context) (onStart func() error, onShut func() error, err error)
InitKubeCache initializes a new Kubernetes cache.
func (*Kubernetes) IsNameError ¶
func (k *Kubernetes) IsNameError(err error) bool
IsNameError implements the ServiceBackend interface.
func (*Kubernetes) Lookup ¶
func (k *Kubernetes) Lookup(ctx context.Context, state request.Request, name string, typ uint16) (*dns.Msg, error)
Lookup implements the ServiceBackend interface.
func (*Kubernetes) MinTTL ¶
func (k *Kubernetes) MinTTL(state request.Request) uint32
MinTTL returns the minimal TTL.
func (*Kubernetes) Ready ¶
func (k *Kubernetes) Ready() bool
Ready implements the ready.Readiness interface.
func (*Kubernetes) Records ¶
func (k *Kubernetes) Records(ctx context.Context, state request.Request, exact bool) ([]msg.Service, error)
Records looks up services in kubernetes.
func (*Kubernetes) Reverse ¶
func (k *Kubernetes) Reverse(ctx context.Context, state request.Request, exact bool, opt plugin.Options) ([]msg.Service, error)
Reverse implements the ServiceBackend interface.
func (*Kubernetes) Serial ¶
func (k *Kubernetes) Serial(state request.Request) uint32
Serial return the SOA serial.
func (Kubernetes) ServeDNS ¶
func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)
ServeDNS implements the plugin.Handler interface.