hook

package
v0.0.0-...-81cdc2d Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PointMakeMounts = iota + 1
	PointGenerateContainerOptions
	PointK8sProviderSyncPod
	PointPodAddition
)
View Source
const (
	PluginType = "hook"
)

Variables

This section is empty.

Functions

func Execute

func Execute(ctx Context) error

Execute traverse all handlers according to priority to execute the hook function.

func Register

func Register(name string, h Handler)

Register register hook handler.

Types

type Context

type Context interface {
	Point() Point
}

type GenerateContainerOptionContext

type GenerateContainerOptionContext struct {
	Pod          *v1.Pod
	Container    *v1.Container
	Opts         *pkgcontainer.RunContainerOptions
	PodIPs       []string
	ContainerDir string
	ImageService internalapi.ImageManagerService
}

func (*GenerateContainerOptionContext) Point

type Handler

type Handler interface {
	CanExec(ctx Context) bool
	ExecHook(ctx Context) (*Result, error)
}

type K8sProviderSyncPodContext

type K8sProviderSyncPodContext struct {
	Pod             *v1.Pod
	BkPod           *v1.Pod
	ResourceManager *resource.KubeResourceManager
	Configmaps      []*v1.ConfigMap
	Secrets         []*v1.Secret
}

func (*K8sProviderSyncPodContext) Point

func (c *K8sProviderSyncPodContext) Point() Point

type MakeMountsContext

type MakeMountsContext struct {
	Pod           *v1.Pod
	Container     *v1.Container
	HostPath      *string
	Mount         *v1.VolumeMount
	Envs          []pkgcontainer.EnvVar
	PodVolumesDir string
}

func (*MakeMountsContext) Point

func (c *MakeMountsContext) Point() Point

type PodAdditionContext

type PodAdditionContext struct {
	Pod         *v1.Pod
	PodProvider kri.PodProvider
}

func (*PodAdditionContext) Point

func (c *PodAdditionContext) Point() Point

type Point

type Point int

type Result

type Result struct {
	Terminated bool
	Msg        string
}

type TerminateError

type TerminateError struct {
	Message string
	Reason  string
}

func (*TerminateError) Error

func (e *TerminateError) Error() string

Jump to

Keyboard shortcuts

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