hooks

package
v0.0.0-...-74ea537 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertClientObjectToMap

func ConvertClientObjectToMap(obj client.Object) (map[string]interface{}, error)

func EvaluateCheckHook

func EvaluateCheckHook(k8sClient client.Reader, hook *kubeobjects.HookSpec, log logr.Logger) (bool, error)

func EvaluateCheckHookExp

func EvaluateCheckHookExp(booleanExpression string, jsonData interface{}) (bool, error)

func EvaluateCheckHookForObjects

func EvaluateCheckHookForObjects(objs []client.Object, hook *kubeobjects.HookSpec, log logr.Logger) (bool, error)

func IsValidJSONPathExpression

func IsValidJSONPathExpression(expr string) bool

func QueryJSONPath

func QueryJSONPath(data interface{}, jsonPath string) (reflect.Value, error)

Types

type CheckHook

type CheckHook struct {
	Hook *kubeobjects.HookSpec
}

func (CheckHook) Execute

func (c CheckHook) Execute(client client.Client, log logr.Logger) error

type ExecHook

type ExecHook struct {
	Hook *kubeobjects.HookSpec
}

func (ExecHook) Execute

func (e ExecHook) Execute(client client.Client, log logr.Logger) error

type HookExecutor

type HookExecutor interface {
	Execute(client client.Client, log logr.Logger) error
}

Hook interface will help in executing the hooks based on the types. Supported types are "check", "scale" and "exec". The implementor needs return the result which would be boolean and error if any.

func GetHookExecutor

func GetHookExecutor(hook kubeobjects.HookSpec) (HookExecutor, error)

Based on the hook type, return the appropriate implementation of the hook.

Jump to

Keyboard shortcuts

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