namemanager

package
v1.18.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2025 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const DNSGCJobInterval = 1 * time.Minute

Variables

View Source
var (
	DNSSourceLookup     = "lookup"
	DNSSourceConnection = "connection"
)
View Source
var Cell = cell.Module(
	"namemanager",
	"maintains DNS mappings to implement toFQDN policy",

	cell.ProvidePrivate(func(dc *option.DaemonConfig) NameManagerConfig {
		return NameManagerConfig{
			MinTTL:            dc.ToFQDNsMinTTL,
			DNSProxyLockCount: dc.DNSProxyLockCount,
			StateDir:          dc.StateDir,
		}
	}),
	cell.ProvidePrivate(adaptors),
	cell.Provide(newForCell),

	cell.ProvidePrivate(New),
	cell.Provide(handlers),
)

Functions

func New

func New(params ManagerParams) *manager

New creates an initialized NameManager.

Types

type ManagerParams

type ManagerParams struct {
	cell.In

	Config  NameManagerConfig
	IPCache ipc
	EPMgr   endpoints
}

type NameManager

type NameManager interface {
	// RegisterFQDNSelector exposes this FQDNSelector so that the identity labels
	// of IPs contained in a DNS response that matches said selector can be
	// associated with that selector.
	// This function also evaluates if any DNS names in the cache are matched by
	// this new selector and updates the labels for those DNS names accordingly.
	RegisterFQDNSelector(selector api.FQDNSelector)

	// UnregisterFQDNSelector removes this FQDNSelector from the set of
	// IPs which are being tracked by the identityNotifier. The result
	// of this is that an IP may be evicted from IPCache if it is no longer
	// selected by any other FQDN selector.
	UnregisterFQDNSelector(selector api.FQDNSelector)
	// UpdateGenerateDNS inserts the new DNS information into the cache. If the IPs
	// have changed for a name they will be reflected in updatedDNSIPs.
	UpdateGenerateDNS(ctx context.Context, lookupTime time.Time, name string, record *fqdn.DNSIPRecords) <-chan error

	// LockName is used to serialize  parallel end-to-end updates to the same name.
	LockName(name string)
	// UnlockName releases a lock previously acquired by LockName()
	UnlockName(name string)

	StartGC(context.Context)
	// RestoreCache loads cache state from the restored system:
	// - adds any pre-cached DNS entries
	// - repopulates the cache from the (persisted) endpoint DNS cache and zombies
	RestoreCache(preCachePath string, eps map[uint16]*endpoint.Endpoint)
	CompleteBootstrap()
}

The NameManager maintains DNS mappings which need to be tracked, due to FQDNSelectors. It is the main structure which relates the FQDN subsystem to the policy subsystem for plumbing the relation between a DNS name and the corresponding IPs which have been returned via DNS lookups. Name to IP mappings are inserted into the ipcache.

type NameManagerConfig

type NameManagerConfig struct {
	// MinTTL is the minimum TTL value that a cache entry can have.
	MinTTL int

	// DNSProxyLockCount is used to shard serialization of updates to DNS names.
	DNSProxyLockCount int

	// StateDir is the directory where namemanager checkpoints are stored.
	StateDir string
}

type NoEndpointIDMatch

type NoEndpointIDMatch struct {
	ID string
}

func (NoEndpointIDMatch) Error

func (e NoEndpointIDMatch) Error() string

Jump to

Keyboard shortcuts

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