config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package config is the package that gets centralized configurations periodically and dynamically for a given node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigManagerCheckpoint

type ConfigManagerCheckpoint interface {
	checkpointmanager.Checkpoint
	GetData(kind string) (reflect.Value, metav1.Time)
	SetData(kind string, v reflect.Value, t metav1.Time)
}

func NewCheckpoint

func NewCheckpoint(configResponses map[string]TargetConfigData) ConfigManagerCheckpoint

NewCheckpoint returns an instance of Checkpoint

type ConfigurationLoader

type ConfigurationLoader interface {
	LoadConfig(ctx context.Context, gvr metav1.GroupVersionResource, conf interface{}) error
}

ConfigurationLoader is used to load configurations from centralized server.

func NewKatalystCustomConfigLoader

func NewKatalystCustomConfigLoader(clientSet *client.GenericClientSet, ttl time.Duration, nodeName string) ConfigurationLoader

NewKatalystCustomConfigLoader create a new configManager to fetch KatalystCustomConfig. every LoadConfig() call tries to fetch the value from local cache; if it is not there, invalidated or too old, we fetch it from api-server and refresh the value in cache; otherwise it is just fetched from cache. defaultGVRList s the list of default gvr fetched from remote api-server, if LoadConfig() fetches a new gvr, it will be automatically added to.

type ConfigurationManager

type ConfigurationManager interface {
	// UpdateConfig trigger dynamic configuration update directly
	UpdateConfig(ctx context.Context) error
	// AddConfigWatcher add gvr to list which will be watched to get dynamic configuration
	AddConfigWatcher(gvrs ...metav1.GroupVersionResource) error
	// Register is used when a user wants to get dynamic configuration
	Register(registers ...ConfigurationRegister)
	// Run starts the main loop
	Run(ctx context.Context)
}

ConfigurationManager is a user for ConfigurationLoader working for dynamic configuration manager

func NewDynamicConfigManager

func NewDynamicConfigManager(clientSet *client.GenericClientSet, emitter metrics.MetricEmitter, conf *pkgconfig.Configuration) (ConfigurationManager, error)

NewDynamicConfigManager new a dynamic config manager use katalyst custom config sdk.

type ConfigurationRegister

type ConfigurationRegister interface {
	ApplyConfig(*pkgconfig.DynamicConfiguration)
}

ConfigurationRegister indicates that each user should pass an ConfigurationRegister function to ConfigManager; every time when user-interested configuration changes, the ConfigManager should call the ConfigurationRegister function to notify this change event.

type Data

type Data struct {
	// Data maps from kind to target config data
	Data     map[string]TargetConfigData
	Checksum checksum.Checksum
}

Data holds checkpoint data and its checksum

func (*Data) GetData

func (d *Data) GetData(kind string) (reflect.Value, metav1.Time)

func (*Data) MarshalCheckpoint

func (d *Data) MarshalCheckpoint() ([]byte, error)

func (*Data) SetData

func (d *Data) SetData(kind string, val reflect.Value, t metav1.Time)

func (*Data) UnmarshalCheckpoint

func (d *Data) UnmarshalCheckpoint(blob []byte) error

func (*Data) VerifyChecksum

func (d *Data) VerifyChecksum() error

type DummyConfigurationRegister

type DummyConfigurationRegister struct{}

func (*DummyConfigurationRegister) ApplyConfig

type DynamicConfigManager

type DynamicConfigManager struct {
	// contains filtered or unexported fields
}

DynamicConfigManager is to fetch dynamic config from remote

func (*DynamicConfigManager) AddConfigWatcher

func (c *DynamicConfigManager) AddConfigWatcher(gvrs ...metav1.GroupVersionResource) error

AddConfigWatcher add gvr to list which will be watched to get dynamic configuration

func (*DynamicConfigManager) Register

func (c *DynamicConfigManager) Register(register ...ConfigurationRegister)

Register is to add configurationRegister to a list which will be applied

func (*DynamicConfigManager) Run

func (c *DynamicConfigManager) Run(ctx context.Context)

Run is to start update config loops until the context is done

func (*DynamicConfigManager) UpdateConfig

func (c *DynamicConfigManager) UpdateConfig(ctx context.Context) error

UpdateConfig is to update dynamic config directly

type TargetConfigData

type TargetConfigData struct {
	// Value only store spec of dynamic config crd
	Value     *dynamic.DynamicConfigCRD
	Timestamp metav1.Timestamp
}

Jump to

Keyboard shortcuts

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