config

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Metrics defines the metrics configurations
	Metrics MetricsConfig `env:", prefix=EPHEMERAL_METRICS_"`
	// Log defines the logs configurations
	Log LogConfig `env:", prefix=EPHEMERAL_LOG_"`
	// Controller defines the controller configurations
	Controller ControllerConfig `env:", prefix=EPHEMERAL_CONTROLLER_"`
	Plugin     PluginConfig     `env:", prefix=EPHEMERAL_PLUGIN_"`
}

Config defines all configurations available for this controller

func (*Config) ControllerEnableHTTP2

func (c *Config) ControllerEnableHTTP2() bool

ControllerEnableHTTP2 acessor method

func (*Config) ControllerHealthProbeAddr

func (c *Config) ControllerHealthProbeAddr() string

ControllerHealthProbeAddr acessor method

func (*Config) ControllerPort

func (c *Config) ControllerPort() int

ControllerPort acessor method

func (*Config) ControllerRequeueInterval

func (c *Config) ControllerRequeueInterval() time.Duration

ControllerRequeueInterval acessor method

func (*Config) EnableLeaderElection

func (c *Config) EnableLeaderElection() bool

EnableLeaderElection acessor method

func (*Config) LogFormat

func (c *Config) LogFormat() string

LogFormat acessor method

func (*Config) LogLevel

func (c *Config) LogLevel() string

LogLevel acessor method

func (*Config) MetricsAddress

func (c *Config) MetricsAddress() string

MetricsAddress acessor method

func (*Config) MetricsSecure

func (c *Config) MetricsSecure() bool

MetricsSecure acessor method

func (*Config) PluginPath

func (c *Config) PluginPath() string

PluginPath acessor method

func (*Config) String

func (c *Config) String() string

String prints the config state

type Configurer

Configurer defines the accessor methods for all configurations that can be provided externally to the ephemeral access controller process. The main purpose behind this interface is to ensure that externally provided configuration can not be changed once retrieved.

func ReadEnvConfigs

func ReadEnvConfigs() (Configurer, error)

ReadEnvConfigs will read all environment variables as defined in the Config struct and return a Configurer interface which provides accessor methods for all configurations.

type ControllerConfig

type ControllerConfig struct {
	// Port The controller main port for routes such as pprof
	Port int `env:"PORT, default=8081"`
	// EnableLeaderElection Enable leader election for controller manager.
	// Enabling this will ensure there is only one active controller manager.
	EnableLeaderElection bool `env:"ENABLE_LEADER_ELECTION, default=false"`
	// HealthProbeAddr The address the probe endpoint binds to.
	HealthProbeAddr string `env:"HEALTH_PROBE_ADDR, default=:8082"`
	// EnableHTTP2 If set, HTTP/2 will be enabled for the metrics and webhook
	// servers.
	EnableHTTP2 bool `env:"ENABLE_HTTP2, default=false"`
	// RequeueInterval determines the interval the controller will requeue an
	// AccessRequest.
	// Valid time units are "ms", "s", "m", "h".
	// Default: 3 minutes
	RequeueInterval time.Duration `env:"REQUEUE_INTERVAL, default=3m"`
}

ControllerConfig defines the controller configurations

type ControllerConfigurer

type ControllerConfigurer interface {
	EnableLeaderElection() bool
	ControllerPort() int
	ControllerHealthProbeAddr() string
	ControllerEnableHTTP2() bool
	ControllerRequeueInterval() time.Duration
}

ControllerConfigurer defines the accessor methods for the controller's configurations.

type LogConfig

type LogConfig struct {
	// Level defines the log level.
	// Possible values: debug, info, error
	// Default: info
	Level string `env:"LEVEL, default=info"`
	// Format defines the log output format.
	// Possible values: text, json
	// Default: text
	Format string `env:"FORMAT, default=text"`
}

LogConfig defines the log configurations

type LogConfigurer

type LogConfigurer interface {
	LogLevel() string
	LogFormat() string
}

LogConfigurer defines the accessor methods for log configurations.

type MetricsConfig

type MetricsConfig struct {
	// Address The address the metric endpoint binds to.
	// Can be set to 0 in order to disable the metrics server
	Address string `env:"ADDR, default=:8090"`
	// Secure If set the metrics endpoint is served securely.
	Secure bool `env:"SECURE, default=false"`
}

MetricsConfig defines the metrics configurations

type MetricsConfigurer

type MetricsConfigurer interface {
	MetricsAddress() string
	MetricsSecure() bool
}

MetricsConfigurer defines the accessor methods for metrics configurations.

type PluginConfig

type PluginConfig struct {
	// Path must be the full path to the binary implementing the plugin interface
	Path string `env:"PATH"`
}

PluginConfig defines the plugin configuration

type PluginConfigurer

type PluginConfigurer interface {
	PluginPath() string
}

PluginConfigurer defines the accessor methods for the plugin configurations.

Jump to

Keyboard shortcuts

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