istio: istio.io/istio/mixer/pkg/runtime/config Index | Files | Directories

package config

import "istio.io/istio/mixer/pkg/runtime/config"

Package config is designed to listen to the config changes through the store and create a fully-resolved configuration state that can be used by the rest of the runtime code.

The main purpose of this library is to create an object-model that simplifies queries and correctness checks that the client code needs to deal with. This is accomplished by making sure the config state is fully resolved, and incorporating otherwise complex queries within this package.

Index

Package Files

converter.go descriptorUtil.go ephemeral.go handler.go kinds.go queries.go snapshot.go strings.go util.go

func BuildHandler Uses

func BuildHandler(
    handler *HandlerStatic,
    instances []*InstanceStatic,
    env adapter.Env, templates map[string]*template.Info) (h adapter.Handler, err error)

BuildHandler instantiates a handler object using the passed in handler and instances configuration.

func CriticalKinds Uses

func CriticalKinds() []string

CriticalKinds returns kinds which are critical for mixer's function and have to be ready for mixer config watch.

func ExtractShortName Uses

func ExtractShortName(name string) string

ExtractShortName extracts the 'name' portion of the FQN.

func GetAdapterCfgDescriptor Uses

func GetAdapterCfgDescriptor(base64Tmpl string) (*descriptor.FileDescriptorSet, *descriptor.FileDescriptorProto, error)

GetAdapterCfgDescriptor find an adapter configuration descriptor

func GetInstancesGroupedByHandlers Uses

func GetInstancesGroupedByHandlers(s *Snapshot) map[*HandlerStatic][]*InstanceStatic

GetInstancesGroupedByHandlers queries the snapshot and returns all used instances, grouped by the handlers that will receive them.

func GetInstancesGroupedByHandlersDynamic Uses

func GetInstancesGroupedByHandlersDynamic(s *Snapshot) map[*HandlerDynamic][]*InstanceDynamic

GetInstancesGroupedByHandlersDynamic queries the snapshot and returns all used instances, grouped by the handlers that will receive them.

func GetTmplDescriptor Uses

func GetTmplDescriptor(base64Tmpl string) (*descriptor.FileDescriptorSet, *descriptor.FileDescriptorProto, string, tmpl.TemplateVariety, error)

GetTmplDescriptor find a template descriptor

func KindMap Uses

func KindMap(adapterInfo map[string]*adapter.Info, templateInfo map[string]*template.Info) map[string]proto.Message

KindMap generates a map from object kind to its proto message.

func ValidateBuilder Uses

func ValidateBuilder(
    handler *HandlerStatic,
    instances []*InstanceStatic, templates map[string]*template.Info) (hb adapter.HandlerBuilder, err error)

ValidateBuilder constructs and validates a builder.

type ActionDynamic Uses

type ActionDynamic struct {
    // Handler that this action is resolved to.
    Handler *HandlerDynamic
    // Instances that should be generated as part of invoking action.
    Instances []*InstanceDynamic
    // Name of the action (optional)
    Name string
}

ActionDynamic configuration. Fully resolved.

type ActionStatic Uses

type ActionStatic struct {
    // Handler that this action is resolved to.
    Handler *HandlerStatic
    // Instances that should be generated as part of invoking action.
    Instances []*InstanceStatic
    // Name of the action (optional)
    Name string
}

ActionStatic configuration. Fully resolved.

type Adapter Uses

type Adapter struct {
    Name string

    // Adapter's file descriptor set.
    ConfigDescSet *descriptor.FileDescriptorSet

    // package name of the `Params` message
    PackageName string

    SupportedTemplates []*Template

    SessionBased bool

    Description string
}

Adapter contains info about an adapter

type Ephemeral Uses

type Ephemeral struct {
    // contains filtered or unexported fields
}

