provider

package
v0.5.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: Apache-2.0 Imports: 45 Imported by: 34

Documentation

Index

Constants

View Source
const (
	// DigitalOceanCreate is a ChangeAction enum value
	DigitalOceanCreate = "CREATE"
	// DigitalOceanDelete is a ChangeAction enum value
	DigitalOceanDelete = "DELETE"
	// DigitalOceanUpdate is a ChangeAction enum value
	DigitalOceanUpdate = "UPDATE"
)
View Source
const (

	// PdnsDelete : PowerDNS changetype used for deleting rrsets
	// ref: https://doc.powerdns.com/authoritative/http-api/zone.html#rrset (see "changetype")
	PdnsDelete pdnsChangeType = "DELETE"
	// PdnsReplace : PowerDNS changetype for creating, updating and patching rrsets
	PdnsReplace pdnsChangeType = "REPLACE"
)

Variables

View Source
var (
	// ErrZoneAlreadyExists error returned when zone cannot be created when it already exists
	ErrZoneAlreadyExists = errors.New("specified zone already exists")
	// ErrZoneNotFound error returned when specified zone does not exists
	ErrZoneNotFound = errors.New("specified zone not found")
	// ErrRecordAlreadyExists when create request is sent but record already exists
	ErrRecordAlreadyExists = errors.New("record already exists")
	// ErrRecordNotFound when update/delete request is sent but record not found
	ErrRecordNotFound = errors.New("record not found")
	// ErrDuplicateRecordFound when record is repeated in create/update/delete
	ErrDuplicateRecordFound = errors.New("invalid batch request")
)

Functions

This section is empty.

Types

type AWSProvider

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

AWSProvider is an implementation of Provider for AWS Route53.

func NewAWSProvider

func NewAWSProvider(domainFilter DomainFilter, zoneIDFilter ZoneIDFilter, zoneTypeFilter ZoneTypeFilter, assumeRole string, dryRun bool) (*AWSProvider, error)

NewAWSProvider initializes a new AWS Route53 based Provider.

func (*AWSProvider) ApplyChanges

func (p *AWSProvider) ApplyChanges(changes *plan.Changes) error

ApplyChanges applies a given set of changes in a given zone.

func (*AWSProvider) CreateRecords

func (p *AWSProvider) CreateRecords(endpoints []*endpoint.Endpoint) error

CreateRecords creates a given set of DNS records in the given hosted zone.

func (*AWSProvider) DeleteRecords

func (p *AWSProvider) DeleteRecords(endpoints []*endpoint.Endpoint) error

DeleteRecords deletes a given set of DNS records in a given zone.

func (*AWSProvider) Records

func (p *AWSProvider) Records() (endpoints []*endpoint.Endpoint, _ error)

Records returns the list of records in a given hosted zone.

func (*AWSProvider) UpdateRecords

func (p *AWSProvider) UpdateRecords(endpoints, _ []*endpoint.Endpoint) error

UpdateRecords updates a given set of old records to a new set of records in a given hosted zone.

func (*AWSProvider) Zones

func (p *AWSProvider) Zones() (map[string]*route53.HostedZone, error)

Zones returns the list of hosted zones.

type AzureProvider added in v0.4.0

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

AzureProvider implements the DNS provider for Microsoft's Azure cloud platform.

func NewAzureProvider added in v0.4.0

func NewAzureProvider(configFile string, domainFilter DomainFilter, zoneIDFilter ZoneIDFilter, resourceGroup string, dryRun bool) (*AzureProvider, error)

NewAzureProvider creates a new Azure provider.

Returns the provider or an error if a provider could not be created.

func (*AzureProvider) ApplyChanges added in v0.4.0

func (p *AzureProvider) ApplyChanges(changes *plan.Changes) error

ApplyChanges applies the given changes.

Returns nil if the operation was successful or an error if the operation failed.

func (*AzureProvider) Records added in v0.4.0

func (p *AzureProvider) Records() (endpoints []*endpoint.Endpoint, _ error)

Records gets the current records.

