hook

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Apache-2.0 Imports: 26 Imported by: 4

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, 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