hook

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: Apache-2.0 Imports: 27 Imported by: 4 modules, 4 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 CreateRateLimiter

func CreateRateLimiter(cfg *config.HookConfig) *rate.Limiter

func NewHookManager

func NewHookManager() *hookManager

Types

type CommonHook

type CommonHook interface {
	Name() string
}

type Hook

type Hook struct {
	Name   string // The unique name like '002-prometheus-hooks/startup_hook'.
	Path   string // The absolute path to the executable file.
	Config *config.HookConfig

	HookController controller.HookController
	RateLimiter    *rate.Limiter

	TmpDir string
}

func NewHook

func NewHook(name, path string) *Hook

func (*Hook) GetConfig

func (h *Hook) GetConfig() *config.HookConfig

func (*Hook) GetConfigDescription

func (h *Hook) GetConfigDescription() string

func (*Hook) LoadConfig

func (h *Hook) LoadConfig(configOutput []byte) (hook *Hook, err error)

func (*Hook) RateLimitWait

func (h *Hook) RateLimitWait(ctx context.Context) error

func (*Hook) Run

func (h *Hook) Run(bindingType BindingType, context []BindingContext, logLabels map[string]string) (*HookResult, error)

func (*Hook) SafeName

func (h *Hook) SafeName() string

func (*Hook) WithHookController

func (h *Hook) WithHookController(hookController controller.HookController)

func (*Hook) WithTmpDir

func (h *Hook) WithTmpDir(dir string)

type HookManager

type HookManager interface {
	Init() error
	Run()
	WithDirectories(workingDir string, tempDir string)
	WithKubeEventManager(kube_events_manager.KubeEventsManager)
	WithScheduleManager(schedule_manager.ScheduleManager)
	WithConversionWebhookManager(*conversion.WebhookManager)
	WithValidatingWebhookManager(*validating.WebhookManager)
	WorkingDir() string
	TempDir() string
	GetHook(name string) *Hook
	GetHookNames() []string
	GetHooksInOrder(bindingType BindingType) ([]string, error)
	HandleKubeEvent(kubeEvent KubeEvent, createTaskFn func(*Hook, controller.BindingExecutionInfo))
	HandleScheduleEvent(crontab string, createTaskFn func(*Hook, controller.BindingExecutionInfo))
	HandleValidatingEvent(event ValidatingEvent, createTaskFn func(*Hook, controller.BindingExecutionInfo))
	HandleConversionEvent(event conversion.Event, rule conversion.Rule, createTaskFn func(*Hook, controller.BindingExecutionInfo))
	FindConversionChain(crdName string, rule conversion.Rule) []conversion.Rule
}

type HookResult

type HookResult struct {
	Usage                *executor.CmdUsage
	Metrics              []operation.MetricOperation
	ConversionResponse   *conversion.Response
	ValidatingResponse   *ValidatingResponse
	KubernetesPatchBytes []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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