Returns the current records or an error if the operation failed.

type CloudFlareProvider added in v0.4.0

type CloudFlareProvider struct {
	Client cloudFlareDNS

	DryRun bool
	// contains filtered or unexported fields
}

CloudFlareProvider is an implementation of Provider for CloudFlare DNS.

func NewCloudFlareProvider added in v0.4.0

func NewCloudFlareProvider(domainFilter DomainFilter, zoneIDFilter ZoneIDFilter, proxied bool, dryRun bool) (*CloudFlareProvider, error)

NewCloudFlareProvider initializes a new CloudFlare DNS based Provider.

func (*CloudFlareProvider) ApplyChanges added in v0.4.0

func (p *CloudFlareProvider) ApplyChanges(changes *plan.Changes) error

ApplyChanges applies a given set of changes in a given zone.

func (*CloudFlareProvider) Records added in v0.4.0

func (p *CloudFlareProvider) Records() ([]*endpoint.Endpoint, error)

Records returns the list of records.

func (*CloudFlareProvider) Zones added in v0.4.0

func (p *CloudFlareProvider) Zones() ([]cloudflare.Zone, error)

Zones returns the list of hosted zones.

type DigitalOceanChange added in v0.4.0

type DigitalOceanChange struct {
	Action            string
	ResourceRecordSet godo.DomainRecord
}

DigitalOceanChange differentiates between ChangActions

type DigitalOceanProvider added in v0.4.0

type DigitalOceanProvider struct {
	Client godo.DomainsService

	DryRun bool
	// contains filtered or unexported fields
}

DigitalOceanProvider is an implementation of Provider for Digital Ocean's DNS.

func NewDigitalOceanProvider added in v0.4.0

func NewDigitalOceanProvider(domainFilter DomainFilter, dryRun bool) (*DigitalOceanProvider, error)

NewDigitalOceanProvider initializes a new DigitalOcean DNS based Provider.

func (*DigitalOceanProvider) ApplyChanges added in v0.4.0

func (p *DigitalOceanProvider) ApplyChanges(changes *plan.Changes) error

ApplyChanges applies a given set of changes in a given zone.

func (*DigitalOceanProvider) Records added in v0.4.0

func (p *DigitalOceanProvider) Records() ([]*endpoint.Endpoint, error)

Records returns the list of records in a given zone.

func (*DigitalOceanProvider) Zones added in v0.4.0

func (p *DigitalOceanProvider) Zones() ([]godo.Domain, error)

Zones returns the list of hosted zones.

type DomainFilter added in v0.4.0

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

DomainFilter holds a lists of valid domain names

func NewDomainFilter added in v0.4.0

func NewDomainFilter(domainFilters []string) DomainFilter

NewDomainFilter returns a new DomainFilter given a comma separated list of domains

func (DomainFilter) IsConfigured added in v0.5.0

func (df DomainFilter) IsConfigured() bool

IsConfigured returns true if DomainFilter is configured, false otherwise

func (DomainFilter) Match added in v0.4.0

func (df DomainFilter) Match(domain string) bool

Match checks whether a domain can be found in the DomainFilter.

type DynConfig added in v0.5.0

type DynConfig struct {
	DomainFilter  DomainFilter
	ZoneIDFilter  ZoneIDFilter
	DryRun        bool
	CustomerName  string
	Username      string
	Password      string
	MinTTLSeconds int
	AppVersion    string
	DynVersion    string
}

DynConfig hold connection parameters to dyn.com and interanl state

type GoogleProvider added in v0.4.0

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

GoogleProvider is an implementation of Provider for Google CloudDNS.

func NewGoogleProvider

func NewGoogleProvider(project string, domainFilter DomainFilter, zoneIDFilter ZoneIDFilter, dryRun bool) (*GoogleProvider, error)

NewGoogleProvider initializes a new Google CloudDNS based Provider.

func (*GoogleProvider) ApplyChanges added in v0.4.0

func (p *GoogleProvider) ApplyChanges(changes *plan.Changes) error

ApplyChanges applies a given set of changes in a given zone.

