coredns

package
v0.1.27 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Address   string
	Port      uint16
	InCluster bool
	Namespace string
	Name      string
}

Endpoint representation for a namesever to be used be the resolver; Address and Port are mandatory; InCluster has to be set to true if the nameserver is runnning as a pod inside the cluster; in that case, Address and Port must point to that pod, and also Namespace and Name are required, referring to the according pod. If Incluster is false, Namespace and Name have no meaning and can be omitted.

type Resolver

type Resolver interface {
	// Check that the DNS resolution of host and expectedResult return the same address(es);
	// host must be a real DNS name, and must not be a wildcard name;
	// expectedResult may be a DNS name, an IP address, or empty, which means that the resolution of host
	// should not return any results, in order to make the check successful;
	// the boolean return value indicates success or failure of the check, the error return value
	// should be used to raise technical errors while performing the DNS resolution.
	CheckRecord(ctx context.Context, host string, expectedResult string) (bool, error)
}

Resolver interface

func NewResolver

func NewResolver(client client.Client, restConfig *rest.Config, inCluster bool, endpoints ...Endpoint) Resolver

Create new default resolver; the inCluster parameter has to be set to true if this operator is running inside the target cluster; if at least one endpoint is supplied, the specified endpoint(s) will be used for DNS queries; otherwise, the pod endpoints of the kube-system/kube-dns service will be used.

type RewriteRule

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

Rewrite rule (usually derived from a MasqueradingRule object)

func NewRewriteRule

func NewRewriteRule(owner string, from string, to string) (*RewriteRule, error)

Create new RewriteRule object (and validate input)

func (*RewriteRule) From

func (r *RewriteRule) From() string

Return rewrite source (from) of a RewriteRule

func (*RewriteRule) Matches

func (r *RewriteRule) Matches(host string) bool

Check if RewriteRule matches given DNS name; that is, if the rewrite rule's source is a wildcard DNS name, it is checked whether that wildcard name matches host (note that in that case, host may be a - less specific - wildcard pattern itself); otherwise, just check for equality of the rewrite rule's source and host.

func (*RewriteRule) Owner

func (r *RewriteRule) Owner() string

Return owner of a RewriteRule

func (*RewriteRule) To

func (r *RewriteRule) To() string

Return rewrite target (to) of a RewriteRule

type RewriteRuleSet

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

Set of RewriteRule

func NewRewriteRuleSet

func NewRewriteRuleSet() *RewriteRuleSet

Create empty RewriteRuleSet; RewriteRuleSet gives the following guarantees:

  • uniquness of owners, that is, for a given owner, the set contains at most one RewriteRule with that owner
  • rewrite sources in the set are free of clashes; that is, for a given DNS name, there will be at most one RewriteRule matching that DNS name (via Matches()).

func ParseRewriteRuleSet

func ParseRewriteRuleSet(s string) (*RewriteRuleSet, error)

Parse RewriteRuleSet from a coredns config file format

func (*RewriteRuleSet) AddRule

func (rs *RewriteRuleSet) AddRule(r *RewriteRule) (bool, error)

Add RewriteRule to set; may fail if the given rule would violate the consistency guarantees of the RewriteRuleSet; the boolean return value indicates whether something changed in the set (true) or if the rule was already there (false).

func (*RewriteRuleSet) FindMatchingRule

func (rs *RewriteRuleSet) FindMatchingRule(host string) *RewriteRule

Find RewriteRule matching given DNS name; return nil if none was found; otherwise, the result is unique because of the guarantees given by RewriteRuleSet.

func (*RewriteRuleSet) GetRule

func (rs *RewriteRuleSet) GetRule(owner string) *RewriteRule

Get RewriteRule for specified owner; return nil if none was found; otherwise, the result is unique because of the guarantees given by RewriteRuleSet.

func (*RewriteRuleSet) RemoveRule

func (rs *RewriteRuleSet) RemoveRule(owner string) bool

Remove rule with given owner from set; the boolean return value indicates whether something changed in the set (true) or if no rule with that owner was existing (false).

func (*RewriteRuleSet) String

func (rs *RewriteRuleSet) String() string

Serialize RewriteRuleSet into coredns config file format

Jump to

Keyboard shortcuts

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