dns

package
v3.9.0-alpha.3+incompa... Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2018 License: Apache-2.0 Imports: 27 Imported by: 0 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServerDefaults

func NewServerDefaults() (*server.Config, error)

NewServerDefaults returns the default SkyDNS server configuration for a DNS server.

Types

type EndpointsAccessor

type EndpointsAccessor interface {
	kcorelisters.EndpointsLister
	// EndpointsByHostnameIP retrieves the Endpoints object containing a hostname
	// that resolves to IP. Only endpoint addresses with a hostname field will match.
	// If this returns an error, the caller should indicate that this may be a
	// deliberately ambiguous response (server decided not to support this call.
	EndpointsByHostnameIP(ip string) ([]*api.Endpoints, error)
}

EndpointsAccessor is the interface used by the ServiceResolver to access endpoints.

func NewCachedEndpointsAccessor

func NewCachedEndpointsAccessor(endpointsInformer kcoreinformers.EndpointsInformer) (EndpointsAccessor, error)

NewCachedEndpointsAccessor returns a service accessor that can answer queries about services. It uses a backing cache to make ClusterIP lookups efficient.

type FallbackFunc

type FallbackFunc func(name string, exact bool) (string, bool)

type Server

type Server struct {
	Config      *server.Config
	Services    ServiceAccessor
	Endpoints   EndpointsAccessor
	MetricsName string

	Stop chan struct{}
}

func NewServer

func NewServer(config *server.Config, services ServiceAccessor, endpoints EndpointsAccessor, metricsName string) *Server

NewServer creates a server.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe starts a DNS server that exposes services and values stored in etcd (if etcdclient is not nil). It will block until the server exits.

type ServiceAccessor

type ServiceAccessor interface {
	kcoreclient.ServicesGetter
	ServiceByClusterIP(ip string) (*api.Service, error)
}

ServiceAccessor is the interface used by the ServiceResolver to access services.

func NewCachedServiceAccessor

func NewCachedServiceAccessor(serviceInformer kcoreinformers.ServiceInformer) (ServiceAccessor, error)

NewCachedServiceAccessor returns a service accessor that can answer queries about services. It uses a backing cache to make ClusterIP lookups efficient.

type ServiceResolver

type ServiceResolver struct {
	// contains filtered or unexported fields
}

ServiceResolver is a SkyDNS backend that will serve lookups for DNS entries based on Kubernetes service entries. The default DNS name for each service will be `<name>.<namespace>.<base>` where base can be an arbitrary depth DNS suffix. Queries not recognized within this base will return an error.

func NewServiceResolver

func NewServiceResolver(config *server.Config, accessor ServiceAccessor, endpoints EndpointsAccessor, fn FallbackFunc) *ServiceResolver

NewServiceResolver creates an object that will return DNS record entries for SkyDNS based on service names.

func (*ServiceResolver) Records

func (b *ServiceResolver) Records(dnsName string, exact bool) ([]msg.Service, error)

Records implements the SkyDNS Backend interface and returns standard records for a name.

The standard pattern is <prefix>.<service_name>.<namespace>.(svc|endpoints|pod).<base>

* prefix may be any series of prefix values

  • _endpoints is a special prefix that returns the same as <service_name>.<namespace>.svc.<base>

* service_name and namespace must locate a real service

  • unless a fallback is defined, in which case the fallback name will be looked up

* svc indicates standard service rules apply (clusterIP or endpoints as A records)

  • reverse lookup of IP is only possible for clusterIP
  • SRV records are returned for each host+port combination as: _<port_name>._<port_protocol>.<dns> _<port_name>.<endpoint_id>.<dns>

* endpoints always returns each individual endpoint as A records

  • SRV records for endpoints are similar to SVC, but are prefixed with a single label that is a hash of the endpoint IP

* pods is of the form <IP_with_dashes>.<namespace>.pod.<base> and resolves to <IP>

func (*ServiceResolver) ReverseRecord

func (b *ServiceResolver) ReverseRecord(name string) (*msg.Service, error)

ReverseRecord implements the SkyDNS Backend interface and returns standard records for a name.

type SimpleEndpointsAccessor

type SimpleEndpointsAccessor struct {
	kcorelisters.EndpointsLister
}

SimpleEndpointsAccessor answers endpoint lookups but always returns an error for EndpointsByHostnameIP.

func (SimpleEndpointsAccessor) EndpointsByHostnameIP

func (a SimpleEndpointsAccessor) EndpointsByHostnameIP(_ string) ([]*api.Endpoints, error)

EndpointsByHostnameIP always returns an error.

Jump to

Keyboard shortcuts

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