kind

package
v1.5.0-fix-leak Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 18 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoHook

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

func NewGoHook

func NewGoHook(config *go_hook.HookConfig, f ReconcileFunc) *GoHook

NewGoHook creates a new go hook

func (*GoHook) AddMetadata

func (h *GoHook) AddMetadata(meta *go_hook.HookMetadata)

AddMetadata add hook metadata, name and path which are resolved by SDK registry

func (*GoHook) BackportHookConfig

func (h *GoHook) BackportHookConfig(cfg *config.HookConfig)

BackportHookConfig passes config for shell-operator to make HookController and GetConfigDescription workable.

func (*GoHook) Execute

func (h *GoHook) Execute(_ string, bContext []binding_context.BindingContext, _ string, configValues, values utils.Values, logLabels map[string]string) (result *HookResult, err error)

Execute runs the hook and return the result of the execution

func (*GoHook) GetBasicHook

func (h *GoHook) GetBasicHook() sh_hook.Hook

GetBasicHook returns hook for shell-operator Deprecated: don't use it for production purposes. You don't need such a low level for working with hooks

func (*GoHook) GetConfig

func (h *GoHook) GetConfig() *go_hook.HookConfig

GetConfig returns hook config, which was set by user, while defining the hook

func (*GoHook) GetHookConfigDescription

func (h *GoHook) GetHookConfigDescription() string

GetHookConfigDescription get part of hook config for logging/debugging

func (*GoHook) GetHookController

func (h *GoHook) GetHookController() *controller.HookController

GetHookController returns HookController

func (*GoHook) GetKind

func (h *GoHook) GetKind() HookKind

GetKind returns kind of the hook

func (*GoHook) GetName

func (h *GoHook) GetName() string

GetName returns the hook's name

func (*GoHook) GetPath

func (h *GoHook) GetPath() string

GetPath returns hook's path on the filesystem

func (*GoHook) RateLimitWait

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

RateLimitWait runs query rate limiter pause

func (*GoHook) Run

func (h *GoHook) Run(input *go_hook.HookInput) error

Run start ReconcileFunc

func (*GoHook) WithHookController

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

WithHookController sets dependency "hook controller" for shell-operator

func (*GoHook) WithTmpDir

func (h *GoHook) WithTmpDir(tmpDir string)

WithTmpDir injects temp directory from operator

type HookKind

type HookKind string

HookKind kind of the hook

var (
	// HookKindGo for go hooks
	HookKindGo HookKind = "go"
	// HookKindShell for shell hooks (bash, python, etc)
	HookKindShell HookKind = "shell"
)

type HookResult

type HookResult struct {
	Usage                   *executor.CmdUsage
	Patches                 map[utils.ValuesPatchType]*utils.ValuesPatch
	Metrics                 []metric_operation.MetricOperation
	ObjectPatcherOperations []object_patch.Operation
	BindingActions          []go_hook.BindingAction
}

HookResult returns result of a hook execution

type ReconcileFunc

type ReconcileFunc func(input *go_hook.HookInput) error

ReconcileFunc function which holds the main logic of the hook

type ShellHook

type ShellHook struct {
	sh_hook.Hook
}

func NewShellHook

func NewShellHook(name, path string) *ShellHook

NewShellHook new hook, which runs via the OS interpreter like bash/python/etc

func (*ShellHook) BackportHookConfig

func (sh *ShellHook) BackportHookConfig(cfg *config.HookConfig)

BackportHookConfig for shell-operator to make HookController and GetConfigDescription workable.

func (*ShellHook) Execute

func (sh *ShellHook) Execute(configVersion string, bContext []binding_context.BindingContext, moduleSafeName string, configValues, values utils.Values, logLabels map[string]string) (result *HookResult, err error)

Execute runs the hook via the OS interpreter and returns the result of the execution

func (*ShellHook) GetConfig

func (sh *ShellHook) GetConfig() ([]byte, error)

GetConfig returns config via executing the hook with `--config` param

func (*ShellHook) GetHookConfigDescription

func (sh *ShellHook) GetHookConfigDescription() string

GetHookConfigDescription get part of hook config for logging/debugging

func (*ShellHook) GetHookController

func (sh *ShellHook) GetHookController() *controller.HookController

GetHookController returns HookController

func (*ShellHook) GetKind

func (sh *ShellHook) GetKind() HookKind

GetKind returns kind of the hook

func (*ShellHook) GetName

func (sh *ShellHook) GetName() string

GetName returns the hook's name

func (*ShellHook) GetPath

func (sh *ShellHook) GetPath() string

GetPath returns hook's path on the filesystem

func (*ShellHook) WithHookController

func (sh *ShellHook) WithHookController(hookController *controller.HookController)

WithHookController sets dependency "hook controller" for shell-operator

func (*ShellHook) WithTmpDir

func (sh *ShellHook) WithTmpDir(tmpDir string)

WithTmpDir injects temp directory from operator

Jump to

Keyboard shortcuts

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