Ephemeral configuration state that gets updated by incoming config change events. By itself, the data contained is not meaningful. BuildSnapshot must be called to create a new snapshot instance, which contains fully resolved config. The Ephemeral is thread safe, which mean the state can be incrementally built asynchronously, before calling BuildSnapshot, using ApplyEvent.

func NewEphemeral Uses

func NewEphemeral(
    templates map[string]*template.Info,
    adapters map[string]*adapter.Info) *Ephemeral

NewEphemeral returns a new Ephemeral instance.

NOTE: initial state is computed even if there are errors in the config. Configuration that has errors is reported in the returned error object, and is ignored in the snapshot creation.

func (*Ephemeral) ApplyEvent Uses

func (e *Ephemeral) ApplyEvent(events []*store.Event)

ApplyEvent to the internal ephemeral state. This gets called by an external event listener to relay store change events to this ephemeral config object.

func (*Ephemeral) BuildSnapshot Uses

func (e *Ephemeral) BuildSnapshot() (*Snapshot, error)

BuildSnapshot builds a stable, fully-resolved snapshot view of the configuration.

func (*Ephemeral) GetEntry Uses

func (e *Ephemeral) GetEntry(event *store.Event) (*store.Resource, bool)

GetEntry returns the value stored for the key in the ephemeral.

func (*Ephemeral) SetState Uses

func (e *Ephemeral) SetState(state map[store.Key]*store.Resource)

SetState with the supplied state map. All existing ephemeral state is overwritten.

type HandlerDynamic Uses

type HandlerDynamic struct {
    Name string

    Adapter *Adapter

    // AdapterConfig used to construct the Handler. This is passed in verbatim to the remote adapter.
    AdapterConfig *types.Any

    // Connection information for the handler.
    Connection *v1beta1.Connection
}

HandlerDynamic configuration for dynamically loaded, grpc adapters. Fully resolved.

func (HandlerDynamic) AdapterName Uses

func (h HandlerDynamic) AdapterName() string

AdapterName gets adapter name

func (HandlerDynamic) AdapterParams Uses

func (h HandlerDynamic) AdapterParams() interface{}

AdapterParams gets AdapterParams

func (HandlerDynamic) ConnectionConfig Uses

func (h HandlerDynamic) ConnectionConfig() interface{}

ConnectionConfig gets connection config of dynamic handler

func (HandlerDynamic) GetName Uses

func (h HandlerDynamic) GetName() string

GetName gets name

type HandlerStatic Uses

type HandlerStatic struct {

    // Name of the Handler. Fully qualified.
    Name string

    // Associated adapter. Always resolved.
    Adapter *adapter.Info

    // parameters used to construct the Handler.
    Params proto.Message
}

HandlerStatic configuration for compiled in adapters. Fully resolved.

func (HandlerStatic) AdapterName Uses

func (h HandlerStatic) AdapterName() string

AdapterName gets adapter name

func (HandlerStatic) AdapterParams Uses

func (h HandlerStatic) AdapterParams() interface{}

AdapterParams gets AdapterParams

func (HandlerStatic) ConnectionConfig Uses

func (h HandlerStatic) ConnectionConfig() interface{}

ConnectionConfig returns nil for static handler

func (HandlerStatic) GetName Uses

func (h HandlerStatic) GetName() string

GetName gets name

type InstanceDynamic Uses

type InstanceDynamic struct {
    Name string

    Template *Template

    // Encoder to create request instance bytes from attributes
    Encoder dynamic.Encoder

    // Params of the instance; used to to create the config SHA.
    Params map[string]interface{}

    // AttributeBindings used to map the adapter output back into attributes
    AttributeBindings map[string]string

    // Language runtime to use for output expressions
    Language lang.LanguageRuntime
}

InstanceDynamic configuration for dynamically loaded templates. Fully resolved.

func (InstanceDynamic) GetName Uses

func (i InstanceDynamic) GetName() string

GetName gets name

func (InstanceDynamic) TemplateName Uses

func (i InstanceDynamic) TemplateName() string

TemplateName gets TemplateName

