Documentation ¶
Index ¶
- Constants
- Variables
- func NewConfigMapReflector(cs k8sClient.Clientset, t statedb.RWTable[DynamicConfig], c Config, ...) []k8s.ReflectorConfig[DynamicConfig]
- func NewConfigTable(db *statedb.DB) (statedb.RWTable[DynamicConfig], error)
- func RegisterConfigMapReflector(jobGroup job.Group, db *statedb.DB, rcs []k8s.ReflectorConfig[DynamicConfig], ...) error
- func WatchAllKeys(txn statedb.ReadTxn, table statedb.Table[DynamicConfig]) (map[string]DynamicConfig, <-chan struct{})
- type Config
- type ConfigSource
- type DynamicConfig
- type Key
Constants ¶
const TableName = "cilium-configs"
Variables ¶
var ( ByKey = keyIndex.Query ByName = keyNameIndex.Query )
var Cell = cell.Module( "cilium-agent-dynamic-config", "Reflects Cilium configuration to the DynamicConfig table", cell.ProvidePrivate( NewConfigTable, NewConfigMapReflector, ), cell.Provide( statedb.RWTable[DynamicConfig].ToTable, func(c Config) ConfigSource { return c }, ), cell.Invoke( RegisterConfigMapReflector, ), cell.Config(defaultConfig), )
Cell provides a reflector of cilium configs to DynamicConfigMap table. It provides read-only Table[DynamicConfig] and Get/Watch for config keys.
Usage: cell.Module(
... cell.Invoke( func(t statedb.Table[DynamicConfig], db *statedb.DB) { c, f := dynamicconfig.GetKey(db.ReadTxn(), t, "KEY") c, f, w := dynamicconfig.WatchKey(db.ReadTxn(), t, "KEY") }, ), ...
)
Functions ¶
func NewConfigMapReflector ¶
func NewConfigMapReflector(cs k8sClient.Clientset, t statedb.RWTable[DynamicConfig], c Config, l *slog.Logger) []k8s.ReflectorConfig[DynamicConfig]
func NewConfigTable ¶
func RegisterConfigMapReflector ¶
func RegisterConfigMapReflector(jobGroup job.Group, db *statedb.DB, rcs []k8s.ReflectorConfig[DynamicConfig], c Config) error
func WatchAllKeys ¶
func WatchAllKeys(txn statedb.ReadTxn, table statedb.Table[DynamicConfig]) (map[string]DynamicConfig, <-chan struct{})
WatchAllKeys retrieves all DynamicConfig values accounting for priority when the key is present in multiple config sources.
Types ¶
type Config ¶
func (Config) IsKindNodeConfig ¶
type ConfigSource ¶
type ConfigSource interface {
IsKindNodeConfig() bool
}
type DynamicConfig ¶
func GetKey ¶
func GetKey(txn statedb.ReadTxn, table statedb.Table[DynamicConfig], key string) (DynamicConfig, bool)
GetKey retrieves a DynamicConfig value accounting for the priority when the key is present in multiple config sources. It returns the DynamicConfig value associated with the key, if found and boolean indicating whether the key was found or not.
func WatchKey ¶
func WatchKey(txn statedb.ReadTxn, table statedb.Table[DynamicConfig], key string) (DynamicConfig, bool, <-chan struct{})
WatchKey retrieves a DynamicConfig value accounting for priority when the key is present in multiple config sources. It returns the DynamicConfig value associated with the key, if found, a boolean indicating whether the key was found or not, and a watch channel that is closed if the entry is invalidated.
func (DynamicConfig) TableHeader ¶
func (d DynamicConfig) TableHeader() []string
func (DynamicConfig) TableRow ¶
func (d DynamicConfig) TableRow() []string