Documentation
¶
Index ¶
- func Register(name string, f Factory)
- type BasePlugin
- func (BasePlugin) Name() string
- func (BasePlugin) PreCreatePod(_ context.Context, _ *corev1.Pod, _ *agentsv1alpha1.SandboxPool) *domain.AppError
- func (BasePlugin) PreCreatePool(_ context.Context, _ *agentsv1alpha1.SandboxPool) *domain.AppError
- func (BasePlugin) PreDeletePool(_ context.Context, _ *agentsv1alpha1.SandboxPool) *domain.AppError
- func (BasePlugin) PreUpdatePool(_ context.Context, _ *agentsv1alpha1.SandboxPool, _ []corev1.Pod) (bool, *domain.AppError)
- func (BasePlugin) Start(_ context.Context, _ framework.Handle) error
- type Factory
- type Plugin
- type PluginManager
- func (m *PluginManager) PreCreatePodHooks(ctx context.Context, pod *corev1.Pod, pool *agentsv1alpha1.SandboxPool) *domain.AppError
- func (m *PluginManager) PreCreatePool(ctx context.Context, pool *agentsv1alpha1.SandboxPool) *domain.AppError
- func (m *PluginManager) PreDeletePool(ctx context.Context, pool *agentsv1alpha1.SandboxPool) *domain.AppError
- func (m *PluginManager) PreUpdatePool(ctx context.Context, newPool *agentsv1alpha1.SandboxPool, pods []corev1.Pod) (bool, *domain.AppError)
- func (m *PluginManager) Start(ctx context.Context, h framework.Handle) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BasePlugin ¶
type BasePlugin struct{}
BasePlugin provides no-op implementations for all Plugin hooks. Embed it in your plugin struct and override only the hooks you need.
func (BasePlugin) Name ¶
func (BasePlugin) Name() string
func (BasePlugin) PreCreatePod ¶
func (BasePlugin) PreCreatePod(_ context.Context, _ *corev1.Pod, _ *agentsv1alpha1.SandboxPool) *domain.AppError
func (BasePlugin) PreCreatePool ¶
func (BasePlugin) PreCreatePool(_ context.Context, _ *agentsv1alpha1.SandboxPool) *domain.AppError
func (BasePlugin) PreDeletePool ¶
func (BasePlugin) PreDeletePool(_ context.Context, _ *agentsv1alpha1.SandboxPool) *domain.AppError
func (BasePlugin) PreUpdatePool ¶
func (BasePlugin) PreUpdatePool(_ context.Context, _ *agentsv1alpha1.SandboxPool, _ []corev1.Pod) (bool, *domain.AppError)
type Factory ¶
Factory constructs a Plugin from shared runtime dependencies (Handle) and plugin-specific parameters (Args). Passing nil args is legal for plugins that take no parameters.
type Plugin ¶
type Plugin interface {
// Name returns a unique identifier for this plugin (used in logs).
Name() string
// Start is called once during bootstrap, after the host has constructed
// every plugin but before the reconciler begins processing. Plugins that
// need their own informers (e.g. a ConfigMap-backed catalog) register
// them here via the supplied framework.Handle.Cache(). A non-nil error
// aborts program startup.
Start(ctx context.Context, h framework.Handle) error
// PreCreatePool is called after input validation and template resolution,
// before the SandboxPool is persisted to Kubernetes.
// The plugin may:
// - Mutate pool.Labels / pool.Annotations / pool.Spec
// - Read from input for context (auth info, caller-supplied metadata)
// - Reject by returning an error (ideally *AdmissionError with status hint)
PreCreatePool(ctx context.Context, pool *agentsv1alpha1.SandboxPool) *domain.AppError
// PreUpdatePool is called before the SandboxPool update is persisted.
// oldPool is the current state; newPool is the state that will be written.
// The plugin may mutate newPool or reject the operation.
// Return updated=true if newPool was mutated and must be persisted to Kubernetes.
PreUpdatePool(ctx context.Context, newPool *agentsv1alpha1.SandboxPool, pods []corev1.Pod) (updated bool, err *domain.AppError)
// PreDeletePool is called before the SandboxPool is deleted from Kubernetes.
// The plugin may reject the operation.
PreDeletePool(ctx context.Context, pool *agentsv1alpha1.SandboxPool) *domain.AppError
// PreCreatePod is called after the Pod object is fully assembled but BEFORE
// it is submitted to Kubernetes. Plugins may mutate pod.Spec (e.g. inject
// NodeAffinity). A non-nil error aborts pod creation for this attempt;
// the reconciler will retry on the next tick.
PreCreatePod(ctx context.Context, pod *corev1.Pod, pool *agentsv1alpha1.SandboxPool) *domain.AppError
}
Plugin defines lifecycle hooks for SandboxPool operations. Implement only the hooks you need; embed BasePlugin for no-op defaults.
type PluginManager ¶
type PluginManager struct {
// contains filtered or unexported fields
}
PluginManager holds an ordered list of plugins and executes them sequentially for each lifecycle hook.
A nil *PluginManager is safe to use — all Run* methods are no-ops. This is the expected state for the open-source build (no plugins registered).
func NewPluginManager ¶
func NewPluginManager(plugins ...Plugin) *PluginManager
NewPluginManager creates a PluginManager with the given plugins. Returns nil if no plugins are provided, enabling the nil-safe fast path.
func (*PluginManager) PreCreatePodHooks ¶
func (m *PluginManager) PreCreatePodHooks(ctx context.Context, pod *corev1.Pod, pool *agentsv1alpha1.SandboxPool) *domain.AppError
PreCreatePodHooks calls PreCreatePod on every registered plugin in order. Returns the first error encountered (short-circuits).
func (*PluginManager) PreCreatePool ¶
func (m *PluginManager) PreCreatePool(ctx context.Context, pool *agentsv1alpha1.SandboxPool) *domain.AppError
PreCreatePool calls PreCreate on every registered plugin in order. Returns the first error encountered (short-circuits).
func (*PluginManager) PreDeletePool ¶
func (m *PluginManager) PreDeletePool(ctx context.Context, pool *agentsv1alpha1.SandboxPool) *domain.AppError
PreDeletePool calls PreDelete on every registered plugin in order. Returns the first error encountered (short-circuits).
func (*PluginManager) PreUpdatePool ¶
func (m *PluginManager) PreUpdatePool(ctx context.Context, newPool *agentsv1alpha1.SandboxPool, pods []corev1.Pod) (bool, *domain.AppError)
PreUpdatePool calls PreUpdate on every registered plugin in order. Returns updated=true if any plugin mutated newPool, and the first error encountered (short-circuits).