Documentation ¶
Overview ¶
Package kubernetes provides the kubernetes backend.
Index ¶
- Constants
- Variables
- type Kubernetes
- func (k *Kubernetes) AutoPath(state request.Request) []string
- func (k *Kubernetes) External(state request.Request) ([]msg.Service, int)
- func (k *Kubernetes) ExternalAddress(state request.Request) []dns.RR
- func (k *Kubernetes) InitKubeCache() (err error)
- func (k *Kubernetes) IsNameError(err error) bool
- func (k *Kubernetes) LocalNodeName() string
- 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) RegisterKubeCache(c *caddy.Controller)
- 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(ctx context.Context, state request.Request) (int, error)
Constants ¶
const ( // DNSSchemaVersion is the schema version: https://github.com/kubernetes/dns/blob/master/docs/specification.md DNSSchemaVersion = "1.0.1" // Svc is the DNS schema for kubernetes services Svc = "svc" // Pod is the DNS schema for kubernetes pods Pod = "pod" )
Variables ¶
var ( // DnsProgrammingLatency is defined as the time it took to program a DNS instance - from the time // a service or pod has changed to the time the change was propagated and was available to be // served by a DNS server. // The definition of this SLI can be found at https://github.com/kubernetes/community/blob/master/sig-scalability/slos/dns_programming_latency.md // Note that the metrics is partially based on the time exported by the endpoints controller on // the master machine. The measurement may be inaccurate if there is a clock drift between the // node and master machine. // The service_kind label can be one of: // * cluster_ip // * headless_with_selector // * headless_without_selector DnsProgrammingLatency = prometheus.NewHistogramVec(prometheus.HistogramOpts{ Namespace: plugin.Namespace, Subsystem: subsystem, Name: "dns_programming_duration_seconds", Buckets: prometheus.ExponentialBuckets(0.001, 2, 20), Help: "Histogram of the time (in seconds) it took to program a dns instance.", }, []string{"service_kind"}) )
Functions ¶
This section is empty.
Types ¶
type Kubernetes ¶
type Kubernetes struct { Next plugin.Handler Zones []string Upstream *upstream.Upstream APIServerList []string APICertAuth string APIClientCert string APIClientKey string ClientConfig clientcmd.ClientConfig APIConn dnsController Namespaces map[string]struct{} Fall fall.F TransferTo []string // 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 ¶ added in v1.0.6
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 ¶ added in v1.3.0
External implements the ExternalFunc call from the external plugin. It returns any services matching in the services' ExternalIPs.
func (*Kubernetes) ExternalAddress ¶ added in v1.3.0
func (k *Kubernetes) ExternalAddress(state request.Request) []dns.RR
ExternalAddress returns the external service address(es) for the CoreDNS service.
func (*Kubernetes) InitKubeCache ¶ added in v1.0.6
func (k *Kubernetes) InitKubeCache() (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) LocalNodeName ¶ added in v1.6.3
func (k *Kubernetes) LocalNodeName() string
LocalNodeName is exclusively used in federation plugin, will be deprecated later.
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 ¶ added in v0.9.10
func (k *Kubernetes) MinTTL(state request.Request) uint32
MinTTL implements the Transferer interface.
func (*Kubernetes) Ready ¶ added in v1.5.0
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) RegisterKubeCache ¶ added in v1.0.6
func (k *Kubernetes) RegisterKubeCache(c *caddy.Controller)
RegisterKubeCache registers KubeCache start and stop functions with Caddy
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 ¶ added in v0.9.10
func (k *Kubernetes) Serial(state request.Request) uint32
Serial implements the Transferer interface.
func (Kubernetes) ServeDNS ¶
func (k Kubernetes) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)
ServeDNS implements the plugin.Handler interface.