func (*GoogleProvider) CreateRecords added in v0.4.0

func (p *GoogleProvider) CreateRecords(endpoints []*endpoint.Endpoint) error

CreateRecords creates a given set of DNS records in the given hosted zone.

func (*GoogleProvider) DeleteRecords added in v0.4.0

func (p *GoogleProvider) DeleteRecords(endpoints []*endpoint.Endpoint) error

DeleteRecords deletes a given set of DNS records in a given zone.

func (*GoogleProvider) Records added in v0.4.0

func (p *GoogleProvider) Records() (endpoints []*endpoint.Endpoint, _ error)

Records returns the list of records in all relevant zones.

func (*GoogleProvider) UpdateRecords added in v0.4.0

func (p *GoogleProvider) UpdateRecords(records, oldRecords []*endpoint.Endpoint) error

UpdateRecords updates a given set of old records to a new set of records in a given hosted zone.

func (*GoogleProvider) Zones added in v0.4.0

func (p *GoogleProvider) Zones() (map[string]*dns.ManagedZone, error)

Zones returns the list of hosted zones.

type InMemoryOption added in v0.4.0

type InMemoryOption func(*InMemoryProvider)

InMemoryOption allows to extend in-memory provider

func InMemoryInitZones added in v0.4.8

func InMemoryInitZones(zones []string) InMemoryOption

InMemoryInitZones pre-seeds the InMemoryProvider with given zones

func InMemoryWithDomain added in v0.4.0

func InMemoryWithDomain(domainFilter DomainFilter) InMemoryOption

InMemoryWithDomain modifies the domain on which dns zones are filtered

func InMemoryWithLogging added in v0.4.0

func InMemoryWithLogging() InMemoryOption

InMemoryWithLogging injects logging when ApplyChanges is called

type InMemoryProvider

type InMemoryProvider struct {
	OnApplyChanges func(changes *plan.Changes)
	OnRecords      func()
	// contains filtered or unexported fields
}

InMemoryProvider - dns provider only used for testing purposes initialized as dns provider with no records

func NewInMemoryProvider

func NewInMemoryProvider(opts ...InMemoryOption) *InMemoryProvider

NewInMemoryProvider returns InMemoryProvider DNS provider interface implementation

func (*InMemoryProvider) ApplyChanges

func (im *InMemoryProvider) ApplyChanges(changes *plan.Changes) error

ApplyChanges simply modifies records in memory error checking occurs before any modifications are made, i.e. batch processing create record - record should not exist update/delete record - record should exist create/update/delete lists should not have overlapping records

func (*InMemoryProvider) CreateZone

func (im *InMemoryProvider) CreateZone(newZone string) error

CreateZone adds new zone if not present

func (*InMemoryProvider) Records

func (im *InMemoryProvider) Records() ([]*endpoint.Endpoint, error)

Records returns the list of endpoints

func (*InMemoryProvider) Zones added in v0.4.0

func (im *InMemoryProvider) Zones() map[string]string

Zones returns filtered zones as specified by domain

type InfobloxConfig added in v0.4.6

type InfobloxConfig struct {
	DomainFilter DomainFilter
	ZoneIDFilter ZoneIDFilter
	Host         string
	Port         int
	Username     string
	Password     string
	Version      string
	SSLVerify    bool
	DryRun       bool
}

InfobloxConfig clarifies the method signature

type InfobloxProvider added in v0.4.6

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

InfobloxProvider implements the DNS provider for Infoblox.

func NewInfobloxProvider added in v0.4.6

func NewInfobloxProvider(infobloxConfig InfobloxConfig) (*InfobloxProvider, error)

NewInfobloxProvider creates a new Infoblox provider.

func (*InfobloxProvider) ApplyChanges added in v0.4.6

func (p *InfobloxProvider) ApplyChanges(changes *plan.Changes) error

ApplyChanges applies the given changes.

func (*InfobloxProvider) Records added in v0.4.6

func (p *InfobloxProvider) Records() (endpoints []*endpoint.Endpoint, err error)

