dns

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package dns provides utilities for detecting Kubernetes DNS configuration.

Index

Constants

View Source
const (
	// DefaultClusterDomain is the default Kubernetes cluster domain.
	DefaultClusterDomain = "cluster.local"

	// ResolvConfPath is the default path to resolv.conf.
	ResolvConfPath = "/etc/resolv.conf"
)

Variables

This section is empty.

Functions

func DetectClusterDomain

func DetectClusterDomain() (string, bool)

DetectClusterDomain attempts to detect the Kubernetes cluster domain from /etc/resolv.conf search domains.

It looks for a search domain matching the pattern "*.svc.<domain>" and extracts the cluster domain suffix.

Returns the detected domain and true if successful, or empty string and false if detection failed.

func DetectClusterDomainFromFile

func DetectClusterDomainFromFile(path string) (string, bool)

DetectClusterDomainFromFile reads resolv.conf from a given path and extracts the cluster domain from search domains. Exported for testing purposes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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