Documentation ¶
Index ¶
- Constants
- Variables
- type ClientHook
- type GRPCProviderPlugin
- func (p *GRPCProviderPlugin) Client(*plugin.MuxBroker, *rpc.Client) (interface{}, error)
- func (p *GRPCProviderPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error)
- func (p *GRPCProviderPlugin) GRPCServer(_ *plugin.GRPCBroker, _ *grpc.Server) error
- func (p *GRPCProviderPlugin) Server(*plugin.MuxBroker) (interface{}, error)
- type InitConfig
- type Manager
- func (m *Manager) HasClientHooks() bool
- func (m *Manager) HasClientHooksForType(versionKindType plugintypes.VersionKindType) bool
- func (m *Manager) HasPlugins() bool
- func (m *Manager) MutateObject(ctx context.Context, obj client.Object, hookType string, ...) error
- func (m *Manager) SetLeader(ctx context.Context) error
- func (m *Manager) Start(ctx context.Context, currentNamespace string, physicalKubeConfig *rest.Config, ...) error
- type Plugin
- type PluginConfig
Constants ¶
View Source
const PluginConfigEnv = "PLUGIN_CONFIG"
Variables ¶
View Source
var HandshakeConfig = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "VCLUSTER_PLUGIN",
MagicCookieValue: "vcluster",
}
Functions ¶
This section is empty.
Types ¶
type ClientHook ¶
type GRPCProviderPlugin ¶
type GRPCProviderPlugin struct{}
GRPCProviderPlugin is an implementation of the github.com/hashicorp/go-plugin#Plugin and github.com/hashicorp/go-plugin#GRPCPlugin interfaces
func (*GRPCProviderPlugin) Client ¶
func (p *GRPCProviderPlugin) Client(*plugin.MuxBroker, *rpc.Client) (interface{}, error)
Client always returns an error; we're only implementing the GRPCPlugin interface, not the Plugin interface.
func (*GRPCProviderPlugin) GRPCClient ¶
func (p *GRPCProviderPlugin) GRPCClient(_ context.Context, _ *plugin.GRPCBroker, clientConn *grpc.ClientConn) (interface{}, error)
GRPCClient always returns an error; we're only implementing the server half of the interface.
func (*GRPCProviderPlugin) GRPCServer ¶
func (p *GRPCProviderPlugin) GRPCServer(_ *plugin.GRPCBroker, _ *grpc.Server) error
GRPCServer registers the gRPC provider server with the gRPC server that go-plugin is standing up.
func (*GRPCProviderPlugin) Server ¶
func (p *GRPCProviderPlugin) Server(*plugin.MuxBroker) (interface{}, error)
Server always returns an error; we're only implementing the GRPCPlugin interface, not the Plugin interface.
type InitConfig ¶
type InitConfig struct { PhysicalClusterConfig []byte `json:"physicalClusterConfig,omitempty"` SyncerConfig []byte `json:"syncerConfig,omitempty"` CurrentNamespace string `json:"currentNamespace,omitempty"` Options []byte `json:"options,omitempty"` WorkingDir string `json:"workingDir,omitempty"` }
InitConfig is the config the syncer sends to the plugin
type Manager ¶
type Manager struct { // PluginFolder where to load plugins from PluginFolder string // Plugins that were loaded Plugins []*vClusterPlugin // ClientHooks that were loaded ClientHooks map[plugintypes.VersionKindType][]*vClusterPlugin }
func NewManager ¶
func NewManager() *Manager
func (*Manager) HasClientHooks ¶
func (*Manager) HasClientHooksForType ¶
func (m *Manager) HasClientHooksForType(versionKindType plugintypes.VersionKindType) bool
func (*Manager) HasPlugins ¶
func (*Manager) MutateObject ¶
type Plugin ¶
type Plugin interface { // Start runs the plugin and blocks until the plugin finishes Start( ctx context.Context, currentNamespace, targetNamespace string, virtualKubeConfig *rest.Config, physicalKubeConfig *rest.Config, syncerConfig *clientcmdapi.Config, options *options.VirtualClusterOptions, ) error // SetLeader signals the plugin that the syncer acquired leadership and starts executing controllers SetLeader() error // MutateObject mutates the objects of the given version kind type MutateObject(ctx context.Context, obj client.Object, hookType string, scheme *runtime.Scheme) error // HasClientHooks returns if there are any plugin client hooks HasClientHooks() bool // HasClientHooksForType returns if there are any plugin client hooks for the given type HasClientHooksForType(versionKindType plugintypes.VersionKindType) bool }
type PluginConfig ¶
type PluginConfig struct {
ClientHooks []*ClientHook `json:"clientHooks,omitempty"`
}
PluginConfig is the config the plugin sends back to the syncer
Click to show internal directories.
Click to hide internal directories.