Records gets the current records.

type PDNSAPIClient added in v0.5.0

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

PDNSAPIClient : Struct that encapsulates all the PowerDNS specific implementation details

func (*PDNSAPIClient) ListZone added in v0.5.0

func (c *PDNSAPIClient) ListZone(zoneID string) (zone pgo.Zone, resp *http.Response, err error)

ListZone : Method returns the details of a specific zone from PowerDNS ref: https://doc.powerdns.com/authoritative/http-api/zone.html#get--servers-server_id-zones-zone_id

func (*PDNSAPIClient) ListZones added in v0.5.0

func (c *PDNSAPIClient) ListZones() (zones []pgo.Zone, resp *http.Response, err error)

ListZones : Method returns all enabled zones from PowerDNS ref: https://doc.powerdns.com/authoritative/http-api/zone.html#get--servers-server_id-zones

func (*PDNSAPIClient) PatchZone added in v0.5.0

func (c *PDNSAPIClient) PatchZone(zoneID string, zoneStruct pgo.Zone) (resp *http.Response, err error)

PatchZone : Method used to update the contents of a particular zone from PowerDNS ref: https://doc.powerdns.com/authoritative/http-api/zone.html#patch--servers-server_id-zones-zone_id

type PDNSAPIProvider added in v0.5.0

type PDNSAPIProvider interface {
	ListZones() ([]pgo.Zone, *http.Response, error)
	ListZone(zoneID string) (pgo.Zone, *http.Response, error)
	PatchZone(zoneID string, zoneStruct pgo.Zone) (*http.Response, error)
}

PDNSAPIProvider : Interface used and extended by the PDNSAPIClient struct as well as mock APIClients used in testing

type PDNSProvider added in v0.5.0

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

PDNSProvider is an implementation of the Provider interface for PowerDNS

func NewPDNSProvider added in v0.5.0

func NewPDNSProvider(server string, apikey string, domainFilter DomainFilter, dryRun bool) (*PDNSProvider, error)

NewPDNSProvider initializes a new PowerDNS based Provider.

func (*PDNSProvider) ApplyChanges added in v0.5.0

func (p *PDNSProvider) ApplyChanges(changes *plan.Changes) error

ApplyChanges takes a list of changes (endpoints) and updates the PDNS server by sending the correct HTTP PATCH requests to a matching zone

func (*PDNSProvider) ConvertEndpointsToZones added in v0.5.0

func (p *PDNSProvider) ConvertEndpointsToZones(eps []*endpoint.Endpoint, changetype pdnsChangeType) (zonelist []pgo.Zone, _ error)

ConvertEndpointsToZones marshals endpoints into pdns compatible Zone structs

func (*PDNSProvider) Records added in v0.5.0

func (p *PDNSProvider) Records() (endpoints []*endpoint.Endpoint, _ error)

Records returns all DNS records controlled by the configured PDNS server (for all zones)

type Provider

type Provider interface {
	Records() ([]*endpoint.Endpoint, error)
	ApplyChanges(changes *plan.Changes) error
}

Provider defines the interface DNS providers should implement.

func NewDesignateProvider added in v0.5.0

func NewDesignateProvider(domainFilter DomainFilter, dryRun bool) (Provider, error)

NewDesignateProvider is a factory function for OpenStack designate providers

func NewDnsimpleProvider added in v0.4.6

func NewDnsimpleProvider(domainFilter DomainFilter, zoneIDFilter ZoneIDFilter, dryRun bool) (Provider, error)

NewDnsimpleProvider initializes a new Dnsimple based provider

func NewDynProvider added in v0.5.0

func NewDynProvider(config DynConfig) (Provider, error)

NewDynProvider initializes a new Dyn Provider.

type RecordsClient added in v0.4.0

type RecordsClient interface {
	ListByDNSZone(resourceGroupName string, zoneName string, top *int32) (result dns.RecordSetListResult, err error)
	ListByDNSZoneNextResults(list dns.RecordSetListResult) (result dns.RecordSetListResult, err error)
	Delete(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType dns.RecordType, ifMatch string) (result autorest.Response, err error)
	CreateOrUpdate(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType dns.RecordType, parameters dns.RecordSet, ifMatch string, ifNoneMatch string) (result dns.RecordSet, err error)
}

