config

package
v0.0.0-...-df76fe3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 23 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The inclusion of TypeMeta is to ensure future compatibility if the
	// Config object was populated directly via a Kubernetes API mechanism.
	//
	// For example, instead of the custom implementation here, the
	// configuration could be obtained from an API that unifies
	// command-line flags, config-map, etc mechanisms.
	types.TypeMeta

	// Map of federation names that the cluster in which this kube-dns
	// is running belongs to, to the corresponding domain names.
	Federations map[string]string `json:"federations"`

	// Map of stub domain to nameserver IP. The key is the domain name suffix,
	// e.g. "acme.local". Key cannot be equal to the cluster domain. Value is
	// the IP of the nameserver to send DNS request for the given subdomain.
	StubDomains map[string][]string `json:"stubDomains"`

	// List of upstream nameservers to use. Overrides nameservers inherited
	// from the node.
	UpstreamNameservers []string `json:"upstreamNameservers"`
}

Config populated either from the configuration source (command line flags or via the config map mechanism).

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) Validate

func (config *Config) Validate() error

Validate returns whether or not the configuration is valid.

func (*Config) ValidateNodeLocalCacheConfig

func (config *Config) ValidateNodeLocalCacheConfig() error

ValidateNodeLocalCacheConfig returns nil if the config can be compiled to a valid Corefile.

type MockSync

type MockSync struct {
	// Config that will be returned from Once().
	Config *Config
	// Error that will be returned from Once().
	Error error

	// Chan to send new configurations on.
	Chan chan *Config
}

MockSync is a testing mock.

func NewMockSync

func NewMockSync(config *Config, error error) *MockSync

func (*MockSync) Once

func (sync *MockSync) Once() (*Config, error)

func (*MockSync) Periodic

func (sync *MockSync) Periodic() <-chan *Config

type Sync

type Sync interface {
	// Once does a blocking synchronization of the config map. If the
	// ConfigMap fails to validate, this method will return nil, err.
	Once() (*Config, error)

	// Start a periodic synchronization of the configuration map. When a
	// successful configuration map update is detected, the
	// configuration will be sent to the channel.
	//
	// It is an error to call this more than once.
	Periodic() <-chan *Config
}

Sync manages synchronization of the config map.

func NewConfigMapSync

func NewConfigMapSync(client kubernetes.Interface, ns string, name string) Sync

NewConfigMapSync returns a Sync that watches a config map in the API

func NewFileSync

func NewFileSync(dir string, period time.Duration) Sync

NewFileSync returns a Sync that scans the given dir periodically for config data

func NewNopSync

func NewNopSync(config *Config) Sync

Jump to

Keyboard shortcuts

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