kube_config_manager

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigMapGet added in v1.0.6

func ConfigMapGet(kubeClient klient.Client, namespace string, name string) (*v1.ConfigMap, error)

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.

func ConfigMapUpdate added in v1.0.6

func ConfigMapUpdate(kubeClient klient.Client, namespace string, name string, transformFn func(*v1.ConfigMap) error) error

ConfigMapUpdate gets the ConfigMap object from the cluster, call transformation callback and save modified object.

func GetModulesNamesFromConfigData

func GetModulesNamesFromConfigData(configData map[string]string) (map[string]bool, error)

GetModulesNamesFromConfigData returns all keys in kube config except global modNameEnabled keys are also handled

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) Add added in v1.0.6

func (c *Checksums) Add(name string, checksum string)

func (*Checksums) Copy added in v1.0.6

func (c *Checksums) Copy(name string, src *Checksums)

Copy copies all checksums for name from src.

func (*Checksums) HasChecksum added in v1.0.6

func (c *Checksums) HasChecksum(name string) bool

HasChecksum returns true if there is at least one checksum for name.

func (*Checksums) HasEqualChecksum added in v1.0.6

func (c *Checksums) HasEqualChecksum(name string, checksum string) bool

HasEqualChecksum returns true if there is a checksum for name equal to the input checksum.

func (*Checksums) Names added in v1.0.6

func (c *Checksums) Names() map[string]struct{}

func (*Checksums) Remove added in v1.0.6

func (c *Checksums) Remove(name string, checksum string)

func (*Checksums) RemoveAll added in v1.0.6

func (c *Checksums) RemoveAll(name string)

RemoveAll clears all checksums for the name.

func (*Checksums) Set added in v1.0.6

func (c *Checksums) Set(name string, checksum string)

Set saves only one checksum for the name.

type GlobalKubeConfig

type GlobalKubeConfig struct {
	Values     utils.Values
	Checksum   string
	ConfigData map[string]string
}

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 interface {
	WithContext(ctx context.Context)
	WithKubeClient(client klient.Client)
	WithNamespace(namespace string)
	WithConfigMapName(configMap string)
	WithRuntimeConfig(config *config.Config)
	SaveGlobalConfigValues(values utils.Values) error
	SaveModuleConfigValues(moduleName string, values utils.Values) error
	Init() error
	Start()
	Stop()
	KubeConfigEventCh() chan KubeConfigEvent
	SafeReadConfig(handler func(config *KubeConfig))
}

func NewKubeConfigManager

func NewKubeConfigManager() KubeConfigManager

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

Jump to

Keyboard shortcuts

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