plugin

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuiltinPluginDir

func BuiltinPluginDir() (string, error)

func CapsuleStep

func CapsuleStep[T any](_ T, req pipeline.CapsuleRequest) (string, any, error)

func GetNew

func GetNew(group, kind, name string, req pipeline.CapsuleRequest) (client.Object, error)

func LoadYAMLConfig

func LoadYAMLConfig(data []byte, out any) error

func ParseTemplatedConfig

func ParseTemplatedConfig[T any](data []byte, req pipeline.CapsuleRequest, steps ...ParseStep[T]) (T, error)

Using this, we parse the config at every execution of the plugin. If we get performance issues due to that we can try and optimize that.

func StartPlugin

func StartPlugin(name string, rigPlugin Server)

Types

type ExternalPlugin

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

func (*ExternalPlugin) Run

func (*ExternalPlugin) Stop

func (p *ExternalPlugin) Stop(context.Context)

type GRPCServer

type GRPCServer struct {
	apiplugin.UnimplementedPluginServiceServer

	Impl Server
	// contains filtered or unexported fields
}

func (*GRPCServer) Initialize

func (*GRPCServer) RunCapsule

type Info

type Info struct {
	Image     string `json:"image,omitempty"`
	DirPath   string `json:"dirpath,omitempty"`
	IsBuiltin bool   `json:"isBuiltin,omitempty"`

	OriginalName string `json:"originalName,omitempty"`
	Name         string `json:"name,omitempty"`
	BinaryPath   string `json:"binaryPath,omitempty"`
}

type Manager

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

func NewManager

func NewManager(fs afero.Fs) (*Manager, error)

func (*Manager) GetPlugin

func (m *Manager) GetPlugin(name string) (Info, bool)

func (*Manager) GetPlugins

func (m *Manager) GetPlugins() []Info

func (*Manager) NewStep

func (m *Manager) NewStep(step v1alpha1.Step, logger logr.Logger) (*Step, error)

type Matcher

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

func NewMatcher

func NewMatcher(namespaces, capsules []string, selector metav1.LabelSelector) (Matcher, error)

func (Matcher) Match

func (m Matcher) Match(namespace, capsule string, capsuleLabels map[string]string) bool

type ParseStep

type ParseStep[T any] func(config T, req pipeline.CapsuleRequest) (string, any, error)

type Plugin

type Plugin interface {
	Run(context.Context, pipeline.CapsuleRequest) error
	Stop(context.Context)
}

func NewExternalPlugin

func NewExternalPlugin(name, originalName, pluginConfig, path string, logger logr.Logger) (Plugin, error)

type Server

type Server interface {
	Run(ctx context.Context, req pipeline.CapsuleRequest, logger hclog.Logger) error
	LoadConfig(data []byte) error
}

type Step

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

func (*Step) Apply

func (s *Step) Apply(ctx context.Context, req pipeline.CapsuleRequest) error

func (*Step) Stop

func (s *Step) Stop(ctx context.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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