func (InstanceDynamic) TemplateParams Uses

func (i InstanceDynamic) TemplateParams() interface{}

TemplateParams gets TemplateParams

type InstanceStatic Uses

type InstanceStatic struct {
    // Name of the instance. Fully qualified.
    Name string

    // Associated template. Always resolved.
    Template *template.Info

    // parameters used to construct the instance.
    Params proto.Message

    // inferred type for the instance.
    InferredType proto.Message

    // Language runtime to use for output expressions
    Language lang.LanguageRuntime
}

InstanceStatic configuration for compiled templates. Fully resolved.

func (InstanceStatic) GetName Uses

func (i InstanceStatic) GetName() string

GetName gets name

func (InstanceStatic) TemplateName Uses

func (i InstanceStatic) TemplateName() string

TemplateName gets TemplateName

func (InstanceStatic) TemplateParams Uses

func (i InstanceStatic) TemplateParams() interface{}

TemplateParams gets TemplateParams

type Rule Uses

type Rule struct {
    // Name of the rule
    Name string

    // Namespace of the rule
    Namespace string

    // Match condition
    Match string

    ActionsDynamic []*ActionDynamic

    ActionsStatic []*ActionStatic

    RequestHeaderOperations []*v1beta1.Rule_HeaderOperationTemplate

    ResponseHeaderOperations []*v1beta1.Rule_HeaderOperationTemplate

    // Language runtime to use for expressions
    Language lang.LanguageRuntime
}

Rule configuration. Fully resolved.

type Snapshot Uses

type Snapshot struct {
    ID  int64

    // Static information
    Templates map[string]*template.Info
    Adapters  map[string]*adapter.Info

    // Config store based information
    Attributes attribute.AttributeDescriptorFinder

    HandlersStatic  map[string]*HandlerStatic
    InstancesStatic map[string]*InstanceStatic

    //  TemplateMetadatas contains template descriptors loaded from the store
    TemplateMetadatas map[string]*Template
    //  AdapterMetadatas contains adapter metadata loaded from the store
    AdapterMetadatas map[string]*Adapter

    HandlersDynamic  map[string]*HandlerDynamic
    InstancesDynamic map[string]*InstanceDynamic
    Rules            []*Rule

    // Used to update Perf measures relevant to configuration.
    MonitoringContext context.Context
}

Snapshot view of configuration.

func Empty Uses

func Empty() *Snapshot

Empty returns a new, empty configuration snapshot.

func GetSnapshotForTest Uses

func GetSnapshotForTest(templates map[string]*template.Info, adapters map[string]*adapter.Info, serviceConfig string, globalConfig string) (*Snapshot, error)

GetSnapshotForTest creates a config.Snapshot for testing purposes, based on the supplied configuration.

func (*Snapshot) String Uses

func (s *Snapshot) String() string

String writes out contents of a snapshot in a stable way. Useful for quickly writing out contents in a string for comparison testing.

type Template Uses

type Template struct {
    // Name of the template.
    //
    // Note this is the template's resource name and not the template's internal name that adapter developer
    // uses to implement adapter service.
    Name string

    // Variety of this template
    Variety adptTmpl.TemplateVariety

    // InternalPackageDerivedName is the name of the template from adapter developer point of view.
    // The service and functions implemented by the adapter is based on this name
    // NOTE: This name derived from template proto package and not the resource name.
    InternalPackageDerivedName string

    // Template's file descriptor set.
    FileDescSet *descriptor.FileDescriptorSet

    // package name of the `Template` message
    PackageName string

    // AttributeManifest declares the output attributes for the template.
    // For attribute producing adapters, the output attributes are of the form $out.field_name.
    AttributeManifest map[string]*v1beta1.AttributeManifest_AttributeInfo
}

Template contains info about a template

Directories

PathSynopsis
constant

Package config imports 33 packages (graph) and is imported by 10 packages. Updated 2019-09-25. Refresh now. Tools for package owners.