Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigManager ¶
type ConfigManager struct {
// contains filtered or unexported fields
}
ConfigManager manages ConfigLoaders and merges structured configuration values from multiple sources. The order in which the configurations are merged are based on the order of when each Loader is added to the ConfigManager.
func NewConfigManager ¶
func NewConfigManager() *ConfigManager
func (*ConfigManager) AddConfigLoaders ¶
func (c *ConfigManager) AddConfigLoaders(loader ...Loader)
func (*ConfigManager) LoadAndUnmarshalConfig ¶
func (c *ConfigManager) LoadAndUnmarshalConfig(configName configv1alpha1.ConfigName, out interface{}) error
LoadAndUnmarshalConfig will load and unmarshal the given config name into out.
If an error is encountered, it will return a previously known good value if available, and log the error. Otherwise, if there is no previously cached value for configName, then the error will be propagated back to the caller.
type ConfigMapLoader ¶
type ConfigMapLoader struct {
// contains filtered or unexported fields
}
ConfigMapLoader is a dynamic Loader that starts an informer to watch changes on a ConfigMap with a specific name and namespace. Supports loading both JSON and YAML configuration.
func NewConfigMapLoader ¶
func NewConfigMapLoader(client kubernetes.Interface, namespace, name string) *ConfigMapLoader
func (*ConfigMapLoader) Load ¶
func (c *ConfigMapLoader) Load(configName configv1alpha1.ConfigName) (Config, error)
Load returns the unmarshaled config data stored in a given ConfigMap. If the ConfigMap or config name in the ConfigMap does not exist, an empty config will be returned.
func (*ConfigMapLoader) Name ¶
func (c *ConfigMapLoader) Name() string
type DefaultsLoader ¶
type DefaultsLoader struct { // Can override defaults here, but they are not expected to reload after Start() // is called. Exposed for unit tests. Defaults map[configv1alpha1.ConfigName]runtime.Object // contains filtered or unexported fields }
DefaultsLoader is a simple Loader that populates hardcoded defaults. This is intended to be a fallback when all configs are not populated.
func NewDefaultsLoader ¶
func NewDefaultsLoader() *DefaultsLoader
func (*DefaultsLoader) Load ¶
func (d *DefaultsLoader) Load(configName configv1alpha1.ConfigName) (Config, error)
func (*DefaultsLoader) Name ¶
func (d *DefaultsLoader) Name() string
type Loader ¶
type Loader interface { Name() string Start(context.Context) error Load(configName configv1alpha1.ConfigName) (Config, error) }
Loader knows how to loads a Config given a config name.
type SecretLoader ¶
type SecretLoader struct {
*ConfigMapLoader
}
SecretLoader is a dynamic Loader that starts an informer to watch changes on a Secret with a specific name and namespace. Supports loading both JSON and YAML configuration.
func NewSecretLoader ¶
func NewSecretLoader(client kubernetes.Interface, namespace, name string) *SecretLoader
func (*SecretLoader) Name ¶
func (c *SecretLoader) Name() string