Documentation
¶
Index ¶
- Constants
- func ConvertFloatForBinding(value *uint) *float64
- type BatchHook
- func (h *BatchHook) BackportHookConfig(cfg *config.HookConfig)
- func (h *BatchHook) Execute(ctx context.Context, configVersion string, ...) (*HookResult, error)
- func (h *BatchHook) GetAfterAll() *float64
- func (h *BatchHook) GetAfterDeleteHelm() *float64
- func (h *BatchHook) GetBeforeAll() *float64
- func (h *BatchHook) GetConfig() (*BatchHookConfig, error)
- func (h *BatchHook) GetConfigForModule(_ string) (*config.HookConfig, error)
- func (h *BatchHook) GetHookConfigDescription() string
- func (h *BatchHook) GetHookController() *controller.HookController
- func (h *BatchHook) GetKind() HookKind
- func (h *BatchHook) GetName() string
- func (h *BatchHook) GetOnStartup() *float64
- func (h *BatchHook) GetPath() string
- func (h *BatchHook) WithHookController(hookController *controller.HookController)
- func (h *BatchHook) WithTmpDir(tmpDir string)
- type BatchHookConfig
- type BatchHookLog
- type GoHook
- func (h *GoHook) AddMetadata(meta *gohook.HookMetadata)
- func (h *GoHook) BackportHookConfig(cfg *config.HookConfig)
- func (h *GoHook) Execute(ctx context.Context, _ string, bContext []bindingcontext.BindingContext, ...) (*HookResult, error)
- func (h *GoHook) GetAfterAll() *float64
- func (h *GoHook) GetAfterDeleteHelm() *float64
- func (h *GoHook) GetBasicHook() sh_hook.Hook
- func (h *GoHook) GetBeforeAll() *float64
- func (h *GoHook) GetConfig() *gohook.HookConfig
- func (h *GoHook) GetConfigForModule(_ string) (*config.HookConfig, error)
- func (h *GoHook) GetHookConfigDescription() string
- func (h *GoHook) GetHookController() *controller.HookController
- func (h *GoHook) GetKind() HookKind
- func (h *GoHook) GetName() string
- func (h *GoHook) GetOnStartup() *float64
- func (h *GoHook) GetPath() string
- func (h *GoHook) RateLimitWait(ctx context.Context) error
- func (h *GoHook) Run(ctx context.Context, input *gohook.HookInput) error
- func (h *GoHook) WithHookController(hookController *controller.HookController)
- func (h *GoHook) WithTmpDir(tmpDir string)
- type HookKind
- type HookResult
- type HookScheduleConfig
- type ReconcileFunc
- type ShellHook
- func (sh *ShellHook) BackportHookConfig(cfg *config.HookConfig)
- func (sh *ShellHook) Execute(ctx context.Context, configVersion string, ...) (*HookResult, error)
- func (sh *ShellHook) GetAfterAll() *float64
- func (sh *ShellHook) GetAfterDeleteHelm() *float64
- func (sh *ShellHook) GetBeforeAll() *float64
- func (sh *ShellHook) GetConfig() ([]byte, error)
- func (sh *ShellHook) GetConfigForModule(moduleKind string) (*config.HookConfig, error)
- func (sh *ShellHook) GetHookConfigDescription() string
- func (sh *ShellHook) GetHookController() *controller.HookController
- func (sh *ShellHook) GetKind() HookKind
- func (sh *ShellHook) GetName() string
- func (sh *ShellHook) GetOnStartup() *float64
- func (sh *ShellHook) GetPath() string
- func (sh *ShellHook) WithHookController(hookController *controller.HookController)
- func (sh *ShellHook) WithTmpDir(tmpDir string)
- type ShellHookOption
Constants ¶
const ( PythonVenvPath = "hooks/venv" PythonBinaryPath = "bin/python3" )
const BatchHookReadyKey = "ready"
Variables ¶
This section is empty.
Functions ¶
func ConvertFloatForBinding ¶ added in v1.6.0
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 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 (*BatchHook) GetAfterDeleteHelm ¶ added in v1.6.0
func (*BatchHook) GetBeforeAll ¶ added in v1.6.0
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
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) GetOnStartup ¶ added in v1.6.0
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
WithTmpDir injects temp directory from operator
type BatchHookConfig ¶ added in v1.7.7
type BatchHookConfig struct { Hooks map[string]*sdkhook.HookConfig Readiness *sdkhook.HookConfig }
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 (*GoHook) GetAfterDeleteHelm ¶ added in v1.6.0
func (*GoHook) GetBasicHook ¶
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 (*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 ¶
GetHookConfigDescription get part of hook config for logging/debugging
func (*GoHook) GetHookController ¶
func (h *GoHook) GetHookController() *controller.HookController
GetHookController returns HookController
func (*GoHook) GetOnStartup ¶ added in v1.6.0
func (*GoHook) RateLimitWait ¶
RateLimitWait runs query rate limiter pause
func (*GoHook) WithHookController ¶
func (h *GoHook) WithHookController(hookController *controller.HookController)
WithHookController sets dependency "hook controller" for shell-operator
func (*GoHook) WithTmpDir ¶
WithTmpDir injects temp directory from operator
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"` AfterDeleteHelm *uint `json:"afterDeleteHelm" yaml:"afterDeleteHelm"` }
type ReconcileFunc ¶
ReconcileFunc function which holds the main logic of the hook
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 (*ShellHook) GetAfterDeleteHelm ¶ added in v1.6.0
func (*ShellHook) GetBeforeAll ¶ added in v1.6.0
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 ¶
GetHookConfigDescription get part of hook config for logging/debugging
func (*ShellHook) GetHookController ¶
func (sh *ShellHook) GetHookController() *controller.HookController
GetHookController returns HookController
func (*ShellHook) GetOnStartup ¶ added in v1.6.0
func (*ShellHook) WithHookController ¶
func (sh *ShellHook) WithHookController(hookController *controller.HookController)
WithHookController sets dependency "hook controller" for shell-operator
func (*ShellHook) WithTmpDir ¶
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