types

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContainerRuntime = "containerd"

Functions

func GetLogKey

func GetLogKey() string

Types

type Converter

type Converter func(interface{}) (string, error)

type Directive

type Directive interface {
	GetPluginMeta() *PluginMeta
	GetParams() Params
	GetSections() []Directive
}

func NewCopyDirective

func NewCopyDirective(directives []Output) Directive

func NewFlatDirective

func NewFlatDirective(meta PluginMeta, config interface{}, secretLoader secret.SecretLoader) (Directive, error)

type Filter

type Filter interface {
	Directive
}

type Flow

type Flow struct {
	PluginMeta

	//Flow id for metrics
	FlowID string
	// Chain of Filters that will process the event. Can be zero or more.
	Filters []Filter `json:"filters,omitempty"`
	// List of Outputs that will emit the event, at least one output is required.
	Outputs []Output `json:"outputs"`

	// Matches for select or exclude
	Matches []FlowMatch `json:"matches,omitempty"`

	// Fluentd label
	FlowLabel string `json:"-"`

	// Flag whether to add the label to the main event router
	AddRoute bool
}

func NewFlow

func NewFlow(matches []FlowMatch, id, name, namespace, flowLabel string, includeLabelInRouter *bool) (*Flow, error)

func (*Flow) GetParams

func (f *Flow) GetParams() Params

func (*Flow) GetPluginMeta

func (f *Flow) GetPluginMeta() *PluginMeta

func (*Flow) GetSections

func (f *Flow) GetSections() []Directive

func (*Flow) WithFilters

func (f *Flow) WithFilters(filter ...Filter) *Flow

func (*Flow) WithOutputs

func (f *Flow) WithOutputs(output ...Output) *Flow

type FlowMatch

type FlowMatch struct {
	// Optional set of kubernetes labels
	Labels map[string]string `json:"labels,omitempty"`
	// Optional namespace
	Namespaces []string `json:"namespaces,omitempty"`
	// ContainerNames
	ContainerNames []string `json:"container_names,omitempty"`
	// Hosts
	Hosts []string `json:"hosts,omitempty"`
	// Negate
	Negate bool `json:"negate,omitempty"`
}

func (FlowMatch) GetParams

func (f FlowMatch) GetParams() Params

func (FlowMatch) GetPluginMeta

func (f FlowMatch) GetPluginMeta() *PluginMeta

func (FlowMatch) GetSections

func (f FlowMatch) GetSections() []Directive

type FlowRoute

type FlowRoute struct {
	PluginMeta
	Params  Params
	Matches []Directive
}

func (*FlowRoute) GetParams

func (f *FlowRoute) GetParams() Params

func (*FlowRoute) GetPluginMeta

func (f *FlowRoute) GetPluginMeta() *PluginMeta

func (*FlowRoute) GetSections

func (f *FlowRoute) GetSections() []Directive

type FluentConfig

type FluentConfig interface {
	GetDirectives() []Directive
}

type GenericDirective

type GenericDirective struct {
	PluginMeta
	Params        Params      `json:"params,omitempty"`
	SubDirectives []Directive `json:"sections,omitempty"`
}

func (*GenericDirective) GetParams

func (d *GenericDirective) GetParams() Params

func (*GenericDirective) GetPluginMeta

func (d *GenericDirective) GetPluginMeta() *PluginMeta

func (*GenericDirective) GetSections

func (d *GenericDirective) GetSections() []Directive

type Input

type Input interface {
	Directive
}

type Output

type Output interface {
	Directive
}

type OutputPlugin

type OutputPlugin = GenericDirective

type Params

type Params = map[string]string

type PluginMeta

type PluginMeta struct {
	Type      string `json:"type,omitempty"`
	Id        string `json:"id,omitempty"`
	LogLevel  string `json:"log_level,omitempty"`
	Directive string `json:"directive"`
	Label     string `json:"label,omitempty"`
	Tag       string `json:"tag,omitempty"`
}

type PluginParam

type PluginParam struct {
	Description string
	Default     string
	Value       string
	Required    bool
}

func Value

func Value(value string) *PluginParam

type PluginParams

type PluginParams map[string]*PluginParam

func (PluginParams) Equals

func (p PluginParams) Equals(target PluginParams) error

Equals check for exact matching of 2 PluginParams by Values

type Router

type Router struct {
	PluginMeta
	Routes []Directive `json:"routes"`
	Params Params
}

OutputPlugin plugin: https://github.com/kube-logging/fluent-plugin-label-router

func NewRouter

func NewRouter(id string, params Params) *Router

func (*Router) AddRoute

func (r *Router) AddRoute(flow *Flow) *Router

func (*Router) GetParams

func (r *Router) GetParams() Params

func (*Router) GetPluginMeta

func (r *Router) GetPluginMeta() *PluginMeta

func (*Router) GetSections

func (r *Router) GetSections() []Directive

type StructToStringMapper

type StructToStringMapper struct {
	TagName         string
	PluginTagName   string
	ConversionHooks map[string]Converter
	SecretLoader    secret.SecretLoader
}

func NewStructToStringMapper

func NewStructToStringMapper(secretLoader secret.SecretLoader) *StructToStringMapper

func (*StructToStringMapper) StringsMap

func (s *StructToStringMapper) StringsMap(in interface{}) (map[string]string, error)

func (*StructToStringMapper) WithConverter

func (s *StructToStringMapper) WithConverter(name string, c Converter) *StructToStringMapper

type System

type System struct {
	Input         Input    `json:"input"`
	GlobalFilters []Filter `json:"globalFilters"`
	Router        *Router  `json:"router"`
	Flows         []*Flow  `json:"flows"`
}

func (*System) GetDirectives

func (s *System) GetDirectives() []Directive

type SystemBuilder

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

func NewSystemBuilder

func NewSystemBuilder(input Input, globalFilers []Filter, router *Router) *SystemBuilder

func (*SystemBuilder) Build

func (s *SystemBuilder) Build() (*System, error)

func (*SystemBuilder) RegisterDefaultFlow

func (s *SystemBuilder) RegisterDefaultFlow(f *Flow) error

func (*SystemBuilder) RegisterErrorFlow

func (s *SystemBuilder) RegisterErrorFlow(f *Flow) error

Check if we need to register a flow at all?

func (*SystemBuilder) RegisterFlow

func (s *SystemBuilder) RegisterFlow(f *Flow) error

Jump to

Keyboard shortcuts

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