sdk

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: Apache-2.0 Imports: 12 Imported by: 97

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Register = func(_ GoHook) bool { return false }

Register is a method to define go hooks. return value is for trick with

var _ =

Functions

This section is empty.

Types

type BindingHandler

type BindingHandler func(input *BindingInput) (*BindingOutput, error)

type BindingInput

type BindingInput struct {
	BindingContext binding_context.BindingContext
	Values         utils.Values
	ConfigValues   utils.Values
	LogLabels      map[string]string
	LogEntry       *log.Entry
	Envs           map[string]string
}

type BindingOutput

type BindingOutput struct {
	ConfigValuesPatches *utils.ValuesPatch
	MemoryValuesPatches *utils.ValuesPatch
	Metrics             []metric_operation.MetricOperation
	Error               error
}

type CommonGoHook

type CommonGoHook struct {
	HookConfig   *HookConfig
	HookMetadata *HookMetadata
}

func (*CommonGoHook) CommonMetadataFromRuntime

func (c *CommonGoHook) CommonMetadataFromRuntime() HookMetadata

CommonMetadataFromRuntime extracts hook name and path from source filename. This method should be called from Metadata() implementation in each hook.

func (*CommonGoHook) Config

func (c *CommonGoHook) Config(cfg *HookConfig) *HookConfig

return it from Config() in child structs

func (*CommonGoHook) Run

func (c *CommonGoHook) Run(input *HookInput) (*HookOutput, error)

Run executes a handler like in BindingContext.MapV1 or in framework/shell.

type GoHook

type GoHook interface {
	Metadata() HookMetadata
	Config() (config *HookConfig)
	Run(input *HookInput) (output *HookOutput, err error)
}

type Handlers

type Handlers struct {
	Main              func()
	Group             map[string]func()
	Kubernetes        map[string]func()
	Schedule          map[string]func()
	OnStartup         func()
	OnBeforeAll       func()
	OnAfterAll        func()
	OnBeforeHelm      func()
	OnAfterHelm       func()
	OnAfterDeleteHelm func()
}

type HookBindingContext

type HookBindingContext struct {
	Type       string // type: Event Synchronization Group Schedule
	Binding    string // binding name
	Snapshots  map[string][]kem_types.ObjectAndFilterResult
	WatchEvent string // Added/Modified/Deleted
	Objects    []kem_types.ObjectAndFilterResult
	Object     kem_types.ObjectAndFilterResult
}

type HookConfig

type HookConfig struct {
	YamlConfig string // define bindings with YAML as in shell hooks.

	Schedule          []ScheduleConfig
	Kubernetes        []KubernetesConfig
	OnStartup         *OrderedConfig
	OnBeforeHelm      *OrderedConfig
	OnAfterHelm       *OrderedConfig
	OnAfterDeleteHelm *OrderedConfig
	OnBeforeAll       *OrderedConfig
	OnAfterAll        *OrderedConfig
	MainHandler       BindingHandler
	GroupHandlers     map[string]BindingHandler
}

type HookInput

type HookInput struct {
	BindingContexts []binding_context.BindingContext
	Values          utils.Values
	ConfigValues    utils.Values
	LogLabels       map[string]string
	Envs            map[string]string
}

type HookLoader

type HookLoader interface {
	Load()
}

type HookMetadata

type HookMetadata struct {
	Name       string
	Path       string
	Global     bool
	Module     bool
	ModuleName string
}

type HookOutput

type HookOutput struct {
	ConfigValuesPatches *utils.ValuesPatch
	MemoryValuesPatches *utils.ValuesPatch
	Metrics             []metric_operation.MetricOperation
	Error               error
}

type JqFilterHelper

type JqFilterHelper struct {
	Name            string
	JqFilterFn      func(obj *unstructured.Unstructured) (result string, err error)
	ResultConverter func(string, interface{}) error
}

type KubernetesConfig

type KubernetesConfig struct {
	Name                         string
	ApiVersion                   string
	Kind                         string
	NameSelector                 *kem_types.NameSelector
	NamespaceSelector            *kem_types.NamespaceSelector
	LabelSelector                *metav1.LabelSelector
	FieldSelector                *kem_types.FieldSelector
	JqFilter                     string
	IncludeSnapshotsFrom         []string
	Queue                        string
	Group                        string
	ExecuteHookOnEvents          []kem_types.WatchEventType
	ExecuteHookOnSynchronization bool
	WaitForSynchronization       bool
	KeepFullObjectsInMemory      bool
	AllowFailure                 bool
	Handler                      BindingHandler
	FilterFunc                   func(obj *unstructured.Unstructured) (string, error)
}

type OnAfterHookBinding

type OnAfterHookBinding struct {
	Order   int
	Handler func(bc *binding_context.BindingContext) (*HookOutput, error)
}

func (*OnAfterHookBinding) Handle

type OrderedConfig

type OrderedConfig struct {
	Order   float64
	Handler BindingHandler
}

type ScheduleConfig

type ScheduleConfig struct {
	Name                 string
	Crontab              string
	AllowFailure         bool
	IncludeSnapshotsFrom []string
	Queue                string
	Group                string
	Handler              BindingHandler
}

Jump to

Keyboard shortcuts

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