resolver

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package resolver provides hostname to CloudflareDomain resolution using longest suffix match.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomainInfo

type DomainInfo struct {
	// Domain is the domain name
	Domain string
	// ZoneID is the Cloudflare Zone ID
	ZoneID string
	// AccountID is the Cloudflare Account ID
	AccountID string
	// CredentialsRef is the reference to CloudflareCredentials (optional)
	CredentialsRef *networkingv1alpha2.CredentialsReference
	// CloudflareDomainName is the name of the CloudflareDomain resource
	CloudflareDomainName string
}

DomainInfo contains resolved domain information for DNS operations

type DomainResolver

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

DomainResolver resolves hostnames to CloudflareDomain resources using longest suffix match. It provides Zone ID lookup for DNS operations across all controllers.

func NewDomainResolver

func NewDomainResolver(client client.Client, log logr.Logger) *DomainResolver

NewDomainResolver creates a new DomainResolver

func (*DomainResolver) GetDefaultDomain

func (r *DomainResolver) GetDefaultDomain(ctx context.Context) (*DomainInfo, error)

GetDefaultDomain returns the default CloudflareDomain if one exists

func (*DomainResolver) GetZoneID

func (r *DomainResolver) GetZoneID(ctx context.Context, hostname string) (string, error)

GetZoneID is a convenience method to get just the Zone ID for a hostname. Returns empty string if no matching domain is found.

func (*DomainResolver) InvalidateCache

func (r *DomainResolver) InvalidateCache()

InvalidateCache invalidates the domain cache, forcing a refresh on next Resolve call

func (*DomainResolver) ListDomains

ListDomains returns all CloudflareDomain resources (refreshes cache if needed)

func (*DomainResolver) MustResolve

func (r *DomainResolver) MustResolve(ctx context.Context, hostname string) (*DomainInfo, error)

MustResolve resolves a hostname and returns an error if no matching domain is found.

func (*DomainResolver) Resolve

func (r *DomainResolver) Resolve(ctx context.Context, hostname string) (*DomainInfo, error)

Resolve finds the best matching CloudflareDomain for a hostname. It uses longest suffix match: for "api.staging.example.com": - "example.com" matches (suffix) - "staging.example.com" matches better (longer suffix)

Returns nil if no matching domain is found.

func (*DomainResolver) ResolveMultiple

func (r *DomainResolver) ResolveMultiple(ctx context.Context, hostnames []string) (map[string]*DomainInfo, error)

ResolveMultiple resolves multiple hostnames and returns a map of hostname to DomainInfo. This is useful for batch operations like Ingress reconciliation.

Jump to

Keyboard shortcuts

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