kcc

package
v0.5.15 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 29 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,
	cncFetcher cnc.CNCFetcher,
) 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 {
	// InitializeConfig trigger dynamic configuration initialize directly
	InitializeConfig(ctx context.Context) error
	// AddConfigWatcher add gvr to list which will be watched to get dynamic configuration
	AddConfigWatcher(gvrs ...metav1.GroupVersionResource) error
	// 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,
	cncFetcher cnc.CNCFetcher, conf *pkgconfig.Configuration,
) (ConfigurationManager, error)

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

type Data

type Data struct {
	sync.Mutex
	Item *DataItem
}

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 DataItem

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

type DummyConfigurationManager

type DummyConfigurationManager struct{}

func (*DummyConfigurationManager) AddConfigWatcher

func (d *DummyConfigurationManager) AddConfigWatcher(_ ...metav1.GroupVersionResource) error

func (*DummyConfigurationManager) InitializeConfig

func (d *DummyConfigurationManager) InitializeConfig(_ context.Context) error

func (*DummyConfigurationManager) Run

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) InitializeConfig

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

InitializeConfig will try to initialize dynamic config

func (*DynamicConfigManager) Run

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

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

type TargetConfigData

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

Jump to

Keyboard shortcuts

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