plugin

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 34 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exit added in v0.5.0

func Exit(code int)

func Init

func InitWithOptions

func InitWithOptions(opts Options) (*synccontext.RegisterContext, error)

func MustInit

func MustInit() *synccontext.RegisterContext

func MustRegister

func MustRegister(syncer syncertypes.Base)

func MustStart

func MustStart()

func ProConfig added in v0.5.0

func ProConfig() v2.InitConfigPro

func Register

func Register(syncer syncertypes.Base) error

func Start

func Start() error

func UnmarshalConfig added in v0.5.0

func UnmarshalConfig(into interface{}) error

Types

type ClientHook added in v0.5.0

type ClientHook interface {
	syncertypes.Base

	// Resource is the typed resource (e.g. &corev1.Pod{}) that should get mutated.
	Resource() client.Object
}

ClientHook tells the sdk that this action watches on certain vcluster requests and wants to mutate these. The objects this action wants to watch can be defined through the Resource() function that returns a new object of the type to watch. By implementing the defined interfaces below it is possible to watch on: Create, Update (includes patch requests), Delete and Get requests. This makes it possible to change incoming or outgoing objects on the fly, without the need to completely replace a vanilla vcluster syncer.

type Interceptor added in v0.5.0

type Interceptor interface {
	syncertypes.Base

	// Handler is the handler that will handle the requests delegated by the syncer
	http.Handler

	// InterceptionRules returns an rbac style struct which defines what to intercept
	InterceptionRules() []v2.InterceptorRule
}

type Manager

type Manager interface {
	// Init creates a new plugin context and will block until the
	// vcluster container instance could be contacted.
	Init() (*synccontext.RegisterContext, error)

	// InitWithOptions creates a new plugin context and will block until the
	// vcluster container instance could be contacted.
	InitWithOptions(opts Options) (*synccontext.RegisterContext, error)

	// Register makes sure the syncer will be executed as soon as start
	// is run.
	Register(syncer syncertypes.Base) error

	// Start runs all the registered syncers and will block. It only executes
	// the functionality if the current vcluster pod is the current leader and
	// will stop if the pod will lose leader election.
	Start() error

	// UnmarshalConfig retrieves the plugin config from environment and parses it into
	// the given object.
	UnmarshalConfig(into interface{}) error

	// ProConfig returns the pro config retrieved by vCluster.Pro
	ProConfig() v2.InitConfigPro
}

type MutateCreatePhysical added in v0.5.0

type MutateCreatePhysical interface {
	MutateCreatePhysical(ctx context.Context, obj client.Object) (client.Object, error)
}

type MutateCreateVirtual added in v0.5.0

type MutateCreateVirtual interface {
	MutateCreateVirtual(ctx context.Context, obj client.Object) (client.Object, error)
}

type MutateDeletePhysical added in v0.5.0

type MutateDeletePhysical interface {
	MutateDeletePhysical(ctx context.Context, obj client.Object) (client.Object, error)
}

type MutateDeleteVirtual added in v0.5.0

type MutateDeleteVirtual interface {
	MutateDeleteVirtual(ctx context.Context, obj client.Object) (client.Object, error)
}

type MutateGetPhysical added in v0.5.0

type MutateGetPhysical interface {
	MutateGetPhysical(ctx context.Context, obj client.Object) (client.Object, error)
}

type MutateGetVirtual added in v0.5.0

type MutateGetVirtual interface {
	MutateGetVirtual(ctx context.Context, obj client.Object) (client.Object, error)
}

type MutateUpdatePhysical added in v0.5.0

type MutateUpdatePhysical interface {
	MutateUpdatePhysical(ctx context.Context, obj client.Object) (client.Object, error)
}

type MutateUpdateVirtual added in v0.5.0

type MutateUpdateVirtual interface {
	MutateUpdateVirtual(ctx context.Context, obj client.Object) (client.Object, error)
}

type Options

type Options struct {
	// ModifyVirtualManager modifies options for the virtual manager
	ModifyVirtualManager func(options *ctrlmanager.Options)

	// ModifyHostManager modifies options for the host manager
	ModifyHostManager func(options *ctrlmanager.Options)
}

Jump to

Keyboard shortcuts

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