Documentation
¶
Index ¶
Constants ¶
const DemoPluginName = "demo-pod-tweaks"
Variables ¶
var DefaultRegistry = NewRegistry()
Functions ¶
func DecodeJSON ¶
func DecodeJSON(cfg *apiextensionsv1.JSON, out any) error
DecodeJSON decodes a plugin config into the provided out struct. It is a helper for built-in plugins.
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain represents an ordered list of plugins built from a ModelServing spec.
func NewChain ¶
func NewChain(registry *Registry, specs []workloadv1alpha1.PluginSpec) (*Chain, error)
NewChain builds a Chain from plugin specs and the registry.
func (*Chain) OnPodCreate ¶
func (c *Chain) OnPodCreate(ctx context.Context, req *HookRequest) error
OnPodCreate executes plugins in order. Mutations are applied to req.Pod.
func (*Chain) OnPodReady ¶
func (c *Chain) OnPodReady(ctx context.Context, req *HookRequest) error
OnPodReady executes plugins' ready hooks in order.
type DemoConfig ¶
type DemoConfig struct {
RuntimeClassName string `json:"runtimeClassName,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
Env []corev1.EnvVar `json:"env,omitempty"`
}
DemoConfig is a simple config used by the demo plugin to mutate pods.
type DemoPlugin ¶
type DemoPlugin struct {
// contains filtered or unexported fields
}
DemoPlugin is a sample built-in plugin that tweaks runtimeClass, annotations, and env vars.
func (*DemoPlugin) Name ¶
func (p *DemoPlugin) Name() string
func (*DemoPlugin) OnPodCreate ¶
func (p *DemoPlugin) OnPodCreate(_ context.Context, req *HookRequest) error
OnPodCreate mutates the pod in-place based on the provided config.
func (*DemoPlugin) OnPodReady ¶
func (p *DemoPlugin) OnPodReady(_ context.Context, _ *HookRequest) error
OnPodReady is a no-op for the demo plugin.
type Factory ¶
type Factory func(spec workloadv1alpha1.PluginSpec) (Plugin, error)
Factory constructs a Plugin from a PluginSpec.
type HookRequest ¶
type HookRequest struct {
ModelServing *workloadv1alpha1.ModelServing
ServingGroup string
RoleName string
RoleID string
IsEntry bool
Pod *corev1.Pod
}
HookRequest carries the context for plugin hook invocations.
type Plugin ¶
type Plugin interface {
Name() string
// OnPodCreate is invoked before the controller creates the Pod. Mutations are applied in-place to req.Pod.
OnPodCreate(ctx context.Context, req *HookRequest) error
// OnPodReady is invoked when the controller observes the Pod running and ready.
OnPodReady(ctx context.Context, req *HookRequest) error
}
Plugin defines the lifecycle hooks a plugin may implement.
func NewDemoPlugin ¶
func NewDemoPlugin(spec workloadv1alpha1.PluginSpec) (Plugin, error)
NewDemoPlugin constructs the demo plugin from PluginSpec config.