plugin

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RequestCount is the total number of DNS requests processed by the coresmd plugin
	RequestCount = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: "coresmd",
		Name:      "requests_total",
		Help:      "Counter of DNS requests made to the coresmd plugin.",
	}, []string{"server", "zone", "type"})

	// RequestDuration is the time taken to process DNS requests
	RequestDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
		Namespace: plugin.Namespace,
		Subsystem: "coresmd",
		Name:      "request_duration_seconds",
		Buckets:   plugin.TimeBuckets,
		Help:      "Histogram of the time (in seconds) each request took.",
	}, []string{"server", "zone"})

	// CacheHits is the number of successful cache lookups
	CacheHits = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: "coresmd",
		Name:      "cache_hits_total",
		Help:      "Counter of successful cache lookups in the coresmd plugin.",
	}, []string{"server", "zone", "record_type"})

	// CacheMisses is the number of failed cache lookups
	CacheMisses = promauto.NewCounterVec(prometheus.CounterOpts{
		Namespace: plugin.Namespace,
		Subsystem: "coresmd",
		Name:      "cache_misses_total",
		Help:      "Counter of failed cache lookups in the coresmd plugin.",
	}, []string{"server", "zone", "record_type"})

	// SMDCacheAge is the age of the SMD cache in seconds
	SMDCacheAge = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: plugin.Namespace,
		Subsystem: "coresmd",
		Name:      "smd_cache_age_seconds",
		Help:      "Age of the SMD cache in seconds.",
	}, []string{"server"})

	// SMDCacheSize is the number of entries in the SMD cache
	SMDCacheSize = promauto.NewGaugeVec(prometheus.GaugeOpts{
		Namespace: plugin.Namespace,
		Subsystem: "coresmd",
		Name:      "smd_cache_size",
		Help:      "Number of entries in the SMD cache.",
	}, []string{"server", "type"})
)

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	Next plugin.Handler
	// contains filtered or unexported fields
}

Plugin represents the coresmd plugin

func (Plugin) Health

func (p Plugin) Health() bool

func (Plugin) Name

func (p Plugin) Name() string

Name returns the plugin name

func (Plugin) OnShutdown

func (p Plugin) OnShutdown() error

func (*Plugin) OnStartup

func (p *Plugin) OnStartup() error

OnStartup is called when the plugin starts up

func (Plugin) OnStartupComplete

func (p Plugin) OnStartupComplete() error

func (Plugin) Ready

func (p Plugin) Ready() bool

Ready checks if the plugin's cache is initialized, has been updated at least once (i.e., LastUpdated is non-zero), and is not older than 5 minutes. It implements the ready.Readiness interface (Ready() bool) for https://coredns.io/plugins/ready/. Returns true if the cache is ready, otherwise false.

func (Plugin) ServeDNS

func (p Plugin) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

ServeDNS handles DNS requests for the coresmd plugin

type Zone

type Zone struct {
	Name        string // Zone name (e.g., "cluster.local")
	NodePattern string // Pattern for node records (e.g., "nid{04d}.cluster.local")
}

Zone represents a DNS zone configuration

type ZoneManager

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

ZoneManager handles zone operations and record lookups

func NewZoneManager

func NewZoneManager(zones []Zone) *ZoneManager

NewZoneManager creates a new zone manager

func (*ZoneManager) FindZone

func (zm *ZoneManager) FindZone(domain string) *Zone

FindZone finds the appropriate zone for a given domain name

Jump to

Keyboard shortcuts

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