dns

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearDNSToken

func ClearDNSToken(ctx context.Context, client kclient.Client, dnsSecret *corev1.Secret) error

ClearDNSToken deletes the token used to authenticate to the AcornDNS service.

func IsDomainAuthError

func IsDomainAuthError(err error) bool

IsDomainAuthError checks if the error is a DomainAuthError

Types

type AuthErrorResponse

type AuthErrorResponse struct {
	Status  int           `json:"status,omitempty"`
	Message string        `json:"msg,omitempty"`
	Data    authErrorData `json:"data,omitempty"`
}

type AuthFailedNoDomainError

type AuthFailedNoDomainError struct{}

AuthFailedNoDomainError indicates that a request failed authentication because the domain was not found. If encountered, we'll need to reserve a new domain.

func (AuthFailedNoDomainError) Error

func (e AuthFailedNoDomainError) Error() string

Error implements the Error interface

type Client

type Client interface {

	// ReserveDomain calls AcornDNS to reserve a new domain. It returns the domain, a token for authentication,
	// and an error
	ReserveDomain(endpoint string) (string, string, error)

	// CreateRecords calls AcornDNS to create dns records based on the supplied RecordRequests for the specified domain
	CreateRecords(endpoint, domain, token string, records []RecordRequest) error

	// Renew calls AcornDNS to renew the domain and the records specified in the renewRequest. The response will contain
	// "out of sync" records, which are records that AcornDNS either doesn't know about or has different values for
	Renew(endpoint, domain, token string, renew RenewRequest) (RenewResponse, error)

	// DeleteRecord calls AcornDNS to delete the record(s) associated with the supplied prefix
	DeleteRecord(endpoint, domain, recordPrefix, token string) error

	// PurgeRecords calls AcornDNS to purge all records for the given domain, but doesn't delete the domain itself
	PurgeRecords(endpoint, domain, token string) error
}

Client handles interactions with the AcornDNS API service and Acorn.

func NewClient

func NewClient() Client

NewClient creates a new AcornDNS client

type Daemon

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

func NewDaemon

func NewDaemon(client kclient.Client) *Daemon

func (*Daemon) RenewAndSync

func (d *Daemon) RenewAndSync(ctx context.Context)

RenewAndSync will renew the cluster's AcornDNS domain and corresponding records. It sends each ingress's full record (fqdn, type, values). In addition to renewing the records, the DNS service will return "out of sync" records that either don't exist or have different values on the DNS service side. This function will cause the ingresses for such records to resync.

Retries on an exponential backoff until successful

type DomainResponse

type DomainResponse struct {
	Name  string `json:"name,omitempty"`
	Token string `json:"token,omitempty"`
}

type FQDNTypePair

type FQDNTypePair struct {
	FQDN string `json:"fqdn,omitempty"`
	Type string `json:"type,omitempty"`
}

type RecordRequest

type RecordRequest struct {
	Name   string     `json:"name,omitempty"`
	Type   RecordType `json:"type,omitempty"`
	Values []string   `json:"values,omitempty"`
}

func ToRecordRequestsAndHash

func ToRecordRequestsAndHash(domain string, ingress *v1.Ingress) ([]RecordRequest, string)

ToRecordRequestsAndHash creates wildcard DNS records based on the ingress and domain supplied. It also returns a hash of those records, suitable for using over time to determine if the ingress's records need to change.

type RecordResponse

type RecordResponse struct {
	RecordRequest
	FQDN string `json:"fqdn,omitempty"`
}

type RecordType

type RecordType string
const (
	RecordTypeA     RecordType = "A"
	RecordTypeAAAA  RecordType = "AAAA"
	RecordTypeCname RecordType = "CNAME"
	RecordTypeTxt   RecordType = "TXT"
)

func (RecordType) IsValid

func (rt RecordType) IsValid() error

type RenewRequest

type RenewRequest struct {
	Records []RecordRequest `json:"records,omitempty"`
	Version string          `json:"version,omitempty"`
}

type RenewResponse

type RenewResponse struct {
	Name             string         `json:"name,omitempty"`
	OutOfSyncRecords []FQDNTypePair `json:"outOfSyncRecords,omitempty"`
}

Jump to

Keyboard shortcuts

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