kind

package
v1.24.16 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: Apache-2.0 Imports: 39 Imported by: 3 modules, 5 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

View Source
const (
	PythonVenvPath   = "hooks/venv"
	PythonBinaryPath = "bin/python3"
)
View Source
const BatchHookReadyKey = "ready"

Variables

This section is empty.

Functions

func ConvertFloatForBinding added in v1.6.0

func ConvertFloatForBinding(value *uint) *float64

Types

type BatchHook added in v1.6.0

type BatchHook struct {
	sh_hook.Hook
	// hook ID in batch
	ID string
	// contains filtered or unexported fields
}

func NewApplicationBatchHook added in v1.18.4

func NewApplicationBatchHook(name, path, appNamespace, appName, id string, keepTemporaryHookFiles bool, logProxyHookJSON bool, logger *log.Logger) *BatchHook

NewApplicationBatchHook new hook for application, which runs via the OS interpreter like bash/python/etc

func NewBatchHook added in v1.6.0

func NewBatchHook(name, path, moduleName string, id string, keepTemporaryHookFiles bool, logProxyHookJSON bool, logger *log.Logger) *BatchHook

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

func (*BatchHook) BackportHookConfig added in v1.6.0

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

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

func (*BatchHook) Execute added in v1.6.0

func (h *BatchHook) Execute(ctx context.Context, configVersion string, bContext []bindingcontext.BindingContext, moduleSafeName string, configValues, values utils.Values, logLabels map[string]string) (*HookResult, error)

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

func (*BatchHook) GetAfterAll added in v1.6.0

func (h *BatchHook) GetAfterAll() *float64

func (*BatchHook) GetAfterDeleteHelm added in v1.6.0

func (h *BatchHook) GetAfterDeleteHelm() *float64

func (*BatchHook) GetBeforeAll added in v1.6.0

func (h *BatchHook) GetBeforeAll() *float64

func (*BatchHook) GetBeforeDeleteHelm added in v1.21.25

func (h *BatchHook) GetBeforeDeleteHelm() *float64

func (*BatchHook) GetConfig added in v1.6.0

func (h *BatchHook) GetConfig() (*BatchHookConfig, error)

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

func (*BatchHook) GetConfigForModule added in v1.6.0

func (h *BatchHook) GetConfigForModule(_ string) (*config.HookConfig, error)

LoadAndValidateShellConfig loads shell hook config from bytes and validate it. Returns multierror.

func (*BatchHook) GetHookConfigDescription added in v1.6.0

func (h *BatchHook) GetHookConfigDescription() string

GetHookConfigDescription get part of hook config for logging/debugging

func (*BatchHook) GetHookController added in v1.6.0

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

GetHookController returns HookController

func (*BatchHook) GetKind added in v1.6.0

func (h *BatchHook) GetKind() HookKind

GetKind returns kind of the hook

func (*BatchHook) GetName added in v1.6.0

func (h *BatchHook) GetName() string

GetName returns the hook's name

func (*BatchHook) GetOnStartup added in v1.6.0

func (h *BatchHook) GetOnStartup() *float64

func (*BatchHook) GetPath added in v1.6.0

func (h *BatchHook) GetPath() string

GetPath returns hook's path on the filesystem

func (*BatchHook) WithHookController added in v1.6.0

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

WithHookController sets dependency "hook controller" for shell-operator

func (*BatchHook) WithTmpDir added in v1.6.0

func (h *BatchHook) WithTmpDir(tmpDir string)

WithTmpDir injects temp directory from operator

type BatchHookConfig added in v1.7.7

type BatchHookConfig struct {
	Hooks            map[string]*sdkhook.HookConfig
	Readiness        *sdkhook.HookConfig
	HasSettingsCheck bool
}

func GetBatchHookConfig added in v1.6.0

func GetBatchHookConfig(moduleName, hookPath string) (*BatchHookConfig, error)

type BatchHookLog added in v1.7.7

type BatchHookLog struct {
	Level string `json:"level"`
}

type GoHook

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

func NewGoHook

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

NewGoHook creates a new go hook

func (*GoHook) AddMetadata

