Documentation ¶
Overview ¶
Package config handles configuration ingestion and processing. validator 1. Accepts new configuration from user 2. Validates configuration 3. Produces a "ValidatedConfig" runtime
- It is validated and actionable configuration
- It resolves the configuration to a list of Combined {aspect, adapter} configs given an attribute.Bag.
- Combined config has complete information needed to dispatch aspect
Index ¶
- Constants
- func GetScopes(attr string, domain string, scopes []string) ([]string, error)
- type API
- type APIResponse
- type AdapterToAspectMapper
- type AspectParams
- type AspectValidator
- type AspectValidatorFinder
- type BuilderValidatorFinder
- type Change
- type ChangeListener
- type ChangeLogReader
- type ChangeNotifier
- type ChangeType
- type KeyValueStore
- type Kind
- type KindSet
- type Manager
- type Resolver
- type StoreListener
- type Validated
Constants ¶
const ( AccessLogsKindName = "access-logs" ApplicationLogsKindName = "application-logs" AttributesKindName = "attributes" DenialsKindName = "denials" ListsKindName = "lists" MetricsKindName = "metrics" QuotasKindName = "quotas" )
Name of all supported aspect kinds.
const ( // example fs:///tmp/testdata/configroot FSUrl = "fs" // example redis://:password@hostname:port/db_number RedisURL = "redis" )
URL types supported by the config store
Variables ¶
This section is empty.
Functions ¶
func GetScopes ¶
GetScopes returns configuration scopes that apply given a target service k8s example: domain maps to global attr - my-svc.my-namespace.svc.cluster.local domain - svc.cluster.local --> "global", "my-namespace.svc.cluster.local", "my-svc.my-namespace.svc.cluster.local" ordering of scopes is from least specific to most specific.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API defines and implements the configuration API. The server constructs and uses a validator for validations The server uses KeyValueStore to persist keys.
func NewAPI ¶
func NewAPI(version string, port uint16, tc expr.TypeChecker, aspectFinder AspectValidatorFinder, builderFinder BuilderValidatorFinder, findAspects AdapterToAspectMapper, store KeyValueStore) *API
NewAPI creates a new API server
type APIResponse ¶
type APIResponse struct { Data interface{} `json:"data,omitempty"` Status rpc.Status `json:"status,omitempty"` }
APIResponse defines the shape of the api response.
type AdapterToAspectMapper ¶
AdapterToAspectMapper returns the set of aspect kinds implemented by the given builder.
type AspectParams ¶
AspectParams describes configuration parameters for an aspect.
type AspectValidator ¶
type AspectValidator interface { // DefaultConfig returns a default configuration struct for this // adapter. This will be used by the configuration system to establish // the shape of the block of configuration state passed to the NewAspect method. DefaultConfig() (c AspectParams) // ValidateConfig determines whether the given configuration meets all correctness requirements. ValidateConfig(c AspectParams, validator expr.TypeChecker, finder descriptor.Finder) *adapter.ConfigErrors }
AspectValidator describes a type that is able to validate Aspect configuration.
type AspectValidatorFinder ¶
type AspectValidatorFinder func(kind Kind) (AspectValidator, bool)
AspectValidatorFinder is used to find specific underlying validators. Manager registry and adapter registry should implement this interface so ConfigValidators can be uniformly accessed.
type BuilderValidatorFinder ¶
type BuilderValidatorFinder func(name string) (adapter.ConfigValidator, bool)
BuilderValidatorFinder is used to find specific underlying validators. Manager registry and adapter registry should implement this interface so ConfigValidators can be uniformly accessed.
type Change ¶
type Change struct { // Key that was affected Key string `json:"key"` // Type how did the key change Type ChangeType `json:"change_type"` // change log index number of the change Index int `json:"index"` }
Change - A record of mutation to the underlying KeyValueStore.
type ChangeListener ¶
type ChangeListener interface {
ConfigChange(cfg Resolver, df descriptor.Finder)
}
ChangeListener listens for config change notifications.
type ChangeLogReader ¶
type ChangeLogReader interface { // ReadChangeLog reads change events >= index ReadChangeLog(index int) ([]Change, error) }
ChangeLogReader read change log from the KV Store
type ChangeNotifier ¶
type ChangeNotifier interface { // Register StoreListener // KeyValueStore should call this method when there is a change // The client should issue ReadChangeLog to see what has changed if the call is available. // else it should re-read the store, perform diff and apply changes. RegisterStoreChangeListener(s StoreListener) }
ChangeNotifier implements change notification machinery for the KeyValueStore.
type ChangeType ¶
type ChangeType int
ChangeType denotes the type of a change
const ( // Update - change was an update or a create to a key. Update ChangeType = iota // Delete - key was removed. Delete )
type KeyValueStore ¶
type KeyValueStore interface { // Get value at a key, false if not found. Get(key string) (value string, index int, found bool) // Set a value. Set(key string, value string) (index int, err error) // List keys with the prefix. List(key string, recurse bool) (keys []string, index int, err error) // Delete a key. Delete(key string) error // Close the storage. Close() fmt.Stringer }
KeyValueStore defines the key value store back end interface used by mixer and Mixer config API server.
It should support back ends like redis, etcd and NFS All commands should return a change log index number which can be used to Read changes. If a KeyValueStore does not support it, it should return -1
func NewCompatFSStore ¶
func NewCompatFSStore(globalConfigFile string, serviceConfigFile string) (KeyValueStore, error)
NewCompatFSStore creates and returns an fsStore using old style This should be removed once we migrate all configs to new style configs.
func NewStore ¶
func NewStore(configURL string) (KeyValueStore, error)
NewStore create a new store based on the config URL.
type Kind ¶
type Kind uint
Kind of aspect
type KindSet ¶
type KindSet uint
KindSet is a set of aspects by kind.
type Manager ¶
Manager represents the config Manager. It is responsible for fetching and receiving configuration changes. It applies validated changes to the registered config change listeners. api.Handler listens for config changes.
func NewManager ¶
func NewManager(eval expr.Evaluator, aspectFinder AspectValidatorFinder, builderFinder BuilderValidatorFinder, findAspects AdapterToAspectMapper, store KeyValueStore, loopDelay time.Duration, identityAttribute string, identityAttributeDomain string) *Manager
NewManager returns a config.Manager. Eval validates and evaluates selectors. It is also used downstream for attribute mapping. AspectFinder finds aspect validator given aspect 'Kind'. BuilderFinder finds builder validator given builder 'Impl'. LoopDelay determines how often configuration is updated. The following fields will be eventually replaced by a repository location. At present we use GlobalConfig and ServiceConfig as command line input parameters. GlobalConfig specifies the location of Global Config. ServiceConfig specifies the location of Service config.
func (*Manager) LastError ¶
LastError returns last error encountered by the manager while processing config.
func (*Manager) Register ¶
func (c *Manager) Register(cc ChangeListener)
Register makes the ConfigManager aware of a ConfigChangeListener.
type Resolver ¶
type Resolver interface { // Resolve resolves configuration to a list of combined configs. Resolve(bag attribute.Bag, kindSet KindSet, strict bool) ([]*pb.Combined, error) // ResolveUnconditional resolves configuration for unconditioned rules. // Unconditioned rules are those rules with the empty selector (""). ResolveUnconditional(bag attribute.Bag, kindSet KindSet, strict bool) ([]*pb.Combined, error) }
Resolver resolves configuration to a list of combined configs.
type StoreListener ¶
type StoreListener interface { // NotifyStoreChanged notify listener that a new change is available. NotifyStoreChanged(index int) }
StoreListener listens for calls from the store that some keys have changed.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package istio_mixer_v1_config is a generated protocol buffer package.
|
Package istio_mixer_v1_config is a generated protocol buffer package. |