RecordsClient is an interface of dns.RecordClient that can be stubbed for testing.

type Route53API

type Route53API interface {
	ListResourceRecordSetsPages(input *route53.ListResourceRecordSetsInput, fn func(resp *route53.ListResourceRecordSetsOutput, lastPage bool) (shouldContinue bool)) error
	ChangeResourceRecordSets(*route53.ChangeResourceRecordSetsInput) (*route53.ChangeResourceRecordSetsOutput, error)
	CreateHostedZone(*route53.CreateHostedZoneInput) (*route53.CreateHostedZoneOutput, error)
	ListHostedZonesPages(input *route53.ListHostedZonesInput, fn func(resp *route53.ListHostedZonesOutput, lastPage bool) (shouldContinue bool)) error
}

Route53API is the subset of the AWS Route53 API that we actually use. Add methods as required. Signatures must match exactly. mostly taken from: https://github.com/kubernetes/kubernetes/blob/853167624edb6bc0cfdcdfb88e746e178f5db36c/federation/pkg/dnsprovider/providers/aws/route53/stubs/route53api.go

type ZoneChange added in v0.5.0

type ZoneChange struct {
	ID     int              `json:"id"`
	UserID int              `json:"user_id"`
	Zone   string           `json:"zone"`
	FQDN   string           `json:"FQDN"`
	Serial int              `json:"serial"`
	TTL    int              `json:"ttl"`
	Type   string           `json:"rdata_type"`
	RData  dynect.DataBlock `json:"rdata"`
}

ZoneChange is missing from dynect: https://help.dyn.com/get-zone-changeset-api/

type ZoneChangesResponse added in v0.5.0

type ZoneChangesResponse struct {
	dynect.ResponseBlock
	Data []ZoneChange `json:"data"`
}

ZoneChangesResponse is missing from dynect: https://help.dyn.com/get-zone-changeset-api/

type ZoneIDFilter added in v0.5.0

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

ZoneIDFilter holds a list of zone ids to filter by

func NewZoneIDFilter added in v0.5.0

func NewZoneIDFilter(zoneIDs []string) ZoneIDFilter

NewZoneIDFilter returns a new ZoneIDFilter given a list of zone ids

func (ZoneIDFilter) Match added in v0.5.0

func (f ZoneIDFilter) Match(zoneID string) bool

Match checks whether a zone matches one of the provided zone ids

type ZonePublisResponse added in v0.5.0

type ZonePublisResponse struct {
	dynect.ResponseBlock
	Data map[string]interface{} `json:"data"`
}

ZonePublisResponse holds the status after publish

type ZonePublishRequest added in v0.5.0

type ZonePublishRequest struct {
	Publish bool   `json:"publish"`
	Notes   string `json:"notes"`
}

ZonePublishRequest is missing from dynect but the notes field is a nice place to let external-dns report some internal info during commit

type ZoneTypeFilter added in v0.4.5

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

ZoneTypeFilter holds a zone type to filter for.

func NewZoneTypeFilter added in v0.4.5

func NewZoneTypeFilter(zoneType string) ZoneTypeFilter

NewZoneTypeFilter returns a new ZoneTypeFilter given a zone type to filter for.

func (ZoneTypeFilter) Match added in v0.4.5

func (f ZoneTypeFilter) Match(zone *route53.HostedZone) bool

Match checks whether a zone matches the zone type that's filtered for.

type ZonesClient added in v0.4.0

type ZonesClient interface {
	ListByResourceGroup(resourceGroupName string, top *int32) (result dns.ZoneListResult, err error)
	ListByResourceGroupNextResults(lastResults dns.ZoneListResult) (result dns.ZoneListResult, err error)
}

ZonesClient is an interface of dns.ZoneClient that can be stubbed for testing.

Jump to

Keyboard shortcuts

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