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 AdapterInfoMap(handlerRegFns []adapter.InfoFn, hndlrBldrValidator handlerBuilderValidator) map[string]*adapter.Info
- func GetScopes(attr string, domain string, scopes []string) ([]string, error)
- func InventoryMap(inv []adapter.InfoFn) map[string]*adapter.Info
- func NewCompatFSStore(globalConfigFile string, serviceConfigFile string) (store.KeyValueStore, error)
- func SetupHandlers(actions []*pb.Action, instances map[string]*pb.Instance, ...) error
- func Store2Inventory() []store.RegisterFunc2
- func StoreInventory() []store.RegisterFunc
- type API
- type APIResponse
- type AdapterToAspectMapper
- type AspectParams
- type AspectValidator
- type AspectValidatorFinder
- type BuilderInfoFinder
- type BuilderValidatorFinder
- type ChangeListener
- type HandlerBuilderInfo
- type HandlerInfo
- type Kind
- type KindSet
- type Manager
- type Resolver
- type SetupHandlerFn
- type Validated
Constants ¶
const ( AttributesKindName = "attributes" QuotasKindName = "quotas" )
Name of all supported aspect kinds.
Variables ¶
This section is empty.
Functions ¶
func AdapterInfoMap ¶
func AdapterInfoMap(handlerRegFns []adapter.InfoFn, hndlrBldrValidator handlerBuilderValidator) map[string]*adapter.Info
AdapterInfoMap returns the known adapter.Infos, indexed by their names.
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.
func InventoryMap ¶
InventoryMap converts adapter inventory to a builder map.
func NewCompatFSStore ¶
func NewCompatFSStore(globalConfigFile string, serviceConfigFile string) (store.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 SetupHandlers ¶
func SetupHandlers(actions []*pb.Action, instances map[string]*pb.Instance, handlers map[string]*HandlerBuilderInfo, tmplRepo template.Repository, expr expr.TypeChecker, df expr.AttributeDescriptorFinder) error
SetupHandlers identifies and invokes all the type configuration (per template) that needs to be done on a handler.
func Store2Inventory ¶
func Store2Inventory() []store.RegisterFunc2
Store2Inventory returns the inventory of Store2Backend.
func StoreInventory ¶
func StoreInventory() []store.RegisterFunc
StoreInventory returns the inventory of store backends.
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 store.KeyValueStore to persist keys.
func NewAPI ¶
func NewAPI(version string, port uint16, tc expr.TypeChecker, aspectFinder AspectValidatorFinder, builderFinder BuilderValidatorFinder, getBuilderInfoFns []adapter.InfoFn, findAspects AdapterToAspectMapper, store store.KeyValueStore, repository template.Repository) *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 BuilderInfoFinder ¶
BuilderInfoFinder is used to find specific handlers Info for configuration.
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 ChangeListener ¶
type ChangeListener interface {
ConfigChange(cfg Resolver, df descriptor.Finder, handlers map[string]*HandlerInfo)
}
ChangeListener listens for config change notifications.
type HandlerBuilderInfo ¶
type HandlerBuilderInfo struct {
// contains filtered or unexported fields
}
HandlerBuilderInfo stores validated HandlerBuilders..
type HandlerInfo ¶
type HandlerInfo struct { Instance adapter.Handler Name string // contains filtered or unexported fields }
HandlerInfo stores validated and configured Handlers.
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, typeChecker expr.TypeChecker, aspectFinder AspectValidatorFinder, builderFinder BuilderValidatorFinder, getBuilderInfoFns []adapter.InfoFn, findAspects AdapterToAspectMapper, repository template.Repository, store 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 SetupHandlerFn ¶
type SetupHandlerFn func(actions []*pb.Action, instances map[string]*pb.Instance, handlers map[string]*HandlerBuilderInfo, tmplRepo template.Repository, expr expr.TypeChecker, df expr.AttributeDescriptorFinder) error
SetupHandlerFn is used to configure handler implementation with Types associated with all the templates that it supports.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package crd provides the store interface to config resources stored as kubernetes custom resource definitions (CRDs).
|
Package crd provides the store interface to config resources stored as kubernetes custom resource definitions (CRDs). |
Package istio_mixer_v1_config is a generated protocol buffer package.
|
Package istio_mixer_v1_config is a generated protocol buffer package. |
Package store provides the interface to the backend storage for the config and the default fsstore implementation.
|
Package store provides the interface to the backend storage for the config and the default fsstore implementation. |