go_hook

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: Apache-2.0 Imports: 12 Imported by: 3 modules, 104 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) *bool

Bool returns a pointer to a bool.

func BoolDeref

func BoolDeref(ptr *bool, def bool) bool

BoolDeref dereferences the bool ptr and returns it if not nil, or else returns def.

Types

type BindingAction

type BindingAction struct {
	Name       string // binding name
	Action     string // Disable / UpdateKind
	Kind       string
	ApiVersion string
}

type FilterFunc

type FilterFunc func(*unstructured.Unstructured) (FilterResult, error)

type FilterResult

type FilterResult interface{}

type GoHook

type GoHook interface {
	Config() *HookConfig
	Run(input *HookInput) error
}

type HookBindingContext

type HookBindingContext struct {
	Type      string // type: Event Synchronization Group Schedule
	Binding   string // binding name
	Snapshots map[string][]types.ObjectAndFilterResult
}

type HookConfig

type HookConfig struct {
	Schedule          []ScheduleConfig
	Kubernetes        []KubernetesConfig
	OnStartup         *OrderedConfig
	OnBeforeHelm      *OrderedConfig
	OnAfterHelm       *OrderedConfig
	OnAfterDeleteHelm *OrderedConfig
	OnBeforeAll       *OrderedConfig
	OnAfterAll        *OrderedConfig
	AllowFailure      bool
	Queue             string
	Settings          *HookConfigSettings
}

type HookConfigSettings

type HookConfigSettings struct {
	ExecutionMinInterval time.Duration
	ExecutionBurst       int
}

type HookInput

type HookInput struct {
	Snapshots        Snapshots
	Values           *PatchableValues
	ConfigValues     *PatchableValues
	MetricsCollector MetricsCollector
	PatchCollector   *object_patch.PatchCollector
	LogEntry         *logrus.Entry
	BindingActions   *[]BindingAction
}

func (HookInput) ObjectPatcher

func (hi HookInput) ObjectPatcher() ObjectPatcher

Deprecated. Use methods from PatchCollector property.

type HookMetadata

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

type KubernetesConfig

type KubernetesConfig struct {
	Name                         string
	ApiVersion                   string
	Kind                         string
	NameSelector                 *types.NameSelector
	NamespaceSelector            *types.NamespaceSelector
	LabelSelector                *v1.LabelSelector
	FieldSelector                *types.FieldSelector
	ExecuteHookOnEvents          *bool
	ExecuteHookOnSynchronization *bool
	WaitForSynchronization       *bool
	FilterFunc                   FilterFunc
}

type MetricsCollector

type MetricsCollector interface {
	// Inc increments the specified Counter metric
	Inc(name string, labels map[string]string, opts ...metrics.Option)
	// Add adds custom value for the specified Counter metric
	Add(name string, value float64, labels map[string]string, opts ...metrics.Option)
	// Set specifies the custom value for the Gauge metric
	Set(name string, value float64, labels map[string]string, opts ...metrics.Option)
	// Expire marks metric's group as expired
	Expire(group string)
}

MetricsCollector collects metric's records for exporting them as a batch

type ObjectPatcher

type ObjectPatcher interface {
	CreateObject(object *unstructured.Unstructured, subresource string) error
	CreateOrUpdateObject(object *unstructured.Unstructured, subresource string) error
	FilterObject(filterFunc func(*unstructured.Unstructured) (*unstructured.Unstructured, error),
		apiVersion, kind, namespace, name, subresource string) error
	MergePatchObject(mergePatch []byte, apiVersion, kind, namespace, name, subresource string) error
	JSONPatchObject(jsonPatch []byte, apiVersion, kind, namespace, name, subresource string) error
	DeleteObject(apiVersion, kind, namespace, name, subresource string) error
	DeleteObjectInBackground(apiVersion, kind, namespace, name, subresource string) error
	DeleteObjectNonCascading(apiVersion, kind, namespace, name, subresource string) error
}

TODO delete after refactor hooks to use PatchCollector directly.

type OrderedConfig

type OrderedConfig struct {
	Order float64
}

type PatchableValues

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

func NewPatchableValues

func NewPatchableValues(values map[string]interface{}) (*PatchableValues, error)

func (*PatchableValues) ArrayCount

func (p *PatchableValues) ArrayCount(path string) (int, error)

ArrayCount counts the number of elements in a JSON array at a path

func (*PatchableValues) Exists

func (p *PatchableValues) Exists(path string) bool

Exists checks whether a path exists

func (*PatchableValues) Get

func (p *PatchableValues) Get(path string) gjson.Result

Get value from patchable. It could be null value

func (*PatchableValues) GetOk

func (p *PatchableValues) GetOk(path string) (gjson.Result, bool)

GetOk returns value and `exists` flag

func (*PatchableValues) GetPatches

func (p *PatchableValues) GetPatches() []*utils.ValuesPatchOperation

func (*PatchableValues) GetRaw

func (p *PatchableValues) GetRaw(path string) interface{}

GetRaw get empty interface

func (*PatchableValues) Remove

func (p *PatchableValues) Remove(path string)

func (*PatchableValues) Set

func (p *PatchableValues) Set(path string, value interface{})

type ScheduleConfig

type ScheduleConfig struct {
	Name    string
	Crontab string
}

type Snapshots

type Snapshots map[string][]FilterResult

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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