func (h *GoHook) AddMetadata(meta *gohook.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(ctx context.Context, _ string, bContext []bindingcontext.BindingContext, _ string, configValues, values utils.Values, logLabels map[string]string) (*HookResult, error)

Execute runs the hook and return the result of the execution

func (*GoHook) GetAfterAll added in v1.6.0

func (h *GoHook) GetAfterAll() *float64

func (*GoHook) GetAfterDeleteHelm added in v1.6.0

func (h *GoHook) GetAfterDeleteHelm() *float64

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) GetBeforeAll added in v1.6.0

func (h *GoHook) GetBeforeAll() *float64

func (*GoHook) GetBeforeDeleteHelm added in v1.21.25

func (h *GoHook) GetBeforeDeleteHelm() *float64

func (*GoHook) GetConfig

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

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

func (*GoHook) GetConfigForModule added in v1.6.0

func (h *GoHook) GetConfigForModule(_ string) (*config.HookConfig, error)

LoadAndValidateShellConfig loads shell hook config from bytes and validate it. Returns multierror.

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) GetOnStartup added in v1.6.0

func (h *GoHook) GetOnStartup() *float64

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(ctx context.Context, input *gohook.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                 []operation.MetricOperation
	ObjectPatcherOperations []sdkpkg.PatchCollectorOperation
	BindingActions          []gohook.BindingAction
}

HookResult returns result of a hook execution

type HookScheduleConfig added in v1.6.0

type HookScheduleConfig struct {
	// global module
	BeforeAll *uint `json:"beforeAll" yaml:"beforeAll"`
	AfterAll  *uint `json:"afterAll" yaml:"afterAll"`
	// embedded module
	BeforeHelm       *uint `json:"beforeHelm" yaml:"beforeHelm"`
	AfterHelm        *uint `json:"afterHelm" yaml:"afterHelm"`
	BeforeDeleteHelm *uint `json:"beforeDeleteHelm" yaml:"beforeDeleteHelm"`
	AfterDeleteHelm  *uint `json:"afterDeleteHelm" yaml:"afterDeleteHelm"`
}

type ReconcileFunc

type ReconcileFunc func(ctx context.Context, input *gohook.HookInput) error

ReconcileFunc function which holds the main logic of the hook

type SettingsCheck added in v1.17.11

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

func NewSettingsCheck added in v1.17.11

func NewSettingsCheck(path, tmpPath string, logger *log.Logger) *SettingsCheck

func (*SettingsCheck) Check added in v1.17.11

func (c *SettingsCheck) Check(ctx context.Context, settings utils.Values) (settingscheck.Result, error)

Check runs the setting check via the OS interpreter and returns the result of the execution

type ShellHook

type ShellHook struct {
	sh_hook.Hook

	ScheduleConfig *HookScheduleConfig
	// contains filtered or unexported fields
}

func NewShellHook

func NewShellHook(name, path, moduleName string, keepTemporaryHookFiles bool, logProxyHookJSON bool, logger *log.Logger, options ...ShellHookOption) *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(ctx context.Context, configVersion string, bContext []bindingcontext.BindingContext, moduleSafeName string, configValues, values utils.Values, logLabels map[string]string) (*HookResult, error)

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

func (*ShellHook) GetAfterAll added in v1.6.0

func (sh *ShellHook) GetAfterAll() *float64

func (*ShellHook) GetAfterDeleteHelm added in v1.6.0

func (sh *ShellHook) GetAfterDeleteHelm() *float64

func (*ShellHook) GetBeforeAll added in v1.6.0

func (sh *ShellHook) GetBeforeAll() *float64

func (*ShellHook) GetBeforeDeleteHelm added in v1.21.25

func (sh *ShellHook) GetBeforeDeleteHelm() *float64

func (*ShellHook) GetConfig

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

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

func (*ShellHook) GetConfigForModule added in v1.6.0

func (sh *ShellHook) GetConfigForModule(moduleKind string) (*config.HookConfig, error)

LoadAndValidateShellConfig loads shell hook config from bytes and validate it. Returns multierror.

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) GetOnStartup added in v1.6.0

func (sh *ShellHook) GetOnStartup() *float64

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

type ShellHookOption added in v1.6.0

type ShellHookOption func(*ShellHook)

func WithPythonVenv added in v1.6.0

func WithPythonVenv(pythonVenvPath string) ShellHookOption

Jump to

Keyboard shortcuts

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