dnsnameresolver

package
v0.0.0-...-e0f77fc Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEgressFirewallDNSAddrSetDbIDs

func GetEgressFirewallDNSAddrSetDbIDs(dnsName, controller string) *libovsdbops.DbObjectIDs

Types

type DNSNameResolver

type DNSNameResolver interface {
	Add(namespace, dnsName string) (addressset.AddressSet, error)
	Delete(namespace string) error
	Run() error
	Shutdown()
	DeleteStaleAddrSets(nbClient libovsdbclient.Client) error
}

type EgressDNS

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

func NewEgressDNS

func NewEgressDNS(addressSetFactory addressset.AddressSetFactory, controllerName string,
	controllerStop <-chan struct{}, defaultInterval time.Duration) (*EgressDNS, error)

func (*EgressDNS) Add

func (e *EgressDNS) Add(namespace, dnsName string) (addressset.AddressSet, error)

func (*EgressDNS) Delete

func (e *EgressDNS) Delete(namespace string) error

func (*EgressDNS) DeleteStaleAddrSets

func (e *EgressDNS) DeleteStaleAddrSets(nbClient libovsdbclient.Client) error

DeleteStaleAddrSets deletes all the address sets related to EgressFirewall DNS rules which are not referenced by any acl.

func (*EgressDNS) Run

func (e *EgressDNS) Run() error

Run spawns a goroutine that handles updates to the dns entries for domain names used in EgressFirewalls. The loop runs after receiving one of three signals:

  1. time.NewTicker(durationTillNextQuery) times out and the dnsName with the lowest ttl is checked and the durationTillNextQuery is updated
  2. e.added is received and durationTillNextQuery is recomputed
  3. e.deleted is received and coincides with dnsName

func (*EgressDNS) Shutdown

func (e *EgressDNS) Shutdown()

func (*EgressDNS) Update

func (e *EgressDNS) Update(dnsName string) (bool, error)

type ExternalEgressDNS

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

ExternalEgressDNS keeps track of DNS names and the corresponding IP addresses. For each DNS name, an address set is allocated and the address set is kept updated with the corresponding IP addresses. Whenever a DNS name is removed the corresponding addresset is destroyed.

func NewExternalEgressDNS

func NewExternalEgressDNS(
	addressSetFactory addressset.AddressSetFactory,
	controllerName string,
	ignoreClusterSubnet bool,
	dnsSharedIndexInformer cache.SharedIndexInformer,
	efLister egressfirewalllister.EgressFirewallLister,
) (*ExternalEgressDNS, error)

NewExternalEgressDNS initializes and returns a new ExternalEgressDNS instance.

func (*ExternalEgressDNS) Add

func (extEgDNS *ExternalEgressDNS) Add(namespace, dnsName string) (addressset.AddressSet, error)

Add adds the namespace to the set of namespaces where the DNS name is used in the EgressFirewall rules. It also returns the address set corresponding to the DNS name. The address set may be empty at this point if the corresponding DNSNameResolver object's status is still not updated with the associated IP addresses.

func (*ExternalEgressDNS) Delete

func (extEgDNS *ExternalEgressDNS) Delete(namespace string) error

Delete removes the namespace from the set of namespaces where the DNS name is used in the EgressFirewall rules.

func (*ExternalEgressDNS) DeleteStaleAddrSets

func (extEgDNS *ExternalEgressDNS) DeleteStaleAddrSets(nbClient libovsdbclient.Client) error

DeleteStaleAddrSets deletes all the address sets related to EgressFirewall DNS rules which are not referenced by any acl.

func (*ExternalEgressDNS) Run

func (extEgDNS *ExternalEgressDNS) Run() error

Run starts the DNSNameResolver controller.

func (*ExternalEgressDNS) Shutdown

func (extEgDNS *ExternalEgressDNS) Shutdown()

Shutdown stops the DNSNameResolver controller.

Jump to

Keyboard shortcuts

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