plugins

package
v3.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const GRPCPluginName = "K_RAIL_GRPC"

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "K_RAIL_PLUGIN",
	MagicCookieValue: "TRUE",
}

Functions

This section is empty.

Types

type GRPCClient

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

GRPCClient is an implementation of KRailPlugin that talks over RPC.

func (*GRPCClient) ConfigurePlugin

func (m *GRPCClient) ConfigurePlugin(config map[string]interface{}) error

func (*GRPCClient) PluginName

func (m *GRPCClient) PluginName() (string, error)

func (*GRPCClient) PolicyNames

func (m *GRPCClient) PolicyNames() ([]string, error)

func (*GRPCClient) Validate

type GRPCServer

type GRPCServer struct {
	// This is the real implementation
	Impl KRailPlugin
}

Here is the gRPC server that GRPCClient talks to.

func (*GRPCServer) ConfigurePlugin

func (*GRPCServer) PluginName

func (*GRPCServer) PolicyNames

func (*GRPCServer) Validate

type KRailGRPCPlugin

type KRailGRPCPlugin struct {
	// GRPCPlugin must still implement the Plugin interface
	plugin.Plugin
	// Concrete implementation, written in Go. This is only used for plugins
	// that are written in Go.
	Impl KRailPlugin
}

This is the implementation of plugin.GRPCPlugin so we can serve/consume this.

func (*KRailGRPCPlugin) GRPCClient

func (p *KRailGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*KRailGRPCPlugin) GRPCServer

func (p *KRailGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type KRailPlugin

type KRailPlugin interface {
	PluginName() (string, error)
	PolicyNames() ([]string, error)
	ConfigurePlugin(config map[string]interface{}) error
	Validate(policyName string, ar *admissionv1.AdmissionRequest) ([]policies.ResourceViolation, []policies.PatchOperation, error)
}

KRailPlugin is the interface that we're exposing as a plugin.

type Plugin

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

func LaunchPluginProcess

func LaunchPluginProcess(binaryPath string) (*Plugin, error)

func PluginsFromDirectory

func PluginsFromDirectory(directory string) ([]Plugin, error)

func (*Plugin) Configure

func (p *Plugin) Configure(config map[string]interface{}) error

func (*Plugin) Kill

func (p *Plugin) Kill()

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) PolicyNames

func (p *Plugin) PolicyNames() []string

func (*Plugin) Validate

type PluginPolicy

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

PluginPolicy implements the server.Policy interface

func NewPluginPolicy

func NewPluginPolicy(name string, plugin Plugin) PluginPolicy

func (PluginPolicy) Name

func (p PluginPolicy) Name() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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