dynamicconfig

package
v1.17.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const TableName = "cilium-configs"

Variables

View Source
var (
	CiliumConfigMap          = "cilium-config"
	CiliumConfigMapNamespace = "kube-system"
)
View Source
var (
	ByKey = keyIndex.Query

	ByName = keyNameIndex.Query
)
View Source
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,
	),
	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 NewConfigTable

func NewConfigTable(db *statedb.DB) (statedb.RWTable[DynamicConfig], error)

func RegisterConfigMapReflector

func RegisterConfigMapReflector(jobGroup job.Group, db *statedb.DB, rcs []k8s.ReflectorConfig[DynamicConfig], c config) error

Types

type DynamicConfig

type DynamicConfig struct {
	Key   Key
	Value string
}

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

type Key

type Key struct {
	Name   string
	Source string
}

func (Key) String

func (k Key) String() string

Jump to

Keyboard shortcuts

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