Documentation ¶
Index ¶
- func ConfigMapGet(kubeClient klient.Client, namespace string, name string) (*v1.ConfigMap, error)
- func ConfigMapMergeValues(kubeClient klient.Client, namespace string, name string, values utils.Values) error
- func ConfigMapUpdate(kubeClient klient.Client, namespace string, name string, ...) error
- func GetModulesNamesFromConfigData(configData map[string]string) (map[string]bool, error)
- type Checksums
- func (c *Checksums) Add(name string, checksum string)
- func (c *Checksums) Copy(name string, src *Checksums)
- func (c *Checksums) HasChecksum(name string) bool
- func (c *Checksums) HasEqualChecksum(name string, checksum string) bool
- func (c *Checksums) Names() map[string]struct{}
- func (c *Checksums) Remove(name string, checksum string)
- func (c *Checksums) RemoveAll(name string)
- func (c *Checksums) Set(name string, checksum string)
- type Config
- type GlobalKubeConfig
- type KubeConfig
- type KubeConfigEvent
- type KubeConfigManager
- func (kcm *KubeConfigManager) Init() error
- func (kcm *KubeConfigManager) KubeConfigEventCh() chan KubeConfigEvent
- func (kcm *KubeConfigManager) SafeReadConfig(handler func(config *KubeConfig))
- func (kcm *KubeConfigManager) SaveGlobalConfigValues(values utils.Values) error
- func (kcm *KubeConfigManager) SaveModuleConfigValues(moduleName string, values utils.Values) error
- func (kcm *KubeConfigManager) Start()
- func (kcm *KubeConfigManager) Stop()
- type ModuleKubeConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigMapGet ¶ added in v1.0.6
ConfigMapGet gets the ConfigMap object from the cluster.
func ConfigMapMergeValues ¶ added in v1.0.6
func ConfigMapMergeValues(kubeClient klient.Client, namespace string, name string, values utils.Values) error
ConfigMapMergeValues is a helper to use ConfigMapUpdate to save Values object in the ConfigMap.
Types ¶
type Checksums ¶ added in v1.0.6
type Checksums struct {
// contains filtered or unexported fields
}
Checksums is a non thread-safe storage for KubeConfig sections checksums.
func NewChecksums ¶ added in v1.0.6
func NewChecksums() *Checksums
func (*Checksums) HasChecksum ¶ added in v1.0.6
HasChecksum returns true if there is at least one checksum for name.
func (*Checksums) HasEqualChecksum ¶ added in v1.0.6
HasEqualChecksum returns true if there is a checksum for name equal to the input checksum.
type GlobalKubeConfig ¶
func GetGlobalKubeConfigFromConfigData ¶
func GetGlobalKubeConfigFromConfigData(configData map[string]string) (*GlobalKubeConfig, error)
func GetGlobalKubeConfigFromValues ¶
func GetGlobalKubeConfigFromValues(values utils.Values) (*GlobalKubeConfig, error)
type KubeConfig ¶ added in v1.0.6
type KubeConfig struct { Global *GlobalKubeConfig Modules map[string]*ModuleKubeConfig }
func NewConfig ¶
func NewConfig() *KubeConfig
func ParseConfigMapData ¶ added in v1.0.6
func ParseConfigMapData(data map[string]string) (cfg *KubeConfig, err error)
type KubeConfigEvent ¶ added in v1.0.6
type KubeConfigEvent string
const ( KubeConfigChanged KubeConfigEvent = "Changed" KubeConfigInvalid KubeConfigEvent = "Invalid" )
type KubeConfigManager ¶
type KubeConfigManager struct { KubeClient klient.Client Namespace string ConfigMapName string // contains filtered or unexported fields }
KubeConfigManager watches for changes in ConfigMap/addon-operator and provides methods to change its content. It stores values parsed from ConfigMap data. OpenAPI validation of these config values is not a responsibility of this component.
func NewKubeConfigManager ¶
func NewKubeConfigManager(ctx context.Context, cfg *Config) *KubeConfigManager
func (*KubeConfigManager) Init ¶
func (kcm *KubeConfigManager) Init() error
func (*KubeConfigManager) KubeConfigEventCh ¶ added in v1.0.6
func (kcm *KubeConfigManager) KubeConfigEventCh() chan KubeConfigEvent
KubeConfigEventCh return a channel that emits new KubeConfig on ConfigMap changes in global section or enabled modules.
func (*KubeConfigManager) SafeReadConfig ¶ added in v1.0.6
func (kcm *KubeConfigManager) SafeReadConfig(handler func(config *KubeConfig))
SafeReadConfig locks currentConfig to safely read from it in external services.
func (*KubeConfigManager) SaveGlobalConfigValues ¶ added in v1.0.6
func (kcm *KubeConfigManager) SaveGlobalConfigValues(values utils.Values) error
func (*KubeConfigManager) SaveModuleConfigValues ¶ added in v1.0.6
func (kcm *KubeConfigManager) SaveModuleConfigValues(moduleName string, values utils.Values) error
SaveModuleConfigValues updates module section in ConfigMap. It uses knownChecksums to prevent KubeConfigChanged event on self-update.
func (*KubeConfigManager) Start ¶
func (kcm *KubeConfigManager) Start()
func (*KubeConfigManager) Stop ¶
func (kcm *KubeConfigManager) Stop()
type ModuleKubeConfig ¶
type ModuleKubeConfig struct { utils.ModuleConfig Checksum string ConfigData map[string]string }
func ExtractModuleKubeConfig ¶
func ExtractModuleKubeConfig(moduleName string, configData map[string]string) (*ModuleKubeConfig, error)
ExtractModuleKubeConfig returns ModuleKubeConfig with values loaded from ConfigMap
func GetModuleKubeConfigFromValues ¶
func GetModuleKubeConfigFromValues(moduleName string, values utils.Values) (*ModuleKubeConfig, error)
func (*ModuleKubeConfig) GetEnabled ¶ added in v1.0.6
func (m *ModuleKubeConfig) GetEnabled() string