provider

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AWS_CONTINENT_CODE_AFRICA        = "AF"
	AWS_CONTINENT_CODE_ANTARTICA     = "AN"
	AWS_CONTINENT_CODE_ASIA          = "AS"
	AWS_CONTINENT_CODE_EUROPE        = "EU"
	AWS_CONTINENT_CODE_OCEANIA       = "OC"
	AWS_CONTINENT_CODE_NORTH_AMERICA = "NA"
	AWS_CONTINENT_CODE_SOUTH_AMERICA = "SA"
)

Variables

View Source
var (
	ErrNoZoneForHost = fmt.Errorf("no zone for host")
)

Functions

func GetExternalAddresses added in v0.2.0

func GetExternalAddresses(endpoint *externaldns.Endpoint, dnsRecord *v1alpha1.DNSRecord) (externalAddresses []string)

func GetISO3166Alpha2Codes

func GetISO3166Alpha2Codes() []string

func IsContinentCode added in v0.7.0

func IsContinentCode(code string) bool

func IsExternalAddress added in v0.2.0

func IsExternalAddress(address string, dnsRecord *v1alpha1.DNSRecord) bool

func IsISO3166Alpha2Code

func IsISO3166Alpha2Code(code string) bool

IsISO3166Alpha2Code returns true if it's a valid ISO_3166 Alpha 2 country code (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)

func NameForProviderSecret added in v0.4.1

func NameForProviderSecret(secret *v1.Secret) (string, error)

func RegisterProvider

func RegisterProvider(name string, c ProviderConstructor, asDefault bool)

RegisterProvider will register a provider constructor, so it can be used within the application. 'name' should be unique, and should be used to identify this provider `asDefault` indicates if the provider should be added as a default provider and included in the default providers list.

func RegisteredDefaultProviders added in v0.4.1

func RegisteredDefaultProviders() []string

func SanitizeError

func SanitizeError(err error) error

SanitizeError removes request specific data from error messages in order to make them consistent across multiple similar requests to the provider. e.g AWS SDK Request ids `request id: 051c860b-9b30-4c19-be1a-1280c3e9fdc4`

Types

type CachedHealthCheckReconciler added in v0.2.0

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

func NewCachedHealthCheckReconciler added in v0.2.0

func NewCachedHealthCheckReconciler(provider Provider, reconciler HealthCheckReconciler) *CachedHealthCheckReconciler

func (*CachedHealthCheckReconciler) Delete added in v0.2.0

Delete implements HealthCheckReconciler

func (*CachedHealthCheckReconciler) HealthCheckExists added in v0.3.0

func (r *CachedHealthCheckReconciler) HealthCheckExists(ctx context.Context, probeStatus *v1alpha1.HealthCheckStatusProbe) (bool, error)

func (*CachedHealthCheckReconciler) Reconcile added in v0.2.0

Reconcile implements HealthCheckReconciler

type Config added in v0.2.0

type Config struct {
	// only consider hosted zones managing domains ending in this suffix
	DomainFilter externaldnsendpoint.DomainFilter
	// filter for zones based on visibility
	ZoneTypeFilter externaldnsprovider.ZoneTypeFilter
	// only consider hosted zones ending with this zone id
	ZoneIDFilter externaldnsprovider.ZoneIDFilter
}

type DNSZone added in v0.5.0

type DNSZone struct {
	ID          string
	DNSName     string
	NameServers []*string
	RecordCount int64
}

func FindDNSZoneForHost added in v0.5.0

func FindDNSZoneForHost(ctx context.Context, host string, zones []DNSZone) (*DNSZone, error)

FindDNSZoneForHost finds the most suitable zone for the given host in the given list of DNSZones

type Factory

type Factory interface {
	ProviderFor(context.Context, v1alpha1.ProviderAccessor, Config) (Provider, error)
}

Factory is an interface that can be used to obtain Provider implementations. It determines which provider implementation to use by introspecting the given ProviderAccessor resource.

func NewFactory

func NewFactory(c client.Client, p []string) (Factory, error)

NewFactory returns a new provider factory with the given client and given providers enabled. Will return an error if any given provider has no registered provider implementation.

type FakeHealthCheckReconciler added in v0.2.0

type FakeHealthCheckReconciler struct{}

func (*FakeHealthCheckReconciler) Delete added in v0.2.0

func (*FakeHealthCheckReconciler) HealthCheckExists added in v0.3.0

func (*FakeHealthCheckReconciler) HealthCheckExists(ctx context.Context, probeStatus *v1alpha1.HealthCheckStatusProbe) (bool, error)

func (*FakeHealthCheckReconciler) Reconcile added in v0.2.0

type HealthCheckProtocol added in v0.2.0

type HealthCheckProtocol string
const HealthCheckProtocolHTTP HealthCheckProtocol = "HTTP"
const HealthCheckProtocolHTTPS HealthCheckProtocol = "HTTPS"

type HealthCheckReconciler added in v0.2.0

type HealthCheckReconciler interface {
	Reconcile(ctx context.Context, spec HealthCheckSpec, endpoint *externaldns.Endpoint, probeStatus *v1alpha1.HealthCheckStatusProbe, address string) HealthCheckResult
	Delete(ctx context.Context, endpoint *externaldns.Endpoint, probeStatus *v1alpha1.HealthCheckStatusProbe) (HealthCheckResult, error)
	HealthCheckExists(ctx context.Context, probeStatus *v1alpha1.HealthCheckStatusProbe) (bool, error)
}

type HealthCheckReconciliationResult added in v0.2.0

type HealthCheckReconciliationResult string
const (
	HealthCheckCreated HealthCheckReconciliationResult = "Created"
	HealthCheckUpdated HealthCheckReconciliationResult = "Updated"
	HealthCheckDeleted HealthCheckReconciliationResult = "Deleted"
	HealthCheckNoop    HealthCheckReconciliationResult = "Noop"
	HealthCheckFailed  HealthCheckReconciliationResult = "Failed"
)

type HealthCheckResult added in v0.2.0

type HealthCheckResult struct {
	Result    HealthCheckReconciliationResult
	ID        string
	IPAddress string
	Host      string
	Condition metav1.Condition
}

func NewHealthCheckResult added in v0.2.0

func NewHealthCheckResult(result HealthCheckReconciliationResult, id, ipaddress, host string, condition metav1.Condition) HealthCheckResult

type HealthCheckSpec added in v0.2.0

type HealthCheckSpec struct {
	Id               string
	Name             string
	Port             *int64
	FailureThreshold *int64
	Protocol         *HealthCheckProtocol
	Host             *string
	Path             string
}

type Provider

type Provider interface {
	externaldnsprovider.Provider

	// DNSZones returns a list of dns zones accessible for this provider
	DNSZones(ctx context.Context) ([]DNSZone, error)

	// DNSZoneForHost returns the DNSZone that best matches the given host in the providers list of zones
	DNSZoneForHost(ctx context.Context, host string) (*DNSZone, error)

	// HealthCheckReconciler Get an instance of HealthCheckReconciler for this provider
	HealthCheckReconciler() HealthCheckReconciler

	ProviderSpecific() ProviderSpecificLabels
}

Provider knows how to manage DNS zones only as pertains to routing.

type ProviderConstructor

type ProviderConstructor func(context.Context, *v1.Secret, Config) (Provider, error)

ProviderConstructor constructs a provider given a Secret resource and a Context. An error will be returned if the appropriate provider is not registered.

type ProviderSpecificLabels

type ProviderSpecificLabels struct {
	Weight        string
	HealthCheckID string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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