hook

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2023 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)
	WithAdmissionWebhookManager(*admission.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))
	HandleAdmissionEvent(event AdmissionEvent, createTaskFn func(*Hook, controller.BindingExecutionInfo))
	DetectAdmissionEventType(event AdmissionEvent) BindingType
	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
	AdmissionResponse    *AdmissionResponse
	KubernetesPatchBytes []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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