dns

package
v0.0.0-...-7949e55 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const Host = "dream.mesh"

Host this is the host name on which we are resolving all the services inside the mesh

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client holds the client for interacting with the k8s DNS system.

func NewClient

func NewClient(logger logr.Logger, kubeClient kubernetes.Interface) *Client

NewClient returns an initialized DNSClient object.

func (*Client) CheckDNSProvider

func (c *Client) CheckDNSProvider(ctx context.Context) (Provider, error)

CheckDNSProvider checks that the DNS provider deployed in the cluster is supported and returns it.

func (*Client) ConfigureCoreDNS

func (c *Client) ConfigureCoreDNS(ctx context.Context, dnsServiceNamespace, dnsServiceName string, dnsServicePort int32) error

ConfigureCoreDNS patches the CoreDNS configuration for dream Mesh.

func (*Client) ConfigureKubeDNS

func (c *Client) ConfigureKubeDNS(ctx context.Context, dnsServiceNamespace, dnsServiceName string, dnsServicePort int32) error

ConfigureKubeDNS patches the KubeDNS configuration for dream Mesh.

func (*Client) RestoreCoreDNS

func (c *Client) RestoreCoreDNS(ctx context.Context) error

RestoreCoreDNS restores the CoreDNS configuration to pre-install state.

func (*Client) RestoreKubeDNS

func (c *Client) RestoreKubeDNS(ctx context.Context) error

RestoreKubeDNS restores the KubeDNS configuration to pre-install state.

type Control

type Control struct {
	client.Client

	Log logr.Logger

	Namespace string
	Port      int32

	ServiceName string
	ServicePort int32
}

func (*Control) Configure

func (c *Control) Configure(ctx context.Context) error

Configure patches dns service

func (*Control) Start

func (c *Control) Start(ctx context.Context)

Start starts the dns server

type Provider

type Provider int

Provider represents a DNS provider.

const (
	UnknownDNS Provider = iota
	CoreDNS
	KubeDNS
)

Supported DNS providers.

type Server

type Server struct {
	dns.Server
	// contains filtered or unexported fields
}

Server is a DNS server forwarding A requests to the configured resolver.

func NewServer

func NewServer(port int32, resolver *ShadowServiceResolver, logger logr.Logger) *Server

NewServer creates and returns a new DNS server.

type ShadowServiceResolver

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

ShadowServiceResolver is a DNS resolver implementation which resolves the shadow service ClusterIP corresponding to a subdomain. The subdomain must be of form: name.namespace.domain where name and namespace match the shadowed service metadata and domain the configured domain.

func NewShadowServiceResolver

func NewShadowServiceResolver(domain, namespace string, serviceLister listers.ServiceLister) *ShadowServiceResolver

NewShadowServiceResolver creates and returns a new resolver.

func (*ShadowServiceResolver) Domain

func (r *ShadowServiceResolver) Domain() string

Domain returns the configured domain.

func (*ShadowServiceResolver) LookupFQDN

func (r *ShadowServiceResolver) LookupFQDN(fqdn string) (net.IP, error)

LookupFQDN returns the ClusterIP of the Shadow Service corresponding to the given FQDN.

Jump to

Keyboard